AnilocationTaskImpl constructor

AnilocationTaskImpl({
  1. required AnilocationTaskDescription description,
})

Implementation

AnilocationTaskImpl({required this.description}) {
  _locationTween = LocationTween(
    interpolator: LineLocationInterpolatorImpl(
      begin: description.begin.copyWith(markerId: description.markerId),
      end: description.end.copyWith(markerId: description.markerId),
    ),
  );

  _isActiveTrip = description.isActiveTrip;
  _useRotation = description.useRotation;

  _locationCtrller = AnimationController(
      vsync: description.vsync, duration: description.duration);

  _bearingTween = BearingTween.from(_locationTween);
  //_bearingCtrller = AnimationController(vsync: description.vsync, duration: description.duration);

  _bearingAnimation = _bearingTween.curvedAnimate(
    controller: _locationCtrller,
    curve: description.curve,
  );

  _rippleCtrller = AnimationController(
    vsync: description.vsync,
    duration: description.rippleDuration,
  )
    ..addStatusListener(_rippleStatusListener)
    ..addListener(_rippleListener);

  _radiusTween = Tween<double>(begin: 0, end: description.rippleRadius);

  _radiusAnimation = _radiusTween.curvedAnimate(
      curve: Curves.linear, controller: _rippleCtrller);

  _colorAnimation = ColorTween(
    begin: description.rippleColor.withOpacity(1.0),
    end: description.rippleColor.withOpacity(0.0),
  ).curvedAnimate(curve: Curves.ease, controller: _rippleCtrller);

  _locationCtrller.addListener(_locationListener);
  _locationCtrller.addStatusListener(_statusListener);

  _locationAnimation = _locationTween.curvedAnimate(
    controller: _locationCtrller,
    curve: description.curve,
  );

  _proxyAnim = ProxyAnimationGeneric<ILatLng>(_locationAnimation);
  if (_locationTween.isRipple) _rippleCtrller.forward(from: 0);
}