【问题标题】:How to show status bar on top of the app?如何在应用程序顶部显示状态栏?
【发布时间】:2019-07-04 11:20:09
【问题描述】:

在 ios 中,我想在安全区域的应用顶部显示网络、Wifi、电池。我尝试在顶部添加一个安全区域,但它所做的只是在顶部添加一个白色补丁。

return new SafeArea(
  top: true,
    bottom: false,

    child: WillPopScope(
  onWillPop: _onWillPop,
  child: new Scaffold(
    backgroundColor: Colors.transparent,
    primary: false,
    appBar: null,
    resizeToAvoidBottomPadding: false,
    body: new Padding(
      padding: new EdgeInsets.all(0.0),
      child: body,
    ),
  ),
),
);

【问题讨论】:

  • 请指定一些代码

标签: ios flutter


【解决方案1】:

您的代码运行良好,图标在那里。但是你需要改变状态栏的主题

ma​​in.dart

你需要添加

Future main() async {
   SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
      statusBarColor: Colors.white, // Color for Android
    //  statusBarBrightness: Brightness.dark // Dark == white status bar -- for IOS.
      statusBarBrightness: Brightness.light // light == black status bar -- for IOS.
  ));
  runApp(new MyApp());
}

【讨论】:

  • 我在另一个文件中有另一个 SystemChrome,这导致了一些问题。无论如何谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-09-15
  • 2016-04-21
  • 2011-01-30
  • 2013-08-13
  • 1970-01-01
  • 2017-09-16
  • 2022-01-09
相关资源
最近更新 更多