Transparent status bar in flutter

前端 未结 5 1242
时光取名叫无心
时光取名叫无心 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:03

    @sander-dalby-larsen solution works perfectly, however, the status bar icon color becomes an issue. Following solution makes status bar transparent and status bar icons and navigation bar color as black.

    @override
      Widget build(BuildContext context) {
        return MaterialApp(
          home: AnnotatedRegion(
            value: SystemUiOverlayStyle(
              statusBarColor: Colors.transparent, // transparent status bar
              systemNavigationBarColor: Colors.black, // navigation bar color
              statusBarIconBrightness: Brightness.dark, // status bar icons' color
              systemNavigationBarIconBrightness: Brightness.dark, //navigation bar icons' color
            ),
            child: Scaffold(
              body: _getBody(context),
            ),
          ),
        );
      }
    

提交回复
热议问题