gradient method

Gradient gradient()

Returns the appropriate Gradient object based on the gradient type.

Implementation

Gradient gradient() {
  switch (gradientType) {
    case FlutterTagGradientType.linear:
      // Creates a linear gradient with specified properties.
      return LinearGradient(
        colors: colors,
        begin: begin!,
        end: end!,
        stops: stops,
        tileMode: tileMode,
        transform: transform,
      );
    case FlutterTagGradientType.radial:
      // Creates a radial gradient with specified properties.
      return RadialGradient(
        colors: colors,
        radius: radius!,
        center: center!,
        stops: stops,
        tileMode: tileMode,
        focal: focal,
        focalRadius: focalRadius!,
        transform: transform,
      );
    case FlutterTagGradientType.sweep:
      // Creates a sweep gradient with specified properties.
      return SweepGradient(
        colors: colors,
        center: center!,
        startAngle: startAngle!,
        endAngle: endAngle!,
        stops: stops,
        tileMode: tileMode,
        transform: transform,
      );
    default:
      // Default to linear gradient if the type is not recognized.
      return LinearGradient(
        colors: colors,
        begin: begin!,
        end: end!,
        stops: stops,
        tileMode: tileMode,
        transform: transform,
      );
  }
}