InfoBarThemeData.standard constructor

InfoBarThemeData.standard(
  1. ThemeData style
)

Implementation

factory InfoBarThemeData.standard(ThemeData style) {
  final isDark = style.brightness == Brightness.dark;
  return InfoBarThemeData(
    padding: EdgeInsets.all(10),
    color: (severity) {
      switch (severity) {
        case InfoBarSeverity.info:
          return style.navigationPanelBackgroundColor;
        case InfoBarSeverity.warning:
          return isDark ? Color(0xFF433519) : Colors.warningSecondaryColor;
        case InfoBarSeverity.success:
          return isDark ? Color(0xFF393d1b) : Colors.successSecondaryColor;
        case InfoBarSeverity.error:
          return isDark ? Color(0xFF442726) : Colors.errorSecondaryColor;
      }
    },
    closeIcon: Icons.close,
    icon: (severity) {
      switch (severity) {
        case InfoBarSeverity.info:
          return Icons.info_outlined;
        case InfoBarSeverity.warning:
          return Icons.error_outline;
        case InfoBarSeverity.success:
          return Icons.check_circle_outlined;
        case InfoBarSeverity.error:
          return Icons.cancel_outlined;
      }
    },
    iconColor: (severity) {
      switch (severity) {
        case InfoBarSeverity.info:
          return isDark ? Colors.grey[120] : Colors.grey[160];
        case InfoBarSeverity.warning:
          return isDark ? Colors.yellow : Colors.warningPrimaryColor;
        case InfoBarSeverity.success:
          return Colors.successPrimaryColor;
        case InfoBarSeverity.error:
          return isDark ? Colors.red : Colors.errorPrimaryColor;
      }
    },
    actionStyle: ButtonThemeData.standard(style).copyWith(ButtonThemeData(
      margin: EdgeInsets.zero,
      padding: EdgeInsets.all(6),
    )),
  );
}