Adding fling animation to my openmap application in flutter with snackbar message showing animation has started and ended

29 Views Asked by At

Wrapping the mapwidget inside gesture detector makes me lose properties such as rotating, scrolling, zooming. I want to add the fling animation.

Wrapping inside the gesture detector with onPanUpdate could not use the velocity property and thus cannot analyze if it is actually a fling. I want to be able to fling on the map and display a snackbar message with "Animation started" and "Animation ended".


  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Maps Screen'),
        actions: [

        ],
      ),
      body: MapWidget(
        resourceOptions: ResourceOptions(
            accessToken:
            "my token"),
        mapOptions: MapOptions(
          pixelRatio: 1,
          crossSourceCollisions: false,
        ),
        cameraOptions: CameraOptions(
          center: Point(
            coordinates: Position(72, 30),
          ).toJson(),
          zoom: 21.0,
          padding: MbxEdgeInsets(top: 300, left: 0, right: 0, bottom: 300),
        ),
        styleUri: MapboxStyles.SATELLITE_STREETS,
        onMapCreated: (mapboxMap) {
          _mapboxMap = mapboxMap;
          // User Location
          mapboxMap.location.updateSettings(LocationComponentSettings(
            enabled: true,
            pulsingEnabled: true,
            showAccuracyRing: true,
            puckBearingEnabled: true,
            puckBearingSource: PuckBearingSource.HEADING,
          ));
        },
      ),
    );
  }
}
0

There are 0 best solutions below