Transparent status bar in flutter

前端 未结 5 1240
时光取名叫无心
时光取名叫无心 2021-01-31 11:23

I just started using flutter and android studio and I was wondering if there’s a way to make a transparent status bar like the pic on Android (no transition from the status bar

5条回答
  •  抹茶落季
    2021-01-31 12:00

    You can also do it app widely before you run the app in the main.dart file:

    import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';
    
    void main(){
      WidgetsFlutterBinding.ensureInitialized();
      SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
        statusBarColor: Colors.transparent, // transparent status bar
      ));
      runApp(MyApp());
    }
    
    

提交回复
热议问题