title property
Sets a title for the legend.
Defaults to null.
Typically a Text widget.
Example
This snippet shows how to create a map with legends and legend’s title.
late MapShapeSource _shapeSource;
@override
void initState() {
super.initState();
_shapeSource = MapShapeSource.asset(
"assets/world_map.json",
shapeDataField: "continent",
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SfMaps(
layers: [
MapShapeLayer(
source: _shapeSource,
legend: MapLegend(
MapElement.shape,
title: Text('World Map'),
),
),
],
),
);
}
See also:
MapLegend()
, to know about the legend in maps.
Implementation
final Widget? title;