flutter 设置全屏 和隐藏状态栏和导航栏

设置全面屏

使用 SafeArea 将页面套起来 top bottom 都设置为true

Dart 复制代码
SafeArea(
    top: false,
    bottom: false,
    child: Container(
       child: _body(),
    ),
),

隐藏状态栏和导航栏

复制代码
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);

overlays 中可以填需要展示的 如 填了SystemUiOverlay.bottom 就是需要展示 底部

SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [

复制代码
SystemUiOverlay.bottom

]
);

设置状态栏为透明

Dart 复制代码
  var brightness =
        !kIsWeb && Platform.isAndroid ? Brightness.dark : Brightness.light;
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarBrightness: brightness,
      statusBarIconBrightness: brightness,
    ));
相关推荐
余很多之很多8 小时前
flutter下的webview适配rem问题
flutter
恋猫de小郭17 小时前
Flutter Web 的发展历程:Dart、Flutter 与 WasmGC
android·前端·flutter
陈柒吖18 小时前
Flutter Realm 教程
前端·flutter
YueYaTech18 小时前
【Flutter 必备插件】HTTP 封装 dio
flutter·http
张风捷特烈1 天前
Flutter 百题斩#15 | 列出 SDK 所有 StatelesWidget 组件
android·flutter
人生游戏牛马NPC1号1 天前
学习 Flutter (三):玩安卓项目实战 - 上
android·学习·flutter
断剑重铸之日2 天前
Flutter 滑动面板组件(修复版)
flutter·性能优化
钟智强2 天前
Flutter 前端开发中的常见问题全面解析
android·前端·flutter·ios·前端框架·dart
MaoJiu2 天前
Flutter中的CustomSingleChildLayout: 掌握自定义单子组件布局
flutter