Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
feat: snackbar theme (#385)
Browse files Browse the repository at this point in the history
Fixes #384
  • Loading branch information
Feichtmeier authored Aug 15, 2023
1 parent 415f45c commit 214e3eb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/src/themes/common_themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,33 @@ DrawerThemeData _createDrawerTheme(ColorScheme colorScheme) {
);
}

SnackBarThemeData _createSnackBarTheme(ColorScheme colorScheme) {
final light = colorScheme.brightness == Brightness.light;
const fg = Colors.white;
return SnackBarThemeData(
backgroundColor: Colors.black.withOpacity(0.8),
closeIconColor: fg,
actionTextColor: Colors.white,
contentTextStyle: const TextStyle(color: fg),
actionBackgroundColor: Colors.transparent,
disabledActionTextColor: fg.withOpacity(0.7),
disabledActionBackgroundColor: Colors.transparent,
behavior: SnackBarBehavior.floating,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
isMobile ? kComfortableButtonHeight : kCompactButtonHeight,
),
side: light
? BorderSide.none
: BorderSide(
color: fg.withOpacity(0.25),
width: 1,
),
),
);
}

/// Helper function to create a new Yaru theme
ThemeData createYaruTheme({
required ColorScheme colorScheme,
Expand Down Expand Up @@ -701,6 +728,7 @@ ThemeData createYaruTheme({
listTileTheme: ListTileThemeData(
iconColor: colorScheme.onSurface.withOpacity(0.8),
),
snackBarTheme: _createSnackBarTheme(colorScheme),
);
}

Expand Down

0 comments on commit 214e3eb

Please sign in to comment.