onInit method

  1. @override
void onInit()
override

Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.

Implementation

@override
void onInit() {
  super.onInit();
  final motion = Get.isRegistered<MotionController>()
      ? Get.find<MotionController>()
      : null;
  final speed = motion?.speedMultiplier ?? 1.0;

  resetController = AnimationController(
    vsync: this,
    duration: Duration(milliseconds: (300 / speed).round()),
  );

  activeTween = Tween<double>(begin: 0.0, end: 0.0);
  resetController.addListener(() {
    pullOffset.value = activeTween.evaluate(resetController);
  });

  tickerController = AnimationController(
    vsync: this,
    duration: Duration(
        milliseconds:
            (duration.inMilliseconds / (speed * animationSpeed)).round()),
  );
}