40

I had an error "Bottom Overflowed by 199 pixel" when creating an Image inside the ListView, and after i google it, all of them suggest me to add:

resizeToAvoidBottomPadding: false

But, it doesnt work! The error is still there.

enter image description here

SafeArea widget is also doesnt solve the problem. Here is the short code version of my layout:

body: ListView(
         children:<Widget> [
           new Container(
             child: new Stack(
               children:<Widget> [
                 //THE WIDGET
                 new Container(), //THE BACKGROND IMAGE
                 new Positioned(
                   child: Column(
                     children:<Widget>[
                         new Transform(),
                         new FadeTransition(),
                         new FadeTransition(),
                         Divider(),
                         new Row(),
                         //THE IMAGE THAT I WANT TO ADD
                         new Container(
                           height: 360.0
                           decoration: BoxDecoration(
                            image: DecorationImage(
                               image: Assetimage('lake.jpg)
                        
CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Haikal Permana
  • 759
  • 3
  • 9
  • 13

9 Answers9

62

Use Scaffold property "resizeToAvoidBottomPadding: false" and "SingleChildScrollView" as parent of Scaffold body:

    home: Scaffold(
          resizeToAvoidBottomInset : false,
          appBar: AppBar(
            title: Text("Registration Page"),
          ),
          body: SingleChildScrollView(
            child: RegisterUserPage(),
          )),
Dhanaji Yadav
  • 1,202
  • 1
  • 14
  • 22
50

put your contents in a SingleChildScrollView and add ConstrainedBox like this:

body :SingleChildScrollView(
        child: ConstrainedBox(
          constraints: BoxConstraints(),
            child: ListView(
         children:<Widget> [
           new Container(
             child: new Stack(
               children:<Widget> [
                 //THE WIDGET
                 new Container(), //THE BACKGROND IMAGE
                 new Positioned(
                   child: Column(
                     children:<Widget>[
                         new Transform(),
                         new FadeTransition(),
                         new FadeTransition(),
                         Divider(),
                         new Row(),
                         //THE IMAGE THAT I WANT TO ADD
                         new Container(
                           height: 360.0
                           decoration: BoxDecoration(
                            image: DecorationImage(
                               image: Assetimage('lake.jpg)

This is may make your screen scrollable and adding constraint will make it finite scroll.

AAEM
  • 1,837
  • 2
  • 18
  • 26
Yogesh kataria
  • 1,605
  • 16
  • 20
14

Nothing, Just include your widget inside Expanded like this

 Expanded(
    child: sectionList(),
  )

//this solved my issue

user7418129
  • 1,074
  • 14
  • 18
3

Using resizeToAvoidBottomInset: true, in Scaffold and wrapping the first child in the body with SingleChildScrollView solved my problem.

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
3

Just Use

SingleChildScrollView()

like as

      body: SingleChildScrollView(
      child:  Column(
        children: [
          widgetClassSectionButton(),
          listAttandance.isNotEmpty ? headLineContainer() : msgNothingToShow(),
          listAttandance.isNotEmpty ? widgetStudentList():widgetMsgEmpty(),
          CustomButton("Submit Data",context)
        ],
      ),
    )
Sandeep Pareek
  • 1,636
  • 19
  • 21
2

The parameter in scaffold works for me, envolve your widget for this error. singlechildscrollview

2

This works for me for long form:

return Scaffold(
  resizeToAvoidBottomInset: true,
  body: SingleChildScrollView(
    child: IntrinsicHeight(
      child: Form(
        key: _formKey,
        child: Column(...
mjablecnik
  • 182
  • 1
  • 14
1

This aligns the item from bottom to top:

child: SizedBox(
              height: MediaQuery.of(context).size.height,
              child: SingleChildScrollView(
                reverse: true,
double-beep
  • 5,031
  • 17
  • 33
  • 41
1

This is How I solved it, adding a resizeToAvoidBottomInset: false, inside Scaffold() and using SingleChildScrollView() inside the body.

 return Scaffold(
      resizeToAvoidBottomInset: false,
      backgroundColor: Colors.grey,
      appBar: AppBar(
        title: Text("Quotes"),
        backgroundColor: Colors.green,
      ),
      body: SingleChildScrollView(
        child: Column(
          children: quotes.map((quote) => quotesTemplete(quote)).toList(),
        ),
      )
    );
Kamau Mbûgua
  • 777
  • 1
  • 10
  • 19