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,
    ));
相关推荐
一起养小猫1 天前
Flutter for OpenHarmony 进阶:体育计分系统与数据持久化深度解析
flutter·harmonyos
ujainu1 天前
Flutter + OpenHarmony 游戏开发进阶:主菜单架构与历史最高分持久化
flutter·游戏·架构·openharmony
铅笔侠_小龙虾1 天前
Flutter Demo
开发语言·javascript·flutter
2501_944525541 天前
Flutter for OpenHarmony 个人理财管理App实战 - 账户详情页面
android·java·开发语言·前端·javascript·flutter
2601_949857431 天前
Flutter for OpenHarmony Web开发助手App实战:快捷键参考
前端·flutter
mocoding1 天前
flutter通信小能手pigeon三方库已完成鸿蒙化适配
flutter·华为·harmonyos
一起养小猫1 天前
Flutter for OpenHarmony 实战:2048游戏完整开发指南
flutter·游戏·harmonyos
血色橄榄枝2 天前
13-14 底部选项卡 flutter on openHarmony
flutter·开源·鸿蒙
一起养小猫2 天前
Flutter for OpenHarmony 实战:排球计分系统完整开发指南
flutter·harmonyos
一起养小猫2 天前
Flutter for OpenHarmony 实战:推箱子游戏完整开发指南
flutter·游戏·harmonyos