简体   繁体   English

如何设置TabBarView占用列中两个小部件之间可用的垂直空间

[英]How to set TabBarView to take up as much vertical space as is available in between two widgets in a Column

I have a Column, which has the following widgets inside the column: 我有一列,该列内有以下小部件:

Column(
  Image[has a fixed height]  
  TabBar[has a fixed height]  
  TabBarView[variable height, expand to take up remaining vertical space]  
  BottomNavigationBar[has a fixed height, and of course is 'pinned' to the bottom of the screen]  
),

I need the TabBarView to expand to take up as much space as is available, which will depend on screen size. 我需要TabBarView展开以占用尽可能多的空间,这将取决于屏幕大小。

It kind of sounds like you should be using a Scaffold as it does most of what you want already. 听起来您应该使用脚手架,因为它已经完成了大多数您想要的工作。 The Image and TabBar could be in their own column in a widget that implements PreferredSizeWidget and would be the appBar , the TabBarView would be the body , and the BottomNavigationBar would be the bottomNavigationBar . Image和TabBar可以在实现PreferredSizeWidget的小部件中自己的列中,并且可以是appBar ,TabBarView可以是body ,而BottomNavigationBar可以是bottomNavigationBar

If you're really committed to using a Column, you just need to wrap your TabBarView in an Expanded widget. 如果您确实致力于使用列,则只需将TabBarView包装在Expanded小部件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM