Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter ListView with nested TabBarView

I'm trying to layout my flutter application so that it looks like:

-ListView
  -WidgetA
  -DefaultTabBarController
    -Column
      -TabBar
      -Expanded
        -TabBarView
          -WidgetB
          -WidgetC

So that the whole screen is scollable and that the contents of Widgets A, B, and C can change and the height of the screen is not fixed.

The only way I have been able to get this to work is by doing something like:

-ListView
  -WidgetA
  -Container (with fixed height)
    -Column
      -Expanded
        -DefaultTabBarController
          -Column
            -TabBar
            -Expanded
              -TabBarView
                -WidgetB
                -WidgetC

But I don't want to have a hardcoded height. Does anyone know how I can achieve this?

like image 531
Felix Angelov Avatar asked Aug 10 '18 06:08

Felix Angelov


1 Answers

I've run into the same problem, I think I'm on the right track using Flexible class instead of Column. https://docs.flutter.io/flutter/widgets/Flexible-class.html I'm also using Slivers https://docs.flutter.io/flutter/widgets/SliverList-class.html with CustomScrollView instead of ListView https://docs.flutter.io/flutter/widgets/CustomScrollView-class.html

like image 107
F-1 Avatar answered Nov 15 '22 08:11

F-1