Transparent status bar in flutter

前端 未结 5 1245
时光取名叫无心
时光取名叫无心 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条回答
  •  梦毁少年i
    2021-01-31 11:52

    You can use the AnnotatedRegion widget with SystemUiOverlayStyle to change the chrome styles.

    import 'package:flutter/services.dart';
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return AnnotatedRegion(
          value: SystemUiOverlayStyle(
            statusBarColor: Colors.transparent,
          ),
          child: Scaffold(...),
        );
      }
    }
    

    You can read more about what's possible with SystemUiOverlayStyle here.

提交回复
热议问题