How to create a linear gradient with 45 degrees in Flutter? How to create a linear gradient with 45 degrees in Flutter? flutter flutter

How to create a linear gradient with 45 degrees in Flutter?


This might help you determine the angle

eg :

LinearGradient(          begin: Alignment(-1.0, -1),          end: Alignment(-1.0, 1),

Alignment in Flutter

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.


Use Alignment.topLeft and Alignment.bottomRight

LinearGradient(      colors: [Colors.cyanAccent, Colors.amberAccent],      begin: Alignment.topLeft,      end: Alignment.bottomRight,      tileMode: TileMode.clamp),