Flutter 移除AppBar,但保持状态栏处于抖动状态
如何在没有AppBar的情况下为状态栏定制颜色 要自定义状态栏颜色,我使用以下代码:Flutter 移除AppBar,但保持状态栏处于抖动状态,flutter,flutter-layout,Flutter,Flutter Layout,如何在没有AppBar的情况下为状态栏定制颜色 要自定义状态栏颜色,我使用以下代码: appBar:appBar( 背景颜色:Colors.teal ) 如果删除appbar,则无法自定义状态栏。我怎么能做到 如何删除AppBar但保留状态栏?在runApp方法之后,将其添加到main.dart的主方法文件中 SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle(statusBarColor: <YOUR S
appBar:appBar(
背景颜色:Colors.teal
)
如果删除appbar
,则无法自定义状态栏。我怎么能做到
如何删除AppBar但保留状态栏?在
runApp
方法之后,将其添加到main.dart
的主方法文件中
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: <YOUR STATUS BAR COLOR>));
SystemChrome.setSystemTimeOverlayStyle(
SystemUIOverlyStyle(statusBarColor:);
像这样:
void main(){
runApp(MyApp());
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: <YOUR STATUS BAR COLOR>));
}
void main(){
runApp(MyApp());
SystemChrome.SetSystemTimeOverlayStyle(
SystemUIOverlyStyle(statusBarColor:);
}
如果您使用的是SafeArea
,则需要将其top
属性设置为false
,您也可以使用该属性
@override
Widget build(BuildContext context) {
return Container(
color: Your Color Here,
child: SafeArea(
bottom: false,
child: Scaffold(
),
),
);
}
您可以使用以下代码更改状态栏的颜色。您必须首先导入下面给出的此软件包 “
import”包:flatter/services.dart';
然后将此代码添加到main.dart文件中
void main(){SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor:Colors.blue,));}
好的,谢谢你的确认。在我的情况下,它不起作用,所以我补充说。