【问题标题】:Custom colors background in flutter [closed]颤动中的自定义颜色背景[关闭]
【发布时间】:2021-03-04 13:17:11
【问题描述】:

我该如何做这个背景之王: https://dribbble.com/shots/14805280-Wallet-app

我尝试了渐变,但不仅仅是一个简单的渐变,我还尝试了带有 3 个容器的 ShaderMask,这样做的正确方法是什么?

【问题讨论】:

    标签: flutter gradient


    【解决方案1】:

    这是我通过简单实现得到的最接近的结果,其中包含模糊效果和一些容器。有一些issues 带有剪裁模糊的边界,如果它解决了,它就会与您的实例更加相似。

    codepen link 也可用

    class FancyBlurBox extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            body: Center(
              child: ClipRRect(
                borderRadius: BorderRadius.circular(15),
                child: SizedBox(
                  width: 200,
                  height: 120,
                  child: Stack(
                    children: [
                      Column(
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: [
                          Expanded(
                            child: Row(
                              crossAxisAlignment: CrossAxisAlignment.stretch,
                              children: [
                                Expanded(
                                    child: Container(color: Color(0xFF7dccf3))),
                                Expanded(
                                    child: Container(color: Color(0xFF695bf4))),
                              ],
                            ),
                          ),
                          Expanded(
                            child: Row(
                              crossAxisAlignment: CrossAxisAlignment.stretch,
                              children: [
                                Expanded(
                                    child: Container(color: Color(0xFFde536f))),
                                Expanded(
                                    child: Container(color: Color(0xFFf6c37f))),
                              ],
                            ),
                          ),
                        ],
                      ),
                      Transform.translate(
                        offset: Offset(10, 10),
                        child: BackdropFilter(
                          filter: ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
                          child: Container(color: Colors.white.withOpacity(0.0)),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ),
          );
      }
    }
    

    【讨论】:

    猜你喜欢
    • 2020-02-25
    • 1970-01-01
    • 2011-09-12
    • 1970-01-01
    • 1970-01-01
    • 2018-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多