createLinearGradient method

Paint createLinearGradient(
  1. double width,
  2. double height
)

Implementation

Paint createLinearGradient(double width, double height) {
  //TODO - maybe make it easier to pass specific gradient fields vs making your own gradient
  //https://stackoverflow.com/questions/60019684/use-gradient-with-paint-object-in-flutter-canvas
  return Paint()..shader =
  LinearGradient(colors: [startColor, endColor], begin: Alignment.topCenter, end: Alignment.bottomCenter).createShader(Rect.fromLTRB(0, 0, width, height));
}