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

问题描述 投票:0回答:1

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

Image.network(

                  user.profileImageUrl,
                  fit: BoxFit.cover,
                ),
                Center(
                  child: Text(
                    user.name,
                    style: TextStyle(
                      fontSize: 30,
                    ),
                  ),
                )
firebase flutter blur
1个回答
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),
    ),
  ),
);
© www.soinside.com 2019 - 2024. All rights reserved.