颤振可滚动列

时间:2019-04-02 09:05:51

标签: flutter flutter-layout

使用以下代码时,“我的专栏”将不会滚动:

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

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

1 个答案:

答案 0 :(得分: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,
              ),
            ),
          ])),
      ],
    ));