简体   繁体   中英

Flutter - Bottom Overflowed By 119 Pixels

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.

在此处输入图片说明

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)

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.

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(),
          )),

Nothing, Just include your widget inside Expanded like this

 Expanded(
    child: sectionList(),
  )

//this solved my issue

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

在 Scaffold 中使用resizeToAvoidBottomInset: true,并使用SingleChildScrollView将第一个孩子包裹在正文中解决了我的问题。

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.

在此处输入图片说明

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)

This aligns the item from bottom to top:

child: SizedBox(
              height: MediaQuery.of(context).size.height,
              child: SingleChildScrollView(
                reverse: true,

Just Use

SingleChildScrollView()

like as

      body: SingleChildScrollView(
      child:  Column(
        children: [
          widgetClassSectionButton(),
          listAttandance.isNotEmpty ? headLineContainer() : msgNothingToShow(),
          listAttandance.isNotEmpty ? widgetStudentList():widgetMsgEmpty(),
          CustomButton("Submit Data",context)
        ],
      ),
    )

This works for me for long form:

return Scaffold(
  resizeToAvoidBottomInset: true,
  body: SingleChildScrollView(
    child: IntrinsicHeight(
      child: Form(
        key: _formKey,
        child: Column(...

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(),
        ),
      )
    );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM