有没有办法在 Flutter 中打开叠加层时使背景变暗?
Is there a way to dim the background while opening the overlay in Flutter?
单击一个按钮,我将在其上打开一个叠加层。有没有办法模糊或暗化打开叠加层的页面?
感谢您的宝贵时间!
Widget build(BuildContext context) {
showDialog(
context: context,
barrierDismissible: true,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black54.withOpacity(0.8),
builder: (context) {
return AlertDialog(
content: SizedBox(
width: 300,
child: ...
);
});
}
根据自己的喜好调整不透明度:
Colors.black54.withOpacity(0.8)
单击一个按钮,我将在其上打开一个叠加层。有没有办法模糊或暗化打开叠加层的页面?
感谢您的宝贵时间!
Widget build(BuildContext context) {
showDialog(
context: context,
barrierDismissible: true,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
barrierColor: Colors.black54.withOpacity(0.8),
builder: (context) {
return AlertDialog(
content: SizedBox(
width: 300,
child: ...
);
});
}
根据自己的喜好调整不透明度:
Colors.black54.withOpacity(0.8)