Marker animator
While working in map with Live-Tracking, You may like to show marker moving animation. This package will help you to animate marker over MapMyIndia's Map.
Features
This initial version will use to move marker icon with smooth animation.
Getting started
This package only support in MapMyIndia's map. Tested android and Ios
Installation
- Add the latest version of package to your pubspec.yaml (and run `dart pub get`)
- Import the package and use it in your Flutter App.
dependencies:
mmi_animap: ^0.0.2
import 'package:mmi_animap/mmi_animap.dart';
Usage
To initialize MmiAnimarker
you need to pass MapmyIndiaMapController
and vsync
late MmiAnimarker mmiAnimarker;
_onMapCreated(MapmyIndiaMapController controller) {
mmiAnimarker = MmiAnimarker(controller, this);
}
late Symbol carMarkerSymbol;
String carMarker = 'carMarker';
_addCarMarker(LatLng cabLatLng) async {
var symbolOptions = SymbolOptions(
geometry: cabLatLng,
iconImage: carMarker,
iconSize: 0.8,
);
cabMarkerSymbol = await mmiAnimarker.addAnimarkerSymbol(
carMarker, AppImages.IMG_CAR_MARKER, symbolOptions);
}
_animateCabIcon(LatLng currentLatLng) async {
if (cabMarkerSymbol != null)
await mmiAnimarker.animateMarker(currentLatLng, cabMarkerSymbol!);
}
@override
void dispose() {
mmiAnimarker.dispose();
super.dispose();
}