gpt4 book ai didi

dart - Flutter 中的装饰图像模糊

转载 作者:IT老高 更新时间:2023-10-28 12:29:46 26 4
gpt4 key购买 nike

我的应用背景设置如下:

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new ExactAssetImage('assets/lol/aatrox.jpg'),
fit: BoxFit.cover,
),
),
child: new BackdropFilter(filter: new ImageFilter.blur(sigmaX: 600.0, sigmaY: 1000.0)),
width: 400.0,
),
);
}
}

我想模糊 DecorationImage,所以我在 Container 中添加了一个 BackdropFilter,但我没有看到任何变化。我做错了什么?

最佳答案

您可以通过模糊容器子代来执行类似的操作。

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new ExactAssetImage('assets/dog.png'),
fit: BoxFit.cover,
),
),
child: new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
child: new Container(
decoration: new BoxDecoration(color: Colors.white.withOpacity(0.0)),
),
),
),
);
}
}

screenshot

关于dart - Flutter 中的装饰图像模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49055676/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com