I am trying to implement dark mode in my flutter app, but I don't know what am I missing but it doesn't work on iOS. I manage to run it on Android just fine, but when I print WidgetsBinding.instance.window.platformBrightness
there is still light, event when dark mode is on.
When I set themeMode: ThemeMode.dark - dark mode is working, problem is with the automatic detection.
Also, when I run new blank project, dark mode worked fine. But in my app, which is builded, it does not work. Even if themeMode
is set to ThemeMode.system
:
themeMode: ThemeMode.system,
theme: ThemeData(
accentColor: darkBlue,
cursorColor: red,
primaryColor: Colors.white,
brightness: Brightness.light,
),
darkTheme: ThemeData(
accentColor: Colors.white,
cursorColor: red,
primaryColor: Colors.white,
brightness: Brightness.dark,
),
Do you have any idea, what could be wrong or do you have any suggestions?
Flutter version: 1.12.13-hotfix.9 and iOS version: iPhone SE simulator - iOS 13.3
Thanks a lot.
I figure it out - just simply removed this entry from info.plist
that I have added before.
<key>UIUserInterfaceStyle</key>
<string>Light</string>