ios - Flutter 使用 themeData Brightness 设置苹果状态栏颜色
问题描述
我是新手,想将我的苹果状态栏设置为深色主题(文本为白色)。在我的主文件中,我导入了一个带有主题的单独文件。这就是我现在在 theme.dart 中得到的:
AppThemeData _theme = AppThemeData(
theme: ThemeData(
brightness: Brightness.dark, //This gives the error "Unhandled Exception: Bad state: No element"
cardTheme: CardTheme(
elevation: 1,
),
primarySwatch: Colors.green,
backgroundColor: Colors.grey[400],
visualDensity: VisualDensity.adaptivePlatformDensity,
),
mainScreenBackgroundGradientColors: [Colors.green[700], Colors.green[300]],
chartThemeData: ChartThemeData(
lineColor: Colors.yellow[600],
lineAreaColor: Colors.yellow[100],
loadingColor: Colors.yellow,
),
deviceChipColor: Colors.green[300],
infoIconColor: Colors.grey[600]);
我遇到了这个评论 并尝试过,但这没有用,因为上下文不存在。
感谢所有帮助。
解决方案
这最终对我有用:
ThemeData(
appBarTheme: AppBarTheme(brightness: Brightness.dark),
),
推荐阅读
- c# - 不明白为什么尝试在 MVC 中填写表格时出现空异常
- sql - 如何在顶部选择中标记未选择的记录
- excel - Excel 根据另一个工作表中的单元格值获取行
- python - 多处理/ psycopg2 TypeError:无法腌制_thread.RLock对象
- artifactory - 跨阶段聚合 Artifactory buildInfo 并上传环境变量
- python-3.x - 来自特定数据库的 Chatterbot 响应
- sharepoint - 通过 SharePoint Designer 2013 工作流发送电子邮件
- php - 一般支付网关集成问题
- javascript - React Native Navigation:未定义不是函数
- java - IntelliJ Jar 错误:Manifest 主要属性的签名文件摘要无效