Skip to content

Instantly share code, notes, and snippets.

@ThinkDigitalSoftware
Last active May 10, 2019 18:35
Show Gist options
  • Save ThinkDigitalSoftware/4ecad9489a9a28f4e43924db884785fa to your computer and use it in GitHub Desktop.
Save ThinkDigitalSoftware/4ecad9489a9a28f4e43924db884785fa to your computer and use it in GitHub Desktop.
A custom TabBar where you can control the color behind the Tabs
class ColoredTabBar extends Container implements PreferredSizeWidget {
ColoredTabBar({@required this.color, this.tabBar, this.header});
final Color color;
final TabBar tabBar;
final Widget header;
@override
Size get preferredSize =>
tabBar?.preferredSize ?? Size(double.infinity, 48.0);
@override
Widget build(BuildContext context) {
return Material(
color: color,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Padding(padding: EdgeInsets.only(top: header != null ? 10 : 0)),
header ?? Container(),
tabBar ?? Container(),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment