Skip to content

Commit

Permalink
Pass brightness to _createAppBarTheme() (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpnurmi committed Mar 9, 2023
1 parent 37bcf5f commit 4fae739
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions lib/src/themes/common_themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,29 @@ const kDividerColorLight = Color(0xffdcdcdc);

// AppBar

AppBarTheme _createLightAppBar(ColorScheme colorScheme) {
AppBarTheme _createAppBarTheme(ColorScheme colorScheme, Brightness brightness) {
return AppBarTheme(
shape: Border(
bottom: BorderSide(color: colorScheme.onSurface.withOpacity(0.2)),
bottom: BorderSide(
color: colorScheme.onSurface
.withOpacity(brightness == Brightness.light ? 0.2 : 0.07),
),
),
scrolledUnderElevation: kAppBarElevation,
surfaceTintColor: colorScheme.surface,
toolbarHeight: kAppBarHeight,
elevation: kAppBarElevation,
systemOverlayStyle: SystemUiOverlayStyle.light,
systemOverlayStyle: brightness == Brightness.light
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
backgroundColor: colorScheme.surface,
foregroundColor: colorScheme.onSurface,
titleTextStyle: createTextTheme(YaruColors.inkstone).titleLarge!.copyWith(
titleTextStyle: createTextTheme(colorScheme.onSurface).titleLarge!.copyWith(
color: colorScheme.onSurface,
fontWeight: FontWeight.normal,
),
iconTheme: IconThemeData(color: colorScheme.onSurface),
actionsIconTheme: const IconThemeData(color: YaruColors.inkstone),
);
}

AppBarTheme _createDarkAppBarTheme(ColorScheme colorScheme) {
return AppBarTheme(
shape: Border(
bottom: BorderSide(color: colorScheme.onSurface.withOpacity(0.07)),
),
scrolledUnderElevation: kAppBarElevation,
surfaceTintColor: colorScheme.background,
toolbarHeight: kAppBarHeight,
elevation: kAppBarElevation,
systemOverlayStyle: SystemUiOverlayStyle.dark,
backgroundColor: colorScheme.surface,
foregroundColor: colorScheme.onSurface,
titleTextStyle: createTextTheme(YaruColors.porcelain).titleLarge!.copyWith(
color: colorScheme.onSurface,
fontWeight: FontWeight.normal,
),
actionsIconTheme: IconThemeData(color: colorScheme.onSurface),
);
}

Expand Down Expand Up @@ -447,7 +433,7 @@ ThemeData createYaruLightTheme({
checkboxTheme: _getCheckBoxThemeData(colorScheme, Brightness.light),
radioTheme: _getRadioThemeData(colorScheme, Brightness.light),
primaryColorDark: null,
appBarTheme: _createLightAppBar(colorScheme),
appBarTheme: _createAppBarTheme(colorScheme, Brightness.light),
floatingActionButtonTheme:
_getFloatingActionButtonThemeData(colorScheme, Brightness.light),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
Expand Down Expand Up @@ -559,7 +545,7 @@ ThemeData createYaruDarkTheme({
checkboxTheme: _getCheckBoxThemeData(colorScheme, Brightness.dark),
radioTheme: _getRadioThemeData(colorScheme, Brightness.dark),
primaryColorDark: primaryColor,
appBarTheme: _createDarkAppBarTheme(colorScheme),
appBarTheme: _createAppBarTheme(colorScheme, Brightness.dark),
floatingActionButtonTheme:
_getFloatingActionButtonThemeData(colorScheme, Brightness.dark),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
Expand Down

0 comments on commit 4fae739

Please sign in to comment.