RouteSimulator constructor
RouteSimulator(
- List<
LatLng> listLatLng, - TickerProvider vsync, {
- double speed = 0.001,
- bool repeat = false,
- Duration duration = const Duration(seconds: 10),
- dynamic onLocationChange()?,
- double upperBound = 2.2,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
vsync from TickerProviderStateMixin
class, used to init
AnimationController
Implementation
RouteSimulator(List<LatLng> listLatLng, TickerProvider vsync,
{double speed = 0.001,
bool repeat = false,
this.duration = const Duration(seconds: 10),
Function(LatLng)? onLocationChange,
double upperBound = 2.2,
AnimationBehavior animationBehavior = AnimationBehavior.normal}) {
_polyline = PolylineAnimation(listLatLng);
_currentDistance = 0;
_speed = speed;
_onLocationChange = onLocationChange;
_animationController = AnimationController(
upperBound: upperBound,
vsync: vsync,
duration: duration,
animationBehavior: animationBehavior)
..forward()
..addListener(() {
if (_animationController.isCompleted && repeat) {
_animationController.repeat();
}
});
}