Last active
May 10, 2019 18:35
-
-
Save ThinkDigitalSoftware/4ecad9489a9a28f4e43924db884785fa to your computer and use it in GitHub Desktop.
A custom TabBar where you can control the color behind the Tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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