简体   繁体   中英

Flutter scrollable column with expanded children and inside a container

I am struggling with making the column scrollable:

Container(
    height: double.infinity,
    width: double.infinity,
    color: Colors.blue,
    child: Column(
      children: [
      Expanded(flex: 2, child...),
      Expanded(flex: 5, child...)
      ]
    )
)

I tried wrapping all the widget inside a single child scroll view, I tried a list view and I tried combing layout builder but nothing works

When you use expanded you should have a limited space (height in column and width in row), in your case your height will fit the space in screen. If you change the column to the scrollview even change it directly to the ListView or swap it with the SingleChildScrollView, you will have unlimited space and you can't use expanded widget, because it wants to fill all possible space, and it is unlimited in scrollview

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