Colors.transparent opacity 使背景颜色更深 - Flutter

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

我想为我的 ElevatedButton 设置渐变作为背景色。

所以我这样做了:

Container(
            height: 100,
            width: 100,
            decoration: const BoxDecoration(
                gradient: LinearGradient(
              begin: Alignment.topRight,
              end: Alignment.bottomLeft,
              colors: [
                Color(0xFFFE1871),
                Color(0xFFFD0E38),
                Color(0xFFFF0205),
              ],
            )),
            child: ElevatedButton(
                style: ElevatedButton.styleFrom(
                    backgroundColor: Colors.transparent),
                onPressed: () {},
                child: const Text(
                  'S\'inscrire',
                )),
          ),

但是渐变的颜色比预期的要暗。

这就是我想要的:

这是我所拥有的:

Colors.transparent 似乎有一些默认的不透明度。

如何解决?

flutter dart user-interface colors gradient
© www.soinside.com 2019 - 2024. All rights reserved.