[英]Flutter: Rendering Column inside the AnimatedContainer
I am trying to give an expanded effect like this.我试图给出这样的扩展效果。
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(),
My List widget is我的列表小部件是
@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,
),
],
);
}
I am receiving tons of errors saying我收到大量错误说
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.
It works fine without ListWidget()
.没有
ListWidget()
也可以正常工作。 If I replace Column()
to ListWidget()
then it works fine too.如果我将
Column()
替换为ListWidget()
那么它也可以正常工作。 How can I place the ListView()
inside the Column()
in this case?在这种情况下,如何将
ListView()
放在Column()
内?
And, the animation does not work as well.而且,animation 也不能正常工作。 The container just appears without the animation.
该容器只出现没有 animation。 Wondering how can I adjust this too?
想知道我该如何调整这个呢?
Since your ListView
scroll direction is horizontal, the height of it's parent must be specified.由于您的
ListView
滚动方向是水平的,因此必须指定其父级的高度。 Wrap your ListView
in a Container
and give a height to the container将您的
ListView
包装在Container
中并为容器指定高度
return Container(
height: PREFERRED_HEIGHT,
child: ListView(
// ...
),
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.