How to convert CSS Gradient
background: linear-gradient(177.82deg, rgba(138, 160, 55, 0.2) 51.9%, #8E9B5E 69.3%);
to Flutter Gradient?
How to convert CSS Gradient
background: linear-gradient(177.82deg, rgba(138, 160, 55, 0.2) 51.9%, #8E9B5E 69.3%);
to Flutter Gradient?
you just need to know :
see the code example:
Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.red.withOpacity(0.1),
Colors.green.withOpacity(0.8),
],
),
),
)
Note number 1: that I just used the red and the green to make it clear for you, but you can use the hex colors like that
#8E9B5E
to
0xff8E9B5E
and you can replace:
Colors.red.withOpacity(0.1),
to be like:
Color(0xff8E9B5E),
Note number 3: the function of .withOpacity(0.1) is just for Opacity like the percentage of the color appearance (from 0.0 to 1.0) and you can change the value of the Opacity or delete it if you want and use just Colors.red or Color(0xff8E9B5E)