[如何避免由于使用flutter在android中删除应用程序栏和状态栏而引起空白?

问题描述 投票:0回答:2

我是不熟悉Flutter的人,我在运行代码时创建了一个没有应用栏和状态栏的屏幕,它的底部显示了空白。如果我尝试使用screenheight将其分为两部分,那么我的第二个容器就会出现ovrflowing。

但是该代码在iPhone屏幕上运行正常,

注意:我已从脚手架中删除了应用程序栏,并在main.dart中删除了通知栏

返回脚手架(// appBar:AppBar(title:Text('Screen Height')),正文:列(儿童:[展开(子代:容器(颜色:Colors.white),),展开(子代:容器(颜色:Colors.red),)],));

enter image description here

android flutter toolbar statusbar appbar
2个回答
0
投票

main方法获得全屏应用程序:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SystemChrome.setEnabledSystemUIOverlays([]);
  runApp(MyApp());
}

0
投票

要添加到@LoVe的答案中,您可能还想将extendBody:trueextendBodyBehindAppBar: true添加到支架中。

© www.soinside.com 2019 - 2024. All rights reserved.