【问题标题】:Flutter: How can I stop the bottom nav bar from appearing on user tap?Flutter:如何阻止底部导航栏出现在用户点击时?
【发布时间】:2020-08-14 03:01:13
【问题描述】:

我正在制作游戏,我想查看设备顶部 UI(时间、wifi...),但隐藏底部导航栏。下面的代码隐藏了底部导航栏,但只要用户点击屏幕,它就会出现。但是,我希望始终隐藏底部导航栏。感谢您的帮助。

class myApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]);
    return MaterialApp( ...

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    试试这个:

    SystemChrome.setEnabledSystemUIOverlays([])
    

    【讨论】:

    • 这隐藏了我不想要的顶部 UI。我正在使用带有 AppBar 的 SafeArea,我希望用户能够在顶部看到时间和所有其他信息。
    【解决方案2】:

    到目前为止,我发现的唯一解决方法是使用 flutter_statusbar_manager 包并调用

    FlutterStatusbarManager.setFullscreen(true);
    FlutterStatusbarManager.setHidden(false);
    

    但是,在android上,状态栏显示在顶部的黑点上,我猜这是由issue引起的(setFullscreen()正在调用SystemChrome.setEnabledSystemUIOverlays([])),所以我找不到一种修改其颜色的方法。

    【讨论】:

      猜你喜欢
      • 2020-02-07
      • 2021-04-06
      • 2019-11-19
      • 1970-01-01
      • 2020-07-28
      • 2023-02-25
      • 1970-01-01
      • 2020-02-11
      相关资源
      最近更新 更多