【问题标题】:Whitespace in bottom of my Flutter App when I run on emulator当我在模拟器上运行时,我的 Flutter 应用程序底部有空格
【发布时间】:2022-01-12 16:55:15
【问题描述】:

当我使用智能手机模拟器启动我的应用程序时,底部会出现一个空白:

我试图在我的 Scaffold 中添加这一行,但似乎不起作用:

resizeToAvoidBottomInset: false

【问题讨论】:

    标签: flutter dart mobile responsive-design scaffold


    【解决方案1】:

    看起来空白区域来自您的设备导航栏。

    尝试设置SystemChrome.setEnabledSystemUIMode()手动设置你想要的ui覆盖。

    Future<void> main() async {
      WidgetsFlutterBinding.ensureInitialized();
    
      SystemChrome.setEnabledSystemUIMode(
        SystemUiMode.manual,
        overlays: [SystemUiOverlay.top],
      );
    
      runApp(AppWidget());
    }
    

    或者将overlays: [],设置为全屏

    文档:https://api.flutter.dev/flutter/services/SystemChrome/setEnabledSystemUIMode.html

    【讨论】:

    • 谢谢,叠加层:[] 对我很有效,叠加层:[SystemUiOverlay.top] 提供另一种空白
    猜你喜欢
    • 1970-01-01
    • 2021-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多