Skip to content

Commit

Permalink
fallback to default themes
Browse files Browse the repository at this point in the history
  • Loading branch information
Airyzz committed Jul 18, 2024
1 parent 4d642df commit 4e89777
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tiamat/lib/config/style/theme_you.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:tiamat/config/style/theme_base.dart';
import 'package:tiamat/config/style/theme_common.dart';
import 'package:tiamat/config/style/theme_extensions.dart';
import 'package:tiamat/config/style/theme_light.dart';
import 'package:tiamat/config/style/theme_dark.dart';

class ThemeYou {
static Future<ThemeData> theme(Brightness brightness) async {
Expand All @@ -18,6 +19,15 @@ class ThemeYou {
}
}

// fallback to default themes if device doesnt support dynamic color
if (scheme == null) {
if (brightness == Brightness.dark) {
return ThemeDark.theme;
} else {
return ThemeLight.theme;
}
}

return ThemeBase.theme(scheme!).copyWith(extensions: [
const ThemeSettings(),
ExtraColors.fromScheme(scheme),
Expand Down

0 comments on commit 4e89777

Please sign in to comment.