-
高斯模糊_毛玻璃效果
代码拿过就能使用,需要传一个图片Url哦~
具体代码如下:
class MaoBoLiView extends StatelessWidget {
final String imgUrl;
const MaoBoLiView(this.imgUrl, {Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
child: Stack(
fit: StackFit.expand,
children: <Widget>[
Image.network(
this.imgUrl,
fit: BoxFit.cover,
),
BackdropFilter(
filter: ui.ImageFilter.blur(sigmaY: 8, sigmaX: 8),
child: Opacity(
opacity: 0.7,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black12,
Colors.black26,
Colors.black38,
Colors.black45,
Colors.black87,
],
),
),
),
),
),
],
),
);
}
}
效果如下:

请关注我的简书吧,以后我会写很多flutter相关的资料。
网友评论