mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
Update Theme Setup (#2300)
* refactor(theme-setup-update): Move didChangePlatformBrightness lifecycle method to Root widget instead of AppState. We already have an active WidgetsBindingObserver in Root widget. * fix(theme): Add workaround for flutter iOS didChangePlatformBrightness issue causing unneeded rebuilds.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/core/totp_request_details.dart';
|
||||
@@ -159,6 +160,18 @@ class RootState extends State<Root> with WidgetsBindingObserver {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangePlatformBrightness() {
|
||||
if (widget.appStore.themeStore.themeMode == ThemeMode.system) {
|
||||
Future.delayed(Duration(milliseconds: Platform.isIOS ? 500 : 0), () {
|
||||
final systemTheme = widget.appStore.themeStore.getThemeFromSystem();
|
||||
if (widget.appStore.themeStore.currentTheme != systemTheme) {
|
||||
widget.appStore.themeStore.setTheme(systemTheme);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// this only happens when the app has been in the background for some time
|
||||
|
||||
Reference in New Issue
Block a user