skip to Main Content

I am writing a widgets for taking input email address.
But I am getting the error bottom overflowed by infinity pixels.

This is the code.

return Scaffold(
  body: Column(
    mainAxisSize: MainAxisSize.min,
    children: [
      Container(
          height: space_8,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(space_2),
              color: widgetBackGroundColor
          ),
          child: SizedBox(
            height: space_8,
            child: TextFormField(
              controller: controller,
              keyboardType: TextInputType.emailAddress,
              decoration: InputDecoration(
                hintText: "[email protected]",
              ),
            ),
          )
      )
    ],
  ),
);

3

Answers


  1. Try under your Scaffold:

    resizeToAvoidBottomInset: false;
    

    and you can wrap you Column with SingleChildScrollView

    Login or Signup to reply.
  2. space_8 > size.height.

    Your Column children (which is the container with space_8 height) are larger than the available device height (with keyboard open or otherwise).

    Consider using SingleChildScrollView (as @fotis_psarris said) if you cannot decrease the height of children.

    Or else decrease height of each child or use Flexible/Expanded as per your usecase.

    Login or Signup to reply.
  3. Wrap your Container with Expanded widget

    return SafeArea(child:Scaffold(
      body: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
         Expanded(child:
           Container(
              height: space_8,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(space_2),
                  color: widgetBackGroundColor
              ),
              child: SizedBox(
                height: space_8,
                child: TextFormField(
                  controller: controller,
                  keyboardType: TextInputType.emailAddress,
                  decoration: InputDecoration(
                    hintText: "[email protected]",
                  ),
                ),
              )
          ))
        ],
      ),
    ));
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search