简体   繁体   English

如何更改 Flutter 中的系统导航栏颜色

[英]How to change System Navigation Bar color in Flutter

I want to change the colour of the system navigation bar but I can't.我想更改系统导航栏的颜色,但我不能。

I got this:我懂了:

 import 'package:flutter/services.dart'
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light);

but it didn't work for me...但这对我不起作用...

I used the code below to change the status bar colour it worked.我使用下面的代码来更改它工作的状态栏颜色。

import 'package:flutter/services.dart'
systemOverlayStyle: SystemUiOverlayStyle(statusBarColor: Colors.white),

In your MaterialApp, you should change the primaryColor:在您的 MaterialApp 中,您应该更改主要颜色:

MaterialApp(
  theme: ThemeData(primaryColor: Colors.grey,),
  home: AppHome(),
),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM