I can not understand how to operate in degrees LinearGradient. I have the following code:
Container(
        height: 100.0,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(6.0),
          gradient: LinearGradient(begin: FractionalOffset.topLeft, end: FractionalOffset.bottomRight, colors: [
            Color(0xFF148535),
            Color(0xFF148535),
            Color(0XFF0D6630),
            Color(0XFF0D6630),
            Color(0xFF148535),
            Color(0xFF148535),
          ], stops: [
            0.0,
            0.3,
            0.3,
            0.7,
            0.7,
            1.0
          ]),
        ),
      );
But .topLeft and '.bottomRight' don't do that is required. Picture that is below shows what I want to get. (The picture has a offset and it doesn't fit to [0.0, 0.3, 0.3, 0.7, 0.7, 1.0] because this is just example)

This might help you determine the angle
eg :
LinearGradient(
          begin: Alignment(-1.0, -1),
          end: Alignment(-1.0, 1),

More Details on Gradients: How to improve your Flutter application with gradient designs by Varun Chilukuri
Try using these values:
 LinearGradient(
          begin: Alignment(-1.0, -2.0),
          end: Alignment(1.0, 2.0),
Or event better
   LinearGradient(
          begin: Alignment(-1.0, -4.0),
          end: Alignment(1.0, 4.0),
Y: parameter description
The distance fraction in the vertical direction.
A value of -1.0 corresponds to the topmost edge. A value of 1.0
corresponds to the bottommost edge. Values are not limited to that range;
/// values less than -1.0 represent positions above the top, and values /// greater than 1.0 represent positions below the bottom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With