[英]Flutter: Nested ListView Overflow warning
我有一個這樣的嵌套 ListView。
AnimatedContainer(
width: MediaQuery.of(context).size.width * 0.90,
height: MediaQuery.of(context).size.height * 0.45,
child: Stack(
children: [
Positioned(
child: Column(
children: [
Container(
height: MediaQuery.of(context).size.height * 0.30,
width: MediaQuery.of(context).size.width * 0.90,
child: Column(
children: [
Container(
width: 300,
height: MediaQuery.of(context).size.height * 0.20,
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('hmm'),
Row(
ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: [
Container(
height: 40,
width: 200,
color: Colors.white,
),
Container(
height: 40,
width: 200,
color: Colors.white,
),
Container(
height: 40,
width: 200,
color: Colors.white,
),
]
我試圖在容器內產生滾動效果。 但是,我得到The overflowing RenderFlex has an orientation of Axis.horizontal.
首先,我認為這是因為Container
小部件沒有高度和寬度。 但看起來這不是問題,因為我仍然有錯誤。 我嘗試添加Expanded
小部件或另一個Container
小部件來設置高度和寬度。 他們都沒有修復Overflow
警告。
為了使ListView
在AnimatedContainer
內可以垂直滾動,我應該調整什么?
也許您可以嘗試將包裝 ListView 的 Row 替換為水平方向、Container 或具有固定高度的東西。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.