Flutter BackdropFilter淡入淡出动画

时间:2019-10-29 19:15:02

标签: animation flutter

我正在尝试使用具有占位符和背景滤镜模糊效果的CachedNetwordImage包,但是在从占位符和图像生成器过渡期间,背景滤镜会出现一段时间的振动

demonstration

imageBuilder: (context, imageProvider) {
                      playSound();
                      return  Stack(
                        children: <Widget>[
                          Container(
                            decoration: BoxDecoration(
                              boxShadow: const <BoxShadow>[
                                BoxShadow(
                                    offset: Offset(0, 10),
                                    color: Color.fromRGBO(0, 0, 0, 0.7),
                                    blurRadius: 15,
                                    spreadRadius: -10),
                              ],
                              borderRadius: BorderRadius.circular(34),
                              image: DecorationImage(fit: BoxFit.cover, alignment: Alignment.center, image: imageProvider),
                            ),
                          ),
                          //
                          isChoiceMade
                              ? const SizedBox()
                              : ClipRRect(
                                borderRadius: BorderRadius.circular(34),
                                child: BackdropFilter(
                                  filter: ImageFilter.blur(sigmaX: 15, sigmaY: 15),
                                  child: Container(color: Colors.transparent),
                                ),
                              ),
                        ],
                      );
                    },

0 个答案:

没有答案