skip to Main Content

Why when I use the TabBarView as child of Expanded to fill all the height of the screen as follows

Expanded(
  child: TabBarView(
    controller: _tabController,
    children: [
      Expanded(child: Text('1')),
      Expanded(child: Text('1'))
    ],
  ),
)

it cause this error

RenderViewport does not support returning intrinsic dimensions.

When I remove the TabBarView, it still works.

I want the TabBarView to take all the height available with Expanded.
The Expanded is children of Column/SliverFillRemaining/CustomScrollView. hasScrollBody: true makes it works but when i click to TextFormField, it cause overflow because the page can’t be scroll

2

Answers


  1. give some height to the TabBarView

     Expanded(
      child: SizedBox(
      height: 100,
      child: TabBarView(
      controller: _tabController,
      children: [
        Expanded(child: Text('1')),
        Expanded(child: Text('1'))
      ],
    ),
    ),
    )
    
    Login or Signup to reply.
  2. Remove Expanded from children of tab bar view.

    Expanded(child: TabBarView(
      controller: _tabController,
      children: const [
          Text('1'),
          Text('1'),
      ],
     ),
    )
    

    And for text field issue set hasScrollBody: false, fillOverscroll: true ,and wrap Column with SizedBox with height: MediaQuery.of(context).size.height,

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search