MapPolylineLayer class
A sublayer which renders group of MapPolyline on MapShapeLayer and MapTileLayer.
late MapZoomPanBehavior _zoomPanBehavior;
late List<MapLatLng> _polyLines;
late MapShapeSource _mapSource;
@override
void initState() {
_polyLines = <MapLatLng>[
MapLatLng(13.0827, 80.2707),
MapLatLng(14.4673, 78.8242),
MapLatLng(14.9091, 78.0092),
MapLatLng(16.2160, 77.3566),
MapLatLng(17.1557, 76.8697),
MapLatLng(18.0975, 75.4249),
MapLatLng(18.5204, 73.8567),
MapLatLng(19.0760, 72.8777),
];
_mapSource = MapShapeSource.asset(
'assets/india.json',
shapeDataField: 'name',
);
_zoomPanBehavior = MapZoomPanBehavior(
zoomLevel: 3, focalLatLng: MapLatLng(15.3173, 76.7139));
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Polyline')),
body: SfMaps(
layers: [
MapShapeLayer(
source: _mapSource,
sublayers: [
MapPolylineLayer(
polylines: List<MapPolyline>.generate(
1,
(int index) {
return MapPolyline(
points: _polyLines,
);
},
).toSet(),
),
],
zoomPanBehavior: _zoomPanBehavior,
),
],
),
);
}
See also:
- MapLineLayer, for adding lines.
- MapArcLayer, for arcs.
- MapCircleLayer, for adding circles.
- MapPolygonLayer, for adding polygons.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- MapSublayer
- MapPolylineLayer
Constructors
-
MapPolylineLayer({Key? key, required Set<
MapPolyline> polylines, Animation<double> ? animation, Color? color, double width = 2, StrokeCap strokeCap = StrokeCap.butt, List<double> dashArray = const <double>[0, 0], IndexedWidgetBuilder? tooltipBuilder}) -
Creates the MapPolylineLayer.
const
Properties
-
animation
→ Animation<
double> ? -
Animation for the polylines in MapPolylineLayer.
final
- color → Color?
-
The color of all the polylines.
final
-
dashArray
→ List<
double> -
Apply same dash pattern for all the MapPolyline in the polylines
collection.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
polylines
→ Set<
MapPolyline> -
A collection of MapPolyline.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strokeCap → StrokeCap
-
Applies stroke cap to the start and end of all polylines. You can set
StrokeCap.round to get a semi-circle or StrokeCap.square to get a
semi-square at the edges of the polyline.
final
- tooltipBuilder → IndexedWidgetBuilder?
-
Returns a widget for the map line tooltip based on the index.
finalinherited
- width → double
-
The width of all the polylines.
final
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}) → 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