Brightness is no longer used by flutter 2.5

This commit is contained in:
Ming Ming 2021-09-15 18:39:43 +08:00
parent 06023228b8
commit bc9b2a4c78
4 changed files with 11 additions and 48 deletions

View file

@ -27,23 +27,13 @@ class AppTheme extends StatelessWidget {
final theme = Theme.of(context); final theme = Theme.of(context);
if (theme.brightness == Brightness.light) { if (theme.brightness == Brightness.light) {
return theme.appBarTheme.copyWith( return theme.appBarTheme.copyWith(
brightness: Brightness.dark, backgroundColor: Colors.grey[800],
color: Colors.grey[800], foregroundColor: Colors.white.withOpacity(.87),
actionsIconTheme: theme.primaryIconTheme
.copyWith(color: Colors.white.withOpacity(.87)),
iconTheme: theme.primaryIconTheme
.copyWith(color: Colors.white.withOpacity(.87)),
textTheme: theme.primaryTextTheme
.apply(bodyColor: Colors.white.withOpacity(.87)),
); );
} else { } else {
return theme.appBarTheme.copyWith( return theme.appBarTheme.copyWith(
brightness: Brightness.dark, backgroundColor: Colors.grey[200],
color: Colors.grey[200], foregroundColor: Colors.black87,
actionsIconTheme:
theme.primaryIconTheme.copyWith(color: Colors.black87),
iconTheme: theme.primaryIconTheme.copyWith(color: Colors.black87),
textTheme: theme.primaryTextTheme.apply(bodyColor: Colors.black87),
); );
} }
} }
@ -98,11 +88,8 @@ class AppTheme extends StatelessWidget {
static ThemeData _buildLightThemeData(BuildContext context, ThemeData theme) { static ThemeData _buildLightThemeData(BuildContext context, ThemeData theme) {
final appBarTheme = theme.appBarTheme.copyWith( final appBarTheme = theme.appBarTheme.copyWith(
brightness: Brightness.dark, backgroundColor: theme.scaffoldBackgroundColor,
color: theme.scaffoldBackgroundColor, foregroundColor: theme.colorScheme.onSurface,
actionsIconTheme: theme.primaryIconTheme.copyWith(color: Colors.black87),
iconTheme: theme.primaryIconTheme.copyWith(color: Colors.black87),
textTheme: theme.primaryTextTheme.apply(bodyColor: Colors.black87),
); );
return theme.copyWith(appBarTheme: appBarTheme); return theme.copyWith(appBarTheme: appBarTheme);
} }
@ -121,14 +108,8 @@ class AppTheme extends StatelessWidget {
} }
final appBarTheme = theme.appBarTheme.copyWith( final appBarTheme = theme.appBarTheme.copyWith(
brightness: Brightness.dark, backgroundColor: background,
color: background, foregroundColor: theme.colorScheme.onSurface,
actionsIconTheme:
theme.primaryIconTheme.copyWith(color: Colors.white.withOpacity(.87)),
iconTheme:
theme.primaryIconTheme.copyWith(color: Colors.white.withOpacity(.87)),
textTheme: theme.primaryTextTheme
.apply(bodyColor: Colors.white.withOpacity(.87)),
); );
final bottomNavigationBarTheme = theme.bottomNavigationBarTheme.copyWith( final bottomNavigationBarTheme = theme.bottomNavigationBarTheme.copyWith(
backgroundColor: background, backgroundColor: background,

View file

@ -152,13 +152,7 @@ class _SlideshowViewerState extends State<SlideshowViewer>
AppBar( AppBar(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
brightness: Brightness.dark, foregroundColor: Colors.white.withOpacity(.87),
iconTheme: Theme.of(context).iconTheme.copyWith(
color: Colors.white.withOpacity(.87),
),
actionsIconTheme: Theme.of(context).iconTheme.copyWith(
color: Colors.white.withOpacity(.87),
),
leading: IconButton( leading: IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
tooltip: MaterialLocalizations.of(context).closeButtonTooltip, tooltip: MaterialLocalizations.of(context).closeButtonTooltip,

View file

@ -120,13 +120,7 @@ class _TrashbinViewerState extends State<TrashbinViewer> {
AppBar( AppBar(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
brightness: Brightness.dark, foregroundColor: Colors.white.withOpacity(.87),
iconTheme: Theme.of(context).iconTheme.copyWith(
color: Colors.white.withOpacity(.87),
),
actionsIconTheme: Theme.of(context).iconTheme.copyWith(
color: Colors.white.withOpacity(.87),
),
actions: [ actions: [
IconButton( IconButton(
icon: const Icon(Icons.restore_outlined), icon: const Icon(Icons.restore_outlined),

View file

@ -156,13 +156,7 @@ class _ViewerState extends State<Viewer>
AppBar( AppBar(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
shadowColor: Colors.transparent, shadowColor: Colors.transparent,
brightness: Brightness.dark, foregroundColor: Colors.white.withOpacity(.87),
iconTheme: Theme.of(context).iconTheme.copyWith(
color: Colors.white.withOpacity(.87),
),
actionsIconTheme: Theme.of(context).iconTheme.copyWith(
color: Colors.white.withOpacity(.87),
),
actions: [ actions: [
if (!_isDetailPaneActive && _canOpenDetailPane()) if (!_isDetailPaneActive && _canOpenDetailPane())
IconButton( IconButton(