import 'package:flutter/services.dart'; SystemChrome.setSystemUIOverlayStyle( SystemUiOverlayStyle( statusBarColor: Colors.blue, // 设置状态栏颜色 statusBarBrightness: Brightness.dark, // 设置状态栏文字颜色为深色 ), ); 在上述代码中,我们使用 SystemChrome.setSystemUIOverlayStyle 方法来设置状态栏样式。
复制 //设置明亮色调状态栏图标SystemUiOverlayStyle systemUiOverlayStyle=SystemUiOverlayStyle(statusBarColor:Colors.transparent,//状态栏颜色为透明statusBarIconBrightness:Brightness.light,// 状态栏图标为明色调statusBarBrightness:Brightness.light);// 状态栏为明色调SystemChrome.setSystemUIOverlayStyle(systemUiOver...
( statusBarColor: Colors.blue, // 设置状态栏颜色 statusBarIconBrightness: Brightness.dark, // 设置状态栏图标亮度 )); return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(), ); } } class MyHomePage extends StatelessWidget { @override ...
useMaterial3:true,//状态栏字体颜色appBarTheme:constAppBarTheme(systemOverlayStyle:SystemUiOverlayStyle(statusBarColor:Colors.transparent,statusBarIconBrightness:Brightness.light,),),),home:constMyHomePage(title:'Flutter Demo Home Page'),);}}
在android api 30之上设置style,flutter里面设置SystemChrome什么的都不管用,必须如下 window.statusBarColor =Color.TRANSPARENTif(Build.VERSION.SDK_INT >=Build.VERSION_CODES.R) { window.insetsController?.setSystemBarsAppearance( WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, ...
(statusBarColor:Colors.transparent,/// 安卓系统状态栏存在底色,所以需要加这个systemNavigationBarColor:Colors.transparent,systemNavigationBarIconBrightness:Brightness.light,statusBarIconBrightness:Brightness.light,/// 状态栏字体颜色statusBarBrightness:Brightness.light,);}else{///iOS设置状态栏的正确姿势value=...
voidmain(){runApp(MyApp());SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light.copyWith(statusBarColor:Colors.transparent,//这里替换你选择的颜色),);} 你可以通过以下方法创造Matrial风格颜色 ///创建Material风格的colorstaticMaterialColorcreateMaterialColor(Color color){List strengths=<double>[...
1voidmain() {2runApp(MyApp());3if(Platform.isAndroid) {4//以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。5SystemUiOverlayStyle systemUiOverlayStyle =6SystemUiOverlayStyle(statusBarColor: Colors.transparent...
unselectedLabelColor: widget.unselectedLabelColor, labelStyle: widget.labelStyle, unselectedLabelStyle: widget.unselectedLabelStyle, child: _TabLabelBar( onPerformLayout: _saveTabOffsets, children: wrappedTabs, ), ), ); 1. 2. 3. 4. 5. ...
在需要更改状态栏颜色的页面中,导入flutter_statusbarcolor插件,并调用其方法来更改状态栏颜色。可以使用以下代码示例: 代码语言:txt 复制 import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart'; // 更改状态栏颜色为红色 FlutterStatusbarcolor.setStatusBarColor(Colors.red); 运行Flutter应用程...