toDrawable method Null safety
- {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}
override
Create a drawable area for a FlutterMap out of this region
prettyPaint
controls what type of shape will be output. If false
,
multiple overlapping rectangular Polygons will be output, representing
the area that will actually be downloaded. If true
(default), a
Polyline will be output, which handles all the nice rounding and some
other stuff that makes it more suitable to present to the user.
Some parameters will only have an effect depending whether a Polygon or Polyline is being output.
Returns a layer to be added to the layer
property of a FlutterMap.
Implementation
@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,
isDotted: isDotted,
gradientColors: gradientColors,
colorsStop: colorsStop,
strokeCap: strokeCap,
strokeJoin: strokeJoin,
),
],
)
: PolygonLayer(
polygons: toOutlines(1)
.map(
(rect) => Polygon(
points: rect,
isFilled: fillColor != null,
color: fillColor ?? Colors.transparent,
borderColor: borderColor ?? const Color(0x00000000),
borderStrokeWidth: borderStrokeWidth,
isDotted: isDotted,
strokeCap: strokeCap,
strokeJoin: strokeJoin,
),
)
.toList(),
);