颤动可滚动列

问题描述 投票:0回答:1

使用这段代码时,我的列不会滚动:

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.

当我将它们单独包装到Flex Widget中时,我可以滚动它们,但是在展开时它们不会使用列的整个空间。

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

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

[

flutter flutter-layout
1个回答
0
投票

试试这段代码:

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

© www.soinside.com 2019 - 2024. All rights reserved.