Flutter 투명 상태 표시 줄 및 글꼴 색상 설정 방법

주:바탕색 투명 이 안 드 로 이 드 버 전과 관련 이 있 는 지,버 전이 너무 낮 으 면 설정 이 잘못 되 었 습 니 다.
1.main.dart 에 설정

void main(){
 runApp(new MyApp());
 if (Platform.isAndroid) {
 //  Android        
 SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
 	statusBarColor: Colors.transparent, //      
 	statusBarIconBrightness: Brightness.light 
 	//light:     dark:     
 	//     statusBarIconBrightness     
 );
 SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
 }
}
2.단일 페이지 설정

appBar: AppBar(
		  title: new Text(''),
	  elevation: 0,
	  brightness: Brightness.dark, //       
	  ),
주:AppBar 를 설정 한 후 build 에 이 코드 를 단독으로 설정 하면 SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light)이 실 효 됩 니 다.
ps:Flutter 수정 상태 표시 줄 색상 및 글꼴 색상
Flutter 몰입 식 상태 표시 줄

void main() {
 runApp(MyApp());
 if (Platform.isAndroid) {
 //        android         。        ,         set  ,     ,      MaterialApp         。
 SystemUiOverlayStyle systemUiOverlayStyle =
  SystemUiOverlayStyle(statusBarColor: Colors.transparent);
 SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
 }
}
Flutter 상태 표시 줄 글꼴 색상 수정
Annotated Region 패키지 Scaffold 를 사용 하면 상태 표시 줄 색상 을 변경 할 수 있 습 니 다.dark 와 light 두 가지 가 있 습 니 다.

@override
 Widget build(BuildContext context) {

 return AnnotatedRegion<SystemUiOverlayStyle>(
  value: SystemUiOverlayStyle.light,
  child: Material(child:Scaffold(),),);
 }
여기 서 Flutter 투명 상태 표시 줄 및 글꼴 색상 에 관 한 글 을 소개 합 니 다.더 많은 Flutter 상태 표시 줄 글꼴 색상 내용 은 이전 글 을 검색 하거나 아래 글 을 계속 읽 어 주시 기 바 랍 니 다.앞으로 도 많은 응원 부탁드립니다!

좋은 웹페이지 즐겨찾기