MapCircle class

Creates a circle which is drawn based on the given center and radius.

 late List<MapLatLng> _circles;
 late MapShapeSource _mapSource;

 @override
 void initState() {
   _circles = const <MapLatLng>[
     MapLatLng(-14.235004, -51.92528),
     MapLatLng(51.16569, 10.451526),
     MapLatLng(-25.274398, 133.775136),
     MapLatLng(20.593684, 78.96288),
     MapLatLng(61.52401, 105.318756)
   ];

   _mapSource = MapShapeSource.asset(
     'assets/world_map.json',
     shapeDataField: 'name',
   );
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     body: Center(
         child: Container(
       height: 350,
       child: Padding(
         padding: EdgeInsets.only(left: 15, right: 15),
         child: SfMaps(
           layers: <MapLayer>[
             MapShapeLayer(
               source: _mapSource,
               sublayers: [
                 MapCircleLayer(
                   circles: List<MapCircle>.generate(
                     _circles.length,
                     (int index) {
                       return MapCircle(
                         center: _circles[index],
                       );
                     },
                   ).toSet(),
                 ),
               ],
             ),
           ],
         ),
       ),
     )),
   );
 }
Inheritance

Constructors

MapCircle({required MapLatLng center, double radius = 5, Color? color, Color? strokeColor, double? strokeWidth, VoidCallback? onTap})
Creates a MapCircle.
const

Properties

center MapLatLng
The center of the circle.
final
color Color?
The fill color of the circle.
final
hashCode int
The hash code for this object.
no setterinherited
onTap VoidCallback?
Callback to receive tap event for this circle.
final
radius double
The radius of the circle.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
strokeColor Color?
Stroke color of the circle.
final
strokeWidth double?
Stroke width of the circle.
final

Methods

debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited