Flutter 颤振:渲染动画容器内的列

Flutter 颤振:渲染动画容器内的列,flutter,Flutter,我试图给一个像这样的扩展效果 isOpened == true ? AnimatedContainer( duration: Duration(seconds: 2), curve: Curves.fastOutSlowIn, child: Container(

我试图给一个像这样的扩展效果

  isOpened == true
                        ? AnimatedContainer(
                            duration: Duration(seconds: 2),
                            curve: Curves.fastOutSlowIn,
                            child: Container(
                              width: !_mapViewController.cardExpanded()
                                  ? MediaQuery.of(context).size.width * 0.00
                                  : MediaQuery.of(context).size.width * 0.85,
                              height: !_mapViewController.cardExpanded()
                                  ? MediaQuery.of(context).size.height * 0.00
                                  : MediaQuery.of(context).size.height * 0.28,
                              child: Column(
                                children: [
                                  Container(height: 100, width: 100, color: Colors.orange),
                                  ListWidget(),
                                ],
                              ),
                            ),
                          )
                        : Container(),
我的列表小部件是

  @override
  Widget build(BuildContext context) {
    
    return ListView(
      shrinkWrap: true,
      scrollDirection: Axis.horizontal,
      children: [
        RaisedButton(
          onPressed: () {
            print('heey');
          },
          child: Text(
            'heuhaiuh',
          ),
        ),
        Container(
          height: 35,
          width: 35,
        ),
        Container(
          height: 35,
          width: 35,
          color: Colors.green,
        ),
        Container(
          height: 35,
          width: 35,
          color: Colors.yellow,
        ),
        Container(
          height: 35,
          width: 35,
          color: Colors.orange,
        ),
      ],
    );
  }
我收到了大量的错误,比如

flutter: Another exception was thrown: RenderConstrainedBox does not meet its constraints.
flutter: Another exception was thrown: RenderDecoratedBox does not meet its constraints.
flutter: Another exception was thrown: Null check operator used on a null value
flutter: Another exception was thrown: 'package:flutter/src/rendering/object.dart': Failed assertion: line 1704 pos 12: '!_debugDoingThisLayout': is not true.
没有
ListWidget()
,它可以正常工作。如果我将
Column()
替换为
ListWidget()
,那么它也可以正常工作。在这种情况下,如何将
ListView()
放入
列()


而且,动画也不起作用。容器只是在没有动画的情况下出现。想知道我该如何调整吗?

由于您的
列表视图的滚动方向是水平的,因此必须指定其父视图的高度。将
列表视图
包装在
容器中
并为容器指定高度

return Container(
   height: PREFERRED_HEIGHT,
   child: ListView(
     // ...
   ),
);

我不得不等着接受你的回答。但是非常感谢你,伙计。顺便说一句,在这种情况下,动画不起作用,你有任何猜测吗?我试图为
ListView()
设置动画,但在那里也不起作用。