如何在抖动中模糊网络图像

时间:2020-03-30 21:29:58

标签: firebase flutter blur

有人知道如何在抖动中模糊Image.Network吗?

Image.network(

                  user.profileImageUrl,
                  fit: BoxFit.cover,
                ),
                Center(
                  child: Text(
                    user.name,
                    style: TextStyle(
                      fontSize: 30,
                    ),
                  ),
                )

1 个答案:

答案 0 :(得分:0)

尝试以下操作:

double _sigmaX = 0.0; // from 0-10
double _sigmaY = 0.0; // from 0-10
double _opacity = 0.1; // from 0-1.0

Container(
  width: 350,
  height: 300,
  decoration: BoxDecoration(
    image: DecorationImage(
      image: Image.network(user.profileImageUrl,
                  fit: BoxFit.cover,
                )
    ),
  ),
  child: BackdropFilter(
    filter: ImageFilter.blur(sigmaX: _sigmaX, sigmaY: _sigmaY),
    child: Container(
      color: Colors.black.withOpacity(_opacity),
    ),
  ),
);