'while creating flutter email aunthentication i am getting a major error

    enter code here
 import 'package:flutter/material.dart';
 import 'package:email_auth/email_auth.dart';

 class LoginPage extends StatefulWidget {
  const LoginPage({Key? key}) : super(key: key);
 @override
  State<LoginPage> createState() => _LoginPageState();
 }
 class _LoginPageState extends State<LoginPage> {
 final TextEditingController _emailcontroller =TextEditingController();
 final TextEditingController _otpcontroller =TextEditingController();
 void sendOTP()async{
 EmailAuth emailAuth=EmailAuth(sessionName: "Test session");
 var res=await emailAuth.sendOtp(recipientMail: _emailcontroller.text);
 if(res)print("Otp Sent");
 else print("Problem With Otp Sending");
    }
 void verifyOTP() {
 EmailAuth emailAuth = EmailAuth(sessionName: "sessionName");
 var res = emailAuth.validateOtp(
   recipientMail:_emailcontroller.text, userOtp: _otpcontroller.text);
 if(res)print("Hey Otp Verified sucessfully!");
 else print("Please Check your Otp!!");
 }
 @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Verify Email",   
        style: TextStyle( color: Colors.black,
        fontWeight: FontWeight.bold)),
        centerTitle: true,
        backgroundColor: Colors.orange.shade700),
      body: Column(
        children: [
          Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0)),
           Image.asset("images/bms.png",fit:BoxFit.fill),
        SizedBox(height: 20.0),
        Padding(padding: EdgeInsets.all(16.0),
        child: Column(
          children: [
            TextField(
              controller: _emailcontroller,
              keyboardType: TextInputType.emailAddress,
              decoration: InputDecoration(
                hintText: "Enter Email",
                labelText: "Email",
                suffixIcon:TextButton(
                  child: Text("Sent Otp",),
                  onPressed: ()=>sendOTP(),
                ) 
              ),
            ),
            SizedBox(height: 30.0),
            TextField(
              controller: _otpcontroller,
              keyboardType: TextInputType.number,
              obscureText: true,
              decoration: InputDecoration(  
                hintText: "ENTER OTP",
                labelText: "OTP" )),
            SizedBox(height: 30.0),
            ElevatedButton(
              child: Text("Verify OTP",),
              onPressed: ()=>verifyOTP(),
               )
          ],
        )
        
        
        ),
        
        
        ],
      ),
    );
  }

  
}

  

   
  • the error which i got is

════════ Exception caught by rendering library ═════════════════════════════════ The following assertion was thrown during layout: A RenderFlex overflowed by 69 pixels on the bottom.

The relevant error-causing widget was Column lib\loginpage.dart:34 To inspect this widget in Flutter DevTools, visit: http://127.0.0.1:9100/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A59281%2FrAY3NquSCKY%3D%2F&inspectorRef=inspector-11 The overflowing RenderFlex has an orientation of Axis.vertical. The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.

Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size. This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.

The specific RenderFlex in question is: RenderFlex#9b661 relayoutBoundary=up1 OVERFLOWING



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source