我想制作一个对话框,而不是用通常的物质方式来使后面的小部件变暗,从而使它们模糊。所以基本上我想知道是否有一种方法不仅可以模糊图像,还可以模糊整个应用程序(或部分应用程序)
最佳答案
You can use the BackdropFilter to make the image actual blur and put the white overlay on that using below code. Here _value is the slider value which use can select. for ex. 10.0
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
SystemChrome.setEnabledSystemUIOverlays([]);
// TODO: implement build
return new Scaffold(
resizeToAvoidBottomPadding: false,
body: new Stack(children: <Widget>[
new PageView.builder(
itemBuilder: (context, pos) {
return new Stack(
children: <Widget>[
new FadeInImage(
fit: BoxFit.cover,
placeholder: new CachedNetworkImageProvider(
widget.CatimgList[pos].thumb_img),
image: new CachedNetworkImageProvider(
widget.CatimgList[pos].image_large),
),
new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: _value, sigmaY: _value),
child: new Container(
decoration: new BoxDecoration(
color: Colors.white.withOpacity(_value)),
),
)
],
);
);
)
关于dart - flutter 模糊叠加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51801800/