Flutter 颤振中的状态栏颜色无法控制
我曾尝试使用SystemUIOverlyStyle更改我的应用程序的状态栏颜色,但它没有改变任何东西。我也尝试过使用库和AnnotatedAgion小部件,但它是无法控制的Flutter 颤振中的状态栏颜色无法控制,flutter,flutter-layout,statusbar,uistatusbar,android-statusbar,Flutter,Flutter Layout,Statusbar,Uistatusbar,Android Statusbar,我曾尝试使用SystemUIOverlyStyle更改我的应用程序的状态栏颜色,但它没有改变任何东西。我也尝试过使用库和AnnotatedAgion小部件,但它是无法控制的 @override Widget build(BuildContext context) { final themeColor = Provider.of<ThemeNotifier>(context); final direction = Provider.of<Direction&g
@override
Widget build(BuildContext context) {
final themeColor = Provider.of<ThemeNotifier>(context);
final direction = Provider.of<Direction>(context).getAppDirection();
// FlutterStatusbarcolor.setStatusBarColor(Colors.transparent);
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.blue,
systemNavigationBarIconBrightness: Brightness.dark,
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.dark));
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: SafeArea(
child: Directionality(
textDirection: direction,
child: WillPopScope(
// ignore: missing_return
onWillPop: () {
Nav.routeReplacement(context, SignUpPage());
},
child: Scaffold(
resizeToAvoidBottomInset: false,
// backgroundColor: Colors.white,
appBar: AppBar(
leading: Container(
width: 32,
padding: const EdgeInsets.only(top: 8.0),
child: IconButton(
icon: Icon(
Icons.chevron_left,
color: themeColor.getColor(),
size: 32,
),
onPressed: () {
Navigator.pop(context);
// Navigator.pushAndRemoveUntil(
// context,
// MaterialPageRoute(builder: (context) => InitPage('')),
// (route) => false);
},
),
),
backgroundColor: Color.fromARGB(255, 252, 252, 252),
elevation: 0,
centerTitle: true,
title: Text(
"Nitrogen",
style: GoogleFonts.poppins(
fontSize: 26,
color: themeColor.getColor(),
fontWeight: FontWeight.w600,
),
),
),
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
AuthHeader(
translate('login_page.login'),
translate('login_page.existing'),
),
LoginForm(),
SizedBox(
height: 20,
),
routeLoginWidget(themeColor, context, direction),
],
),
),
),
),
),
),
);
}
@覆盖
小部件构建(构建上下文){
最终主题颜色=Provider.of(上下文);
final direction=Provider.of(context.getAppDirection();
//设置StatusBarColor(颜色.透明);
//SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor:Colors.blue,
系统导航Baricon亮度:亮度。暗,
Status Baricon亮度:亮度。暗,
状态(正确性:亮度。黑暗));
德雷吉翁酒店(
值:SystemUIOverlyStyle.light,
儿童:安全区(
孩子:方向性(
text方向:方向,
孩子:Willposcope(
//忽略:缺少返回
onWillPop:(){
导航路由替换(上下文,SignUpPage());
},
孩子:脚手架(
resizeToAvoidBottomInset:false,
//背景颜色:Colors.white,
appBar:appBar(
领先:集装箱(
宽度:32,
填充:仅限常量边集(顶部:8.0),
孩子:我的钮扣(
图标:图标(
Icons.chevron_左,
颜色:themeColor.getColor(),
尺码:32,
),
已按下:(){
Navigator.pop(上下文);
//Navigator.pushandremove直到(
//背景,
//MaterialPage路由(生成器:(上下文)=>InitPage(“”)),
//(路由)=>错误);
},
),
),
背景颜色:颜色。来自argb(255,252,252,252),
海拔:0,
标题:对,
标题:正文(
“氮”,
风格:GoogleFonts.poppins(
尺寸:26,
颜色:themeColor.getColor(),
fontWeight:fontWeight.w600,
),
),
),
正文:SingleChildScrollView(
子:列(
mainAxisAlignment:mainAxisAlignment.spaceAround,
儿童:[
AuthHeader(
翻译('login_page.login'),
翻译('login_page.existing'),
),
LoginForm(),
大小盒子(
身高:20,
),
routeLoginWidget(颜色、上下文、方向),
],
),
),
),
),
),
),
);
}
我认为appbar可能导致了这个问题,但是在改变了它的颜色或者完全移除它之后,并没有解决任何问题
有时它会闪烁到我正在设置的颜色,然后变为完全白色或带有白色图标的黑色背景
有人能告诉我我做错了什么吗?您在哪个版本的Android上运行应用程序?只有一个ui 1的Android 9