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,
    ));
相关推荐
好的佩奇5 小时前
Dart 之扩展方法
android·flutter·dart
好的佩奇7 小时前
蓝牙之经典蓝牙
android·flutter·蓝牙
传奇开心果编程9 小时前
【Flutter踩坑排雷】第19课:路由硬编码坑|字符串路由书写错误,页面跳转失败排查
android·flutter·ios·移动开发·跨平台·ui框架·声明式ui
Nerd(BUG版)1 天前
Flutter学习day5--事件手势与命中测试
学习·flutter
传奇开心果1 天前
【Flutter踩坑排雷】第5课:扩展方法冲突坑|同名扩展引发编译歧义,故障规避手段
android·flutter
雪铃儿2 天前
Flutter 双端热更新新方案:基于 Dart 官方动态模块的 flutter_patcher 1.0.0
flutter·hotfix
好的佩奇3 天前
Dart 之方法、操作符与可调用对象
android·flutter·dart
恋猫de小郭3 天前
Flutter Impeller Vulkan 内存持续上涨,问题没想到是文字阴影
android·前端·flutter
传奇开心果3 天前
【Flutter踩坑排雷】第3课:const 误用坑|const 错误使用引发 UI 异常与性能损耗
android·flutter