【发布时间】:2022-10-09 04:24:25
【问题描述】:
我正在尝试使用透明的 AppBar 制作屏幕布局,该 AppBar 必须在其下滚动内容。
问题是,当内容滚动时,AppBar 会显示一个阴影,shadowColor,但它设置为透明色。
编辑:我注意到造成这种情况的原因是在我的应用程序主题中将 useMaterial3 设置为 true。
我正在使用 Flutter 3.0.2。
这是我的代码:
Stack(
fit: StackFit.expand,
children: [
//AuthBackground(),
Container(color: Colors.brown,),
Theme(
data: AppStyles.mainDarkTheme.copyWith(
textTheme: AppStyles.mainDarkTheme.textTheme.apply(
bodyColor: Colors.blue,
displayColor: Colors.blue,
)
),
child: Scaffold(
backgroundColor: Colors.transparent,
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
elevation: 0.0,
bottomOpacity: 0.0,
),
body: _content(),
),
),
],
)
在这里,您可以看到滚动内容时 AppBar 上的阴影:
提前致谢!
【问题讨论】: