Lukas Luke Stateczny
Lukas Luke Stateczny

Reputation: 597

Flutter Scrollable Column

My Column won't scroll when using this piece of code:

Flexible(
   child: new ListView(
   scrollDirection: Axis.vertical,
   shrinkWrap: true,
   physics: AlwaysScrollableScrollPhysics(),
   children: <Widget>[
       CarsList(uid: widget.uid),
       MotorbikeList(uid: widget.uid)
     ],
   )
),

I can open both Expansion Tiles just fine and also other expansion tiles within them, but I can't scroll down to see the ones hiding in the bottom.

When I wrap them individually into Flex Widget I can then scroll through them but they are not using the entire space of the column when expanded.

Flexible(
   child: CarsList(uid: widget.uid),
),

Flexible(
   child: MotorbikeList(uid: widget.uid),
)

[Now I can scroll down, but they don't expand as I want them too[3]

Upvotes: 2

Views: 4384

Answers (1)

Taym95
Taym95

Reputation: 2510

Try this code:

  Flexible(
    child: new ListView(
      scrollDirection: Axis.vertical,
      shrinkWrap: true,
      physics: AlwaysScrollableScrollPhysics(),
      children: <Widget>[
        Expanded(
          child: CustomScrollView(slivers: <Widget>[
            SliverList(
              delegate: SliverChildBuilderDelegate(
                (BuildContext context, int index) {
                  CarsList(uid: widget.uid),
                  MotorbikeList(uid: widget.uid)
                  },
                childCount: 2,
              ),
            ),
          ])),
      ],
    ));

Upvotes: 4

Related Questions