一、Flutter 透明状态栏设置
void main() {
//flutter 修改状态栏的颜色
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
.....
}
二、Flutter 透明顶部导航
通过 backgroundColor: Colors.transparent
结合 elevation: 0
可以实现透明导航,要实现透明。 浮动导航的话可以使用定位
。
Positioned(
top: 0,
left: 0,
right: 0,
child: AppBar(
title: const Text('CategoryView'), centerTitle: true,
backgroundColor: Colors.transparent,
elevation: 0, //消除阴影
)
)
效果图: