buildTheme static method
- BuildContext context,
- {required bool hasIcons,
- required ZdsTabBarColor color,
- Color? indicatorColor}
Generates theme for ZdsTabBar.
Implementation
static ZdsTabBarStyleContainer buildTheme(
BuildContext context, {
required bool hasIcons,
required ZdsTabBarColor color,
Color? indicatorColor,
}) {
final zetaColors = Zeta.of(context).colors;
switch (color) {
case ZdsTabBarColor.primary:
return _tabBarStyle(
context,
hasIcons,
background: zetaColors.primary,
indicator: zetaColors.primary.onColor,
selectedText: zetaColors.primary.onColor,
unselectedText: zetaColors.primary.onColor.withOpacity(0.7),
);
case ZdsTabBarColor.basic:
return _tabBarStyle(
context,
hasIcons,
background: zetaColors.surfaceTertiary,
indicator: zetaColors.primary,
selectedText: zetaColors.textDefault,
unselectedText: zetaColors.textSubtle,
);
case ZdsTabBarColor.surface:
return _tabBarStyle(
context,
hasIcons,
background: zetaColors.surfacePrimary,
indicator: zetaColors.primary,
selectedText: zetaColors.textDefault,
unselectedText: zetaColors.textSubtle,
);
case ZdsTabBarColor.appBar:
final appBarTheme = Theme.of(context).appBarTheme;
return _tabBarStyle(
context,
hasIcons,
background: appBarTheme.backgroundColor ?? zetaColors.surfacePrimary,
indicator: appBarTheme.foregroundColor ?? zetaColors.primary,
selectedText: appBarTheme.foregroundColor ?? zetaColors.textDefault,
unselectedText: appBarTheme.foregroundColor?.withOpacity(0.7) ?? zetaColors.textSubtle,
);
}
}