TabBar(
controller: _tabController,
unselectedLabelColor: Colors.grey,
indicator: BoxDecoration(
borderRadius: BorderRadius.circular(
16.0,
),
color: colors[_tabController.index],
),
tabs: const [
Tab(text: "INFO"),
Tab(text: "ENGAGEMENT"),
Tab(text: "TRACK"),
],
labelStyle: const TextStyle(
color: Colors.white,
fontSize: 13,
fontWeight: FontWeight.w600),
unselectedLabelStyle: const TextStyle(
color: Colors.grey,
fontSize: 13,
fontWeight: FontWeight.w600),
),
),
),
I wanted Each Tab to have a Different color when they're selected
So I tried to change the color when the index changes by storing them in a list
But it doesnt work without setState (I know its not changing the state because the color changes after quick reload)
This is the expected output


