我只想有一个模糊的圆,但这是不可能的,圆的外部部分,即容器是完全模糊的。这同样适用于CustomPoint。
代码:
Center(
child: Stack(alignment: Alignment.center, children: [
Image.network(
"https://mojekooh.com/wp-content/uploads/2020/09/1024px-Matterhorn_from_Domh%C3%BCtte_-_2.jpg"),
ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Container(
width: 200,
height: 100,
decoration: const BoxDecoration(
color: Color.fromARGB(33, 255, 0, 0),
shape: BoxShape.circle),
),
),
)
]),
),
我在网上搜索了一下,什么都没有找到
更新:
朋友们,我解决了这个问题:
Stack(alignment: Alignment.center, children: [
Image.network(
"https://mojekooh.com/wp-content/uploads/2020/09/1024px-Matterhorn_from_Domh%C3%BCtte_-_2.jpg"),
ClipOval(
clipper: CoustomCircle(),
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Container(
width: 200,
height: 200,
decoration: const BoxDecoration(
color: Color.fromARGB(57, 255, 0, 0),
shape: BoxShape.circle),
),
),
)
]),
class CoustomCircle extends CustomClipper<Rect> {
@override
Rect getClip(size){
return const Rect.fromLTWH(0, 0, 200, 200);
}
@override
bool shouldReclip(oldClipper){
return true;
}
}
3条答案
按热度按时间ecfdbz9o1#
使用ImageFiltered构件而不是BackdropFilter
记住导入“dart:ui”
ffvjumwh2#
你可以模糊一个
CircleAvatar
,而不是模糊一个容器。zujrkrfu3#
朋友们,我解决了这个问题: