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

设置全面屏

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

SafeArea(
    top: false,
    bottom: false,
    child: Container(
       child: _body(),
    ),
),

隐藏状态栏和导航栏

SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);

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

SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [

SystemUiOverlay.bottom

]
);

设置状态栏为透明

  var brightness =
        !kIsWeb && Platform.isAndroid ? Brightness.dark : Brightness.light;
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent,
      statusBarBrightness: brightness,
      statusBarIconBrightness: brightness,
    ));

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-25 13:06:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-25 13:06:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-25 13:06:01       87 阅读
  4. Python语言-面向对象

    2024-04-25 13:06:01       96 阅读

热门阅读

  1. 2024-04-24 游戏开发-区块链游戏-记录

    2024-04-25 13:06:01       38 阅读
  2. go垃圾回收机制

    2024-04-25 13:06:01       34 阅读
  3. SqlServer 查询表、视图、存储过程被哪些引用

    2024-04-25 13:06:01       36 阅读
  4. 上位机工作感想-从C#到Qt的转变-2

    2024-04-25 13:06:01       35 阅读
  5. 算法训练营day22

    2024-04-25 13:06:01       31 阅读
  6. 【二叉树算法题记录】226. 翻转二叉树

    2024-04-25 13:06:01       34 阅读
  7. HOT100与剑指Offer

    2024-04-25 13:06:01       32 阅读