buildAppBarTheme method

  1. @Deprecated('Use ZdsAppBar.buildTheme() instead.')
AppBarTheme buildAppBarTheme(
  1. ZdsTabBarColor color
)

Builds theme variants for ZdsAppBar.

See also

Implementation

@Deprecated('Use ZdsAppBar.buildTheme() instead.')
AppBarTheme buildAppBarTheme(ZdsTabBarColor color) {
  final isDarkMode = brightness == Brightness.dark;
  switch (color) {
    case ZdsTabBarColor.primary:
    case ZdsTabBarColor.appBar:
      final fgColor = isDarkMode ? colorScheme.cool.shade90 : colorScheme.onPrimary;
      final bgColor = isDarkMode ? colorScheme.cool.shade10 : colorScheme.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 = isDarkMode ? colorScheme.cool.shade90 : colorScheme.cool.shade10;
      final bgColor = isDarkMode ? colorScheme.cool.shade10 : colorScheme.cool.shade90;
      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 = isDarkMode ? colorScheme.cool.shade90 : colorScheme.onSurface;
      final bgColor = isDarkMode ? colorScheme.cool.shade10 : colorScheme.surface;
      return AppBarTheme(
        systemOverlayStyle: computeSystemOverlayStyle(bgColor),
        backgroundColor: bgColor,
        foregroundColor: fgColor,
        centerTitle: false,
        titleSpacing: 0,
        elevation: 0.5,
        iconTheme: IconThemeData(color: fgColor),
        actionsIconTheme: IconThemeData(color: fgColor),
      );
  }
}