I want to achieve a TabBar with Tabs with the following layout:
I found multiple examples where the whole TabBar background is changed but I could not find out how to customize the background for unselected tabs individually, since the grey background is bound to the TabView and not the individual Tab.
In the example image provided, the grey background progress depends on a bool property isAvailable
of the data that is used to render the respective Tab/ TabView.
The green progress bar indicates which tabs are done.
The grey progress bar indicates which tabs are available but not done yet.
The last tab is not available yet, therefore it is not included in the grey progress.
Question:
How can I achieve a Tab layout/ design like in the image provided? And if not with the Tab/ TabView widget, is there another way?
Thanks for your help!
2
Answers
Material and Cupertino TabBar offer only limited options for customization because both implement a defined design language.
One way to do this is to implement the TabBar part completely on your own using ´Stack´with
Positioned
andAlign
widgets to compose the design that you show above and control theTabController
that is needed to control theTabBarView
"manually` from events from your custom TabBar.Tab bar offers only few customizations but this can be achieve using custom code. You can set position and colors of multiple containers to achieve this, like in below example.
You can set colors, radius and visibility according to your conditions.
Hope this helps.