statusBarColor: Colors.transparent, // transparent status bar )); } 方法二:systemOverlayStyle透明状态栏 指定用于与 AppBar 重叠的系统覆盖的样式,如果AppBar与全局设置有重叠覆盖的情况,使用systemOverlayStyle可确保效果完整。 Scaffold( appBar: AppBar( backwardsCompatibility: false, systemOverlayStyle: Syste...
import 'package:flutter/material.dart'; import 'dart:io'; import 'package:flutter/services.dart'; void main(){ runApp(MyApp()); if(Platform.isAndroid){ SystemUiOverlayStyle style = SystemUiOverlayStyle( statusBarColor: Colors.transparent, ///这是设置状态栏的图标和字体的颜色 ///Brightness.l...
一、Flutter 透明状态栏设置 import 'package:flutter/material.dart'; //导入对应的文件 import 'package:flutter/services.dart'; void main() { //配置透明的状态栏 SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemChrome.setSystemUIOverlayStyle...
import'package:flutter/material.dart';//导入对应的文件import 'package:flutter/services.dart'; void main() { //配置透明的状态栏 SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); run...
// 修改状态栏颜色(只能黑和白) SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light); 1. 2. 3. 4. 5. 6. 去掉android顶部状态半透明灰色栏: // 设置为透明 SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(statusBarColor: Colors.transparent)); ...
(// 设置沉浸式状态栏文字颜色statusBarColor:Colors.transparent,// transparent status barsystemNavigationBarColor:Colors.black,// navigation bar colorstatusBarIconBrightness:Brightness.dark,// status bar icons' colorsystemNavigationBarIconBrightness:Brightness.dark,//navigation bar icons' color),child:...
//设置明亮色调状态栏图标SystemUiOverlayStyle systemUiOverlayStyle=SystemUiOverlayStyle(statusBarColor:Colors.transparent,//状态栏颜色为透明statusBarIconBrightness:Brightness.light,// 状态栏图标为明色调statusBarBrightness:Brightness.light);// 状态栏为明色调SystemChrome.setSystemUIOverlayStyle(systemUiOverlaySty...
statusBarColor: Colors.transparent, //全局设置透明 statusBarIconBrightness: Brightness.light //light:⿊⾊图标 dark:⽩⾊图标 //在此处设置statusBarIconBrightness为全局设置 );SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);} } 2.单页⾯设置 appBar: AppBar(title: new Text(''),elev...
statusBarColor: Colors.transparent,//全局设置透明statusBarIconBrightness: Brightness.light//light:黑色图标 dark:白色图标//在此处设置statusBarIconBrightness为全局设置); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } } AI代码助手复制代码 ...
1.import 'package:flutter/services.dart' 2.设置系统覆盖层样式,举个栗子: voidmain()=>runApp(MyApp());classMyAppextendsStatelessWidget{//statusBar设置为透明,去除半透明遮罩finalSystemUiOverlayStyle_style=SystemUiOverlayStyle(statusBarColor:Colors.transparent);@overrideWidgetbuild(BuildContextcontext){//...