我的应用背景设置如下:
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)),
),
),
),
);
}
}
https://stackoverflow.com/questions/49055676/
相关文章:
flutter - 禁用 TabBar flutter 中的滑动标签
json - 如何在 flutter 中反序列化来自json的对象列表
flutter - 如何在 flutter 中制作圆形 TextField?
dart - Flutter - 在路由之间推送和获取值(value)
dart - 在 flutter 中以编程方式关闭模态底部表
firebase - Flutter 和 google_sign_in 插件 : PlatformE
flutter - 如何检查滚动位置是在 ListView 的顶部还是底部?