【发布时间】:2019-10-17 17:17:42
【问题描述】:
我正在尝试实现与 Flutter 频道上本周视频小部件中显示的非常相似的效果:https://www.youtube.com/watch?v=dYRs7Q1vfYI#t=1m20s
在右侧,您可以看到所需的结果,在左侧,您可以看到我的应用中当前正在发生的事情。
我一直在使用的代码与示例视频中的代码非常相似,它使用堆栈将背景滤镜放置在我的图像上。圆形图像及其上的模糊位于一个小部件内,该小部件将放置在另一个堆栈内(连同底部的文本)。由于我只应用了图像的一小部分过滤器,我不明白为什么整个应用程序都模糊了。这是图像小部件的代码:
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size.width - 75;
return Container(
height: size,
width: size,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Image(imageUri: "...", size: size - 30), // this is just a container with the image
Positioned(
top: 100,
left: 100,
bottom: 100,
right: 100,
child: BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 5,
sigmaY: 5,
),
child: Container(
color: Color(0x66FF0000),
),
),
)
],
),
);
}
}
【问题讨论】:
-
这个问题只出现在 ios 上!!!