I have a TabBar & TabBarView nested within a Block. This is because the content inside the TabBarView is dynamic and the height of the content is not known until runtime.
I cannot nest the Block inside the TabBarView because there is content preceding the TabBar that should scroll along with the TabBarView content.
Diagram:
Code:
new DefaultTabController(
length: 3,
child: new Block(
children: [
new Container(
height: 200.0,
decoration: new BoxDecoration(
backgroundColor: Colors.blue[500],
),
),
new TabBar(
tabs: <Widget>[
new Tab(text: '1'),
new Tab(text: '2'),
new Tab(text: '3'),
],
),
new TabBarView(
children: [
new Text('one'),
new Text('two'),
new Text('three'),
],
),
],
)
);
However, a TabBarView's Viewport is not constrained and requires an ancestor widget with a bounded height constraint. Unfortunately a Block does not give a bounded height because its scrollable nature.
I receive this error when running the layout:
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (28715): The following assertion was thrown during performLayout():
I/flutter (28715): RenderList object was given an infinite size during layout.
I/flutter (28715): This probably means that it is a render object that tries to be as big as possible, but it was put
I/flutter (28715): inside another render object that allows its children to pick their own size.
I/flutter (28715): The nearest ancestor providing an unbounded height constraint is: ...
Any ideas on how to best approach this?