How to make device top panel (status bar) have the same background color as AppBar in flutter?

后端 未结 2 1910
北荒
北荒 2021-01-03 05:52

How to make device top panel (status bar) have the same background color as AppBar in flutter? The color of the device top panel is always darker than the AppBar backgroundC

2条回答
  •  -上瘾入骨i
    2021-01-03 06:39

    Here is a flutter specific solution. In the build method, you can use the flutter service package.

    import 'package:flutter/services.dart';
    Widget build(BuildContext context) {
        SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
          statusBarColor: Colors.transparent, //top bar color
          statusBarIconBrightness: Brightness.dark, //top bar icons
          systemNavigationBarColor: Colors.white, //bottom bar color
          systemNavigationBarIconBrightness: Brightness.dark, //bottom bar icons
        ));
    
    //....
    }
    

提交回复
热议问题