MapPolygonLayer class
A sublayer which renders group of MapPolygon on MapShapeLayer and MapTileLayer.
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(),
),
],
zoomPanBehavior: _zoomPanBehavior,
),
]),
);
}
See also:
* `[MapPolygonLayer.inverted]`, named constructor, for adding inverted
polygon shape.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- MapSublayer
- MapPolygonLayer
Constructors
-
MapPolygonLayer({Key? key, required Set<
MapPolygon> polygons, Color? color, double strokeWidth = 1, Color? strokeColor, IndexedWidgetBuilder? tooltipBuilder}) -
Creates the MapPolygonLayer.
const
-
MapPolygonLayer.inverted({Key? key, required Set<
MapPolygon> polygons, double strokeWidth = 1, Color? color, Color? strokeColor, IndexedWidgetBuilder? tooltipBuilder}) -
Creates the inverted color polygon shape.
const
Properties
- color → Color?
-
The fill color of all the MapPolygon.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
polygons
→ Set<
MapPolygon> -
A collection of MapPolygon.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeColor → Color?
-
The stroke color of all the MapPolygon.
final
- strokeWidth → double
-
The stroke width of all the MapPolygon.
final
- tooltipBuilder → IndexedWidgetBuilder?
-
Returns a widget for the map line tooltip based on the index.
finalinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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 short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited