Gunaseelan
Gunaseelan

Reputation: 15525

Using gradient angle in flutter

I have a requirement to create gradient bg like

enter image description here

with css code

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

I tried with

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

but it doesn't work as expected. Also I have tried with SweepGradient, which also not worked.

Upvotes: 2

Views: 1046

Answers (1)

bluenile
bluenile

Reputation: 6029

Did you try giving it the 'end' property?

end : Alignment.bottomRight or 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
      ]*/)

Upvotes: 2

Related Questions