Reputation: 2077
As I am new to flutter, In Android,
app:tabIndicatorFullWidth="false"
I use this property in tabbar to wrap the indicator size with respect to tab text. May I know how to achieve in flutter?
Upvotes: 1
Views: 6160
Reputation: 2077
I Figured out the answer,
TabBar( controller: _tabController,
indicatorColor: Colors.white,
indicatorSize: TabBarIndicatorSize.label,
tabs: getTabs(),
)
indicatorSize: TabBarIndicatorSize.label
this property indicatorSize solved my problem.
Upvotes: 5
Reputation: 3653
You can set the isScrollable
to true
If isScrollable is true, then each tab is as wide as needed for its label and the entire TabBar is scrollable. Otherwise each tab gets an equal share of the available space.
bottom: TabBar(
isScrollable: true, // here
tabs: [
Tab(text: 'Car',),
Tab(text: 'Transit Bus',),
Tab(text: 'Bike',),
],
),
Upvotes: 8