之前研究了很久,最后发现只需要在任何使用了AppBar或者SliverAppBar的地方设置brightness属性,具体的代码: AppBar(elevation:0,backgroundColor:Colors.white,title:Text(appTitle,style:TextStyleUtil.titleStyle),brightness:Brightness.light, 这个brightness属性影响状态栏的颜色 内容所属专栏...
二、播放器页面对导航栏状态栏的修改设置 @overrideWidgetbuild(BuildContextcontext){super.build(context);SystemUiOverlayStylevalue;if(Platform.isAndroid){value=SystemUiOverlayStyle(statusBarColor:Colors.transparent,/// 安卓系统状态栏存在底色,所以需要加这个systemNavigationBarColor:Colors.transparent,systemNavigat...
child: Text("FlutterDemo", ), ), ), preferredSize: Size(double.infinity,60)), 4、其他注意事项 SystemUiOverlayStyle在设置时其实有很多系统或者版本的限制 ///The color of top status bar.///Only honored in Android version M and greater.finalColor statusBarColor;//设置状态栏颜色,只在Android的...
{ return MaterialApp( title: 'Flutter StatusBar Color Demo', theme: ThemeData( primarySwatch: Colors.blue, brightness: Brightness.light, // 设置为浅色模式 ), home: Scaffold( appBar: AppBar( title: Text('Flutter StatusBar Color Demo'), ), body: Center( child: Text('Hello World!'), ),...
statusBarColor: Colors.transparent, //全局设置透明 statusBarIconBrightness: Brightness.light //light:⿊⾊图标 dark:⽩⾊图标 //在此处设置statusBarIconBrightness为全局设置 );SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);} } 2.单页⾯设置 appBar: AppBar(title: new Text(''),elev...
//设置暗色调状态栏图标SystemUiOverlayStyle systemUiOverlayStyle=SystemUiOverlayStyle(statusBarColor:Colors.transparent,// 状态栏颜色为透明statusBarIconBrightness:Brightness.dark,// 状态栏图标为暗色调statusBarBrightness:Brightness.dark);// 状态栏为暗色调SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle...
statusBarColor: Colors.transparent,//全局设置透明statusBarIconBrightness: Brightness.light//light:黑色图标 dark:白色图标//在此处设置statusBarIconBrightness为全局设置); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } } AI代码助手复制代码 ...
Colors.white,appBar:PreferredSize(//ios下更改状态栏颜色//判断是是否是android,是android需去掉AppBar,否则无AnnotatedRegion无效child:Theme.of(context).platform==TargetPlatform.android?Container():AppBar(backgroundColor:Colors.white,elevation:0),preferredSize:Size.fromHeight(0),),body:Text('hello world'...
As we have a white background appbar, the status bar doesn't appear. It randomly changes between black and white. fllutter doctor -v [✓] Flutter (Channel beta, v0.2.8, on Mac OS X 10.13.4 17E199, locale en-IN) • Flutter version 0.2.8 at ...
window.statusBarColor= 0} }} 注意:flutter项目默认是使用Kotlin语言 Kotlin 是一种在 Java 虚拟机上运行的静态类型编程语言,被称之为 Android 世界的Swift,由 JetBrains 设计开发并开源。 Kotlin 可以编译成Java字节码,也可以编译成 JavaScript,方便在没有 JVM 的设备上运行。