buildTheme static method

AppBarTheme buildTheme(
  1. BuildContext context,
  2. ZdsTabBarColor color
)

Builds theme variants for ZdsAppBar.

See also

Implementation

static AppBarTheme buildTheme(BuildContext context, ZdsTabBarColor color) {
  final zetaColors = Zeta.of(context).colors;
  switch (color) {
    case ZdsTabBarColor.appBar:
      return Theme.of(context).appBarTheme;
    case ZdsTabBarColor.primary:
      final fgColor = zetaColors.primary.onColor;
      final bgColor = zetaColors.primary;
      return AppBarTheme(
        systemOverlayStyle: computeSystemOverlayStyle(bgColor),
        backgroundColor: bgColor,
        foregroundColor: fgColor,
        centerTitle: false,
        titleSpacing: 0,
        elevation: 0.5,
        iconTheme: IconThemeData(color: fgColor),
        actionsIconTheme: IconThemeData(color: fgColor),
      );
    case ZdsTabBarColor.basic:
      final fgColor = zetaColors.textDefault;
      final bgColor = zetaColors.surfaceTertiary;
      return AppBarTheme(
        systemOverlayStyle: computeSystemOverlayStyle(bgColor),
        backgroundColor: bgColor,
        foregroundColor: fgColor,
        centerTitle: false,
        titleSpacing: 0,
        elevation: 0.5,
        iconTheme: IconThemeData(color: fgColor),
        actionsIconTheme: IconThemeData(color: fgColor),
      );
    case ZdsTabBarColor.surface:
      final fgColor = zetaColors.textDefault;
      final bgColor = zetaColors.surfacePrimary;
      return AppBarTheme(
        systemOverlayStyle: computeSystemOverlayStyle(bgColor),
        backgroundColor: bgColor,
        foregroundColor: fgColor,
        centerTitle: false,
        titleSpacing: 0,
        elevation: 0.5,
        iconTheme: IconThemeData(color: fgColor),
        actionsIconTheme: IconThemeData(color: fgColor),
      );
  }
}