Last active
September 17, 2022 14:09
-
-
Save Deali-Axy/ed2f15ba12c8e69a5158c50ec5396c66 to your computer and use it in GitHub Desktop.
Flutter 设置状态栏沉浸
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
Global.init().then((value) { | |
runApp(MyApp()); | |
}); | |
if (Platform.isAndroid) { | |
// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。 | |
var systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor: Colors.transparent); | |
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment