问题
有没有办法使
AppBar完全透明而不使用StackWidget??
这是我的AppBar现在(它是透明的,但不完全,它有一个白色的阴影)
AppBar(
automaticallyImplyLeading: false,
backgroundColor: const Color.fromARGB(0, 255, 255, 255).withOpacity(0.1),
shadowColor: const Color.fromARGB(0, 255, 255, 255).withOpacity(0.1),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
IconButton(
onPressed: () {},
icon: const Icon(
Icons.menu,
color: colors.BLACK,
size: 24,
),
),
IconButton(
onPressed: () {},
icon: const Icon(
Icons.notifications,
color: colors.BLACK,
size: 24,
),
),
],
),
Row(
children: const [
Text('Location', style: TextStyle(color: colors.BLACK, fontSize: 14)),
Icon(
Icons.location_on,
color: colors.BLACK,
size: 24,
),
]
),
IconButton(
onPressed: () {},
icon: const CircleAvatar(
backgroundImage: AssetImage('assets/images/icons/temp_profile_pic.png'),
radius: 20,
)
)
],
),
);打印
这里有一些指纹来告诉你发生了什么:
在顶部滚动

滚动时

发布于 2022-05-11 15:43:17
要将AppBar设置为完全透明,需要将elevation设置为0,并将颜色设置为transparent,如下所示:
AppBar(
backgroundColor: Colors.transparent,
elevation: 0
)AppBar将具有与脚手架的背景相同的颜色。

https://stackoverflow.com/questions/72203905
复制相似问题