strokeColor property

Color? strokeColor
final

The stroke color of all the MapPolygon.

For setting stroke color for each MapPolygon, please check the MapPolygon.strokeColor property.

 late MapZoomPanBehavior _zoomPanBehavior;
 late List<MapLatLng> _polygon;
 late MapShapeSource _mapSource;

 @override
 void initState() {
   _polygon = <MapLatLng>[
     MapLatLng(38.8026, -116.4194),
     MapLatLng(46.8797, -110.3626),
     MapLatLng(41.8780, -93.0977),
   ];

   _mapSource = MapShapeSource.asset(
     'assets/usa.json',
     shapeDataField: 'name',
   );

   _zoomPanBehavior = MapZoomPanBehavior();
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(title: Text('Polygon shape')),
     body: SfMaps(layers: [
       MapShapeLayer(
         source: _mapSource,
         sublayers: [
           MapPolygonLayer(
             polygons: List<MapPolygon>.generate(
               1,
               (int index) {
                 return MapPolygon(
                   points: _polygon,
                 );
               },
             ).toSet(),
             strokeColor: Colors.red,
             strokeWidth: 5.0,
           ),
         ],
         zoomPanBehavior: _zoomPanBehavior,
       ),
     ]),
   );
 }

See also: strokeWidth, to set the stroke width for the polygon.

Implementation

final Color? strokeColor;