我正在尝试在抽屉中实现ListView,因此当屏幕方向更改时,不会出现溢出错误。 但是,一旦我将ListView添加到抽屉中,它就不再呈现了,并且出现了错误:
I/flutter (13071): Another exception was thrown: Incorrect use of ParentDataWidget.
I/flutter (13071): Another exception was thrown: RenderBox was not laid out: RenderShrinkWrappingViewport#91f4f relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
我无法弄清楚我的代码不起作用。有人知道为什么吗?
谢谢!
这是我的代码:
Widget build(BuildContext context) {
return Drawer(
child: Container(
child: Flex(
direction: Axis.vertical,
children: <Widget>[
Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: const EdgeInsets.only(left: 40, bottom: 20),
child: Text(
"test",
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Colors.white,
fontSize: 25,
),
),
),
),
Expanded(
child: ListView(
shrinkWrap: true,
children: <Widget>[],
),
)
],
),
),
);
}