更改BottomSheet的灰色叠加背景 [英] Change gray overlay background of BottomSheet
本文介绍了更改BottomSheet的灰色叠加背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用showModalBottomSheet
时是否可以更改覆盖背景色?
Is there a way to change the overlay background color when using showModalBottomSheet
?
现在,颜色始终是灰色,但是我想使用其他颜色,例如绿色,如下所示.
Right now the color is always a gray color, but I want to use a different color like green as shown below.
这是演示中使用的代码供参考
Here is the code used in the demo for reference
showModalBottomSheet<void>(context: context, builder: (BuildContext context) {
return Container(
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Text('This is the modal bottom sheet. Tap anywhere to dismiss.',
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).accentColor,
fontSize: 24.0
)
)
)
);
});
推荐答案
新Flutter UPDATE允许您更改showModalBottomSheet()
New Flutter UPDATE allows you to change the barrierColor
in showModalBottomSheet()
showModalBottomSheet(
barrierColor: Colors.yellow.withOpacity(0.5),
这篇关于更改BottomSheet的灰色叠加背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文