当我在模拟器上 运行 时,我的 Flutter 应用程序底部出现空白

Whitespace in bottom of my Flutter App when I run on emulator

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

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

resizeToAvoidBottomInset: false

看起来白色 space 来自您的设备导航栏。

尝试设置 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