在颤动中使用渐变角

时间:2020-10-31 00:47:04

标签: flutter

我需要创建像这样的渐变背景

enter image description here

带有CSS代码

.rectangle {
  height: 864px;
  width: 384px;
  border-radius: 10px;
  background: linear-gradient(220.25deg, #2BB88B 0%, #07909B 35.17%, #035762 100%);
}

我尝试过

LinearGradient(
              begin: Alignment.topRight,
              colors: const <Color>[
            Color(0xFF2BB88B),
            Color(0xFF07909B),
            Color(0xFF035762)
          ],
              /*stops: [
            0,
            0.35,
            0.1
          ]*/)

,但无法正常工作。我也尝试过SweepGradient,但也没有用。

1 个答案:

答案 0 :(得分:1)

您是否尝试赋予它“ end”属性?

end:Alignment.bottomRight或end:Alignment.bottomLeft,

LinearGradient(
          begin: Alignment.topRight,
          end : Alignment.bottomRight,
          colors: const <Color>[
        Color(0xFF2BB88B),
        Color(0xFF07909B),
        Color(0xFF035762)
      ],
          /*stops: [
        0,
        0.35,
        0.1
      ]*/)