Flutter中TabBarView高度默认充满全屏,the TabBarView doesn’t have a bounded height. 本文记录设置TabBarView高度的方法
参考:https://stackoverflow.com/questions/52023610/getting-horizontal-viewport-was-given-unbounded-height-with-tabbarview-in-flutter
(1)Wrap the parent widget(Column) with a limited height widget like SizedBox or AspectRatio. Then use the Expanded widget like this:
SizedBox(
height: 300.0,
child: Column(
children
在Flutter开发中,TabBarView默认会占据全屏高度。解决这个问题,可以通过包裹父组件Column使用SizedBox或AspectRatio,并配合Expanded widget,或者直接在TabBarView上使用SizedBox或AspectRatio来设定固定高度。参考Stack Overflow上的解决方案。
订阅专栏 解锁全文

5485

被折叠的 条评论
为什么被折叠?



