offset property

Offset offset
final

Places the legend in custom position.

If the offset has been set and if the position is top, then the legend will be placed in top but in the position additional to the actual top position. Also, the legend will not take dedicated position for it and will be drawn on the top of map.

 @override
 Widget build(BuildContext context) {
   return SfMaps(
     layers: [
       MapShapeLayer(
         showLegend: true,
         legendSettings: MapLegendSettings(
            offset: Offset(0, 5)
         ),
         delegate: MapShapeLayerDelegate(
             shapeFile: "assets/world_map.json",
             shapeDataField: "continent",
             dataCount: bubbleData.length,
             primaryValueMapper: (index) {
               return bubbleData[index].country;
             }),
       )
     ],
   );
 }

See also:

  • position, to set the position of the legend.

Implementation

final Offset offset