I'm working on an app that needs many TabBar Items (6 or 7). I don't think users like to click the "More" button on TabBars, so I'm wondering how to make my own TabBar that slides from left to right, so one can easily access all the buttons on the tabbar without pressing "More."
Thanks!
To make dynamic tab you can use a List and keep appending the list on every button click. Trick: Clear List and redraw an empty widget and again draw the widgets as per your list.
The selected tab's index can be changed with animateTo. A stateful widget that builds a TabBar or a TabBarView can create a TabController and share it directly. When the TabBar and TabBarView don't have a convenient stateful ancestor, a TabController can be shared by providing a DefaultTabController inherited widget.
I agree with the other answer that it's a bad idea from a design standpoint.
Nevertheless, the technical answer is that you can simply embed a UITabBar
in a UIScrollView
. If you set the tab bar's width and the scroll view's contentSize
appropriately, the tab bar will be scrollable. You will probably want to turn off bouncing and scroll indicators.
I didn't try it with a UITarBarController
.
Opinions on whether this is a good idea or not aside
A simple carousel should be fairly simple to implement from scratch using a UIScrollView with UIButton subviews. which will provide all the scroll mechanics for you
As a sample idea.
But I do agree with the other posters that its a bad UI idea. Id be thinking UIToolbar for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With