How to change background color of TabBar
without changing the AppBar
?
The TabBar
does not have a background
property, is there a workaround?
Create a simple Widget for this, cannot be simpler:
class ColoredTabBar extends Container implements PreferredSizeWidget {
ColoredTabBar(this.color, this.tabBar);
final Color color;
final TabBar tabBar;
@override
Size get preferredSize => tabBar.preferredSize;
@override
Widget build(BuildContext context) => Container(
color: color,
child: tabBar,
);
}