toDrawable method

  1. @Deprecated('Instead obtain the outline/line/points using other methods, and render the ' 'layer manually. ' 'This method is being removed to reduce dependency on flutter_map, and allow ' 'full usage of flutter_map functionality without it needing to be ' 'semi-implemented here. ' 'This feature was deprecated after v9.1.0, and will be removed in the next ' 'breaking/major release.')
  2. @override
Widget toDrawable({
  1. Color? fillColor,
  2. Color? borderColor,
  3. double borderStrokeWidth = 3,
  4. bool isDotted = false,
  5. bool prettyPaint = true,
  6. StrokeCap strokeCap = StrokeCap.round,
  7. StrokeJoin strokeJoin = StrokeJoin.round,
  8. List<Color>? gradientColors,
  9. List<double>? colorsStop,
})
override

Deprecated. Instead obtain the outline/line/points using other methods, and render the layer manually. This method is being removed to reduce dependency on flutter_map, and allow full usage of flutter_map functionality without it needing to be semi-implemented here. This feature was deprecated after v9.1.0, and will be removed in the next breaking/major release.

If prettyPaint was true, render a Polyline based on line and radius. Otherwise, render multiple Polygons based on the result of toOutlines(1).

Implementation

@Deprecated(
  'Instead obtain the outline/line/points using other methods, and render the '
  'layer manually.  '
  'This method is being removed to reduce dependency on flutter_map, and allow '
  'full usage of flutter_map functionality without it needing to be '
  'semi-implemented here. '
  'This feature was deprecated after v9.1.0, and will be removed in the next '
  'breaking/major release.',
)
@override
Widget toDrawable({
  Color? fillColor,
  Color? borderColor,
  double borderStrokeWidth = 3,
  bool isDotted = false,
  bool prettyPaint = true,
  StrokeCap strokeCap = StrokeCap.round,
  StrokeJoin strokeJoin = StrokeJoin.round,
  List<Color>? gradientColors,
  List<double>? colorsStop,
}) =>
    prettyPaint
        ? PolylineLayer(
            polylines: [
              Polyline(
                points: line,
                strokeWidth: radius,
                useStrokeWidthInMeter: true,
                color: fillColor ?? const Color(0x00000000),
                borderColor: borderColor ?? const Color(0x00000000),
                borderStrokeWidth: borderStrokeWidth,
                pattern: isDotted
                    ? const StrokePattern.dotted()
                    : const StrokePattern.solid(),
                gradientColors: gradientColors,
                colorsStop: colorsStop,
                strokeCap: strokeCap,
                strokeJoin: strokeJoin,
              ),
            ],
          )
        : PolygonLayer(
            polygons: toOutlines(1)
                .map(
                  (rect) => Polygon(
                    points: rect,
                    color: fillColor,
                    borderColor: borderColor ?? const Color(0x00000000),
                    borderStrokeWidth: borderStrokeWidth,
                    pattern: isDotted
                        ? const StrokePattern.dotted()
                        : const StrokePattern.solid(),
                    strokeCap: strokeCap,
                    strokeJoin: strokeJoin,
                  ),
                )
                .toList(),
          );