Flutter - How to set status bar color when AppBar not present

后端 未结 17 816
孤城傲影
孤城傲影 2020-12-07 23:56

How to set status bar color when AppBar not present.

I have tried this but not working.

Widget build(BuildContext context) {
    SystemChrome.setSys         


        
17条回答
  •  心在旅途
    2020-12-08 00:39

    I tried many methods but they didn’t work. And i found another method, use safeArea ,AnnotatedRegion and Scaffold

    AnnotatedRegion(
      // status icon and text color, dark:black  light:white
      value: SystemUiOverlayStyle.dark,
      child: Scaffold(
         // statusbar color
         backgroundColor: Colors.white,
         body : SafeArea(****)
      )
    }
    

    The code implements the white status bar and black text

提交回复
热议问题