controlPointFactor property Null safety

double controlPointFactor
final

Specifies the arc bending position.

Defaults to 0.5.

The arc will bend at the center between the from and to points by default.

The value ranges from 0 to 1.

 late List<Model> _arcs;
 late MapZoomPanBehavior _zoomPanBehavior;
 late MapShapeSource _mapSource;

 @override
 void initState() {
   _zoomPanBehavior = MapZoomPanBehavior(
     focalLatLng: MapLatLng(40.7128, -95.3698),
     zoomLevel: 3,
   );

  _mapSource = MapShapeSource.asset(
     "assets/world_map.json",
     shapeDataField: "continent",
   );

  _arcs = <Model>[
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(44.9778, -93.2650)),
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(33.4484, -112.0740)),
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(29.7604, -95.3698)),
     Model(MapLatLng(40.7128, -74.0060), MapLatLng(39.7392, -104.9903)),
   ];
 super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     body: SfMaps(
       layers: [
         MapShapeLayer(
           source: _mapSource,
           zoomPanBehavior: _zoomPanBehavior,
           sublayers: [
             MapArcLayer(
               arcs: List<MapArc>.generate(
                 _arcs.length,
                 (int index) {
                   return MapArc(
                     from: _arcs[index].from,
                     to: _arcs[index].to,
                     controlPointFactor: 0.4,
                   );
                 },
               ).toSet(),
             ),
           ],
         ),
       ],
     ),
   );
 }

class Model {
  Model(this.from, this.to);

  MapLatLng from;
  MapLatLng to;
}

Implementation

final double controlPointFactor;