Kevin
Kevin

Reputation: 1223

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

Upvotes: 0

Views: 510

Answers (1)

Ali Bayram
Ali Bayram

Reputation: 7921

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

Upvotes: 1

Related Questions