I am trying to do a multicolor TabBar, where every Tabs have a different background color.
I tried something to give an idea of what i am trying to achieve (but it is only "text background", I would like to have all the Tab background).
import 'package:flutter/material.dart';
void main() {
runApp(TabBarDemo());
}
class TabBarDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
bottom: TabBar(
tabs: [
ColoredBox(
color: Colors.red,
child: Tab(icon: Icon(Icons.directions_car))),
ColoredBox(
color: Colors.green,
child: Tab(icon: Icon(Icons.directions_transit))),
ColoredBox(
color: Colors.purple,
child: Tab(icon: Icon(Icons.directions_bike))),
],
),
title: Text('Tabs Demo'),
),
body: TabBarView(
children: [
Icon(Icons.directions_car),
Icon(Icons.directions_transit),
Icon(Icons.directions_bike),
],
),
),
),
);
}
}