text property

String text
final

Specifies the text to be used for the legend item.

By default, MapColorMapper.from and MapColorMapper.to or MapColorMapper.value will be used as the text of the legend item.

List<Model> data;

 @override
 void initState() {
   super.initState();

   data = <Model>[
    Model('India', 100, "Low"),
    Model('United States of America', 200, "High"),
    Model('Pakistan', 75, "Low"),
   ];
 }

 @override
 Widget build(BuildContext context) {
   return SfMaps(
     layers: [
       MapShapeLayer(
         delegate: MapShapeLayerDelegate(
             shapeFile: "assets/world_map.json",
             shapeDataField: "name",
             dataCount: data.length,
             primaryValueMapper: (index) {
               return data[index].country;
             },
             shapeColorValueMapper: (index) {
               return data[index].count;
             },
             shapeColorMappers: [
               MapColorMapper(from: 0, to:  100, color: Colors.yellow,
               maxOpacity: 0.2, minOpacity: 0.5, text: "low"),
               MapColorMapper(from: 101, to: 200, color: Colors.red,
               maxOpacity: 0.6, minOpacity: 1, text: "high")
            ]),
       )
     ],
   );
 }

See also:

Implementation

final String text