reason
The tabbarview
component occupies as much space as the parent component. Generally, the outer layer of this layout is scrollable, similar to singlechildscrollview
, but there is no clear height constraint in the column
, that is, infinite height, so an error is reported.
Solution:
1. Fixed height
It directly solves the problem locally, but there is a big disadvantage. The components loaded by tabbarview
may have different heights, so the predetermined height should be their maximum height, and the layout is not good-looking.
SingleChildScrollView(
child: Column(
children: [
MyTabBar(),
SizedBox(
height: 500,
child: TabBarView(
children:[
MyTabView1(),
MyTabView2(),
],
),
),
],
),
)
2. Do not use the tabbarview
component
It is recommended to use the indexedstack
component instead. The disadvantage is that it lacks the sliding animation of the original tabbarview
component, but it can be customized with the animatedswitcher
component. Click to learn more
SingleChildScrollView(
child: Column(
children: [
MyTabBar(),
IndexedStack(
index: currentIndex, //currentIndex is the value of my example, in reality it may come from TabController, or Provider, etc.
children:[
MyTabView1(),
MyTabView2(),
],
),
),
],
),
)
3. To be continued
Read More:
- How to Solve elasticSearch8.1.2 Install Error in Win10
- How to Solve dtd Error in MybatisGenerator.xml file
- Vue: How to Solve Error uncaught (in promise) cancel
- How to Solve AOP error in Spring
- How to Solve Error in importing scala word2vecmodel
- How to Solve “parcel segmentation fault” Error in Linux
- How to Solve webpack -v View Error in vsode
- How to Solve Vector Variable Error in sub thread
- How to Solve VMware Workstation Error: This virtual machine appears to be in use.
- How to Solve Hmaster hangs up issue due to namenode switching in Ha mode
- How to Solve Error:‘itoa’ was not declared in this scope
- How to Solve brew ERROR in `initialize‘: Version value must be a string; got a NilClass ()
- Android Studio: How to Solve APK error in mobile phone installation
- How to Solve Error: EOF occurred in violation of protocol (_ssl.c:877)
- How to Solve Error: Unkown Mixed bake mode in LightModeUtil.MapSettings() UnityEditor.DockArea:OnGUI()
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- How to Solve Fatal error stdatomic in C/C++ Compilation
- How to Solve AD20 Channel-Offset Error
- [Solved] sqoop Error: jSQLException in nextKeyValue Caused by: ORA-24920:column size too large for client
- How to Solve Starrocks Various Error