抖动中的透明状态栏 [英] Transparent status bar in flutter
本文介绍了抖动中的透明状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚开始使用flutter和android studio,我想知道是否有一种方法可以制作透明的状态栏,例如Android上的图片(不从状态栏过渡到appBar).当我尝试设置状态栏颜色时,它的阴影不同于appBar的阴影. 谢谢
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 to the appBar). When I try to set the status bar color, it gets a different shade than the appBar. Thanks
推荐答案
您可以将AnnotatedRegion
小部件与SystemUiOverlayStyle
一起使用,以更改镶边样式.
You can use the AnnotatedRegion
widget with SystemUiOverlayStyle
to change the chrome styles.
import 'package:flutter/services.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
),
child: Scaffold(...),
);
}
}
您可以在此处了解更多有关SystemUiOverlayStyle可能实现的信息.
You can read more about what's possible with SystemUiOverlayStyle here.
这篇关于抖动中的透明状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文