写了个flutter项目,小米手机夜晚会自动进入暗黑模式,自己的app没有适配暗黑模式,导致显示和UI设计出入很大,想关闭app的暗黑模式,摸索了很久,后来发现原来设置个 brightness 属性为 Brightness.light 就行了!踩个坑,记录一下,希望能帮助遇到问题的其他人
我的完整代码
CupertinoApp(
localizationsDelegates: [
CupertinoLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh', 'CH'),
const Locale('en', 'US')
],
debugShowCheckedModeBanner: true,
navigatorObservers: [navObserver],
theme: CupertinoThemeData(
scaffoldBackgroundColor: Colors.white,
brightness: Brightness.light,
textTheme: CupertinoTextThemeData(textStyle:TextStyle(fontFamily: 'PingFang SC',color: Colors.black)),
),
home: AppIndexPage(),
routes: routerConfigMap(),
)