Skip to content

Commit

Permalink
Merge pull request Predidit#615 from ErBWs/fix-android-theme
Browse files Browse the repository at this point in the history
fix android dynamic theme is always in light mode
  • Loading branch information
Predidit authored Jan 16, 2025
2 parents 1ab6a62 + d1dd5da commit 6c41d45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/app_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ class _AppWidgetState extends State<AppWidget>
builder: (theme, darkTheme) {
if (themeProvider.useDynamicColor) {
themeProvider.setTheme(
ThemeData(colorScheme: theme),
ThemeData(colorScheme: theme, brightness: Brightness.light),
oledEnhance
? Utils.oledDarkTheme(ThemeData(colorScheme: darkTheme))
: ThemeData(colorScheme: darkTheme),
? Utils.oledDarkTheme(ThemeData(
colorScheme: darkTheme, brightness: Brightness.dark))
: ThemeData(
colorScheme: darkTheme, brightness: Brightness.dark),
notify: false,
);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/init_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class _InitPageState extends State<InitPage> {
},
);
} else {
// Workaround for dynamic_color. dynamic_color need PlatformChannel to get color, it takes time.
// setDynamic here to avoid white screen flash when themeMode is dark.
themeProvider.setDynamic(
setting.get(SettingBoxKey.useDynamicColor, defaultValue: false));
Modular.to.navigate('/tab/popular/');
Expand Down

0 comments on commit 6c41d45

Please sign in to comment.