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 小时前
Fluter InteractiveViewer 与ScrollView滑动冲突问题解决
flutter
叽哥15 小时前
Flutter Riverpod上手指南
android·flutter·ios
BG1 天前
Flutter 简仿Excel表格组件介绍
flutter
zhangmeng1 天前
FlutterBoost在iOS26真机运行崩溃问题
flutter·app·swift
恋猫de小郭1 天前
对于普通程序员来说 AI 是什么?AI 究竟用的是什么?
前端·flutter·ai编程
卡尔特斯1 天前
Flutter A GlobalKey was used multipletimes inside one widget'schild list.The ...
flutter
w_y_fan2 天前
Flutter 滚动组件总结
前端·flutter
醉过才知酒浓2 天前
Flutter Getx 的页面传参
flutter
火柴就是我3 天前
flutter 之真手势冲突处理
android·flutter
Speed1233 天前
`mockito` 的核心“打桩”规则
flutter·dart