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();
  // السلايدر العلوي - ينزل من الأعلى
  // Top slider - slides down from top
  controller = AnimationController(
    vsync: this,
    duration: const Duration(milliseconds: 600),
    reverseDuration: const Duration(milliseconds: 600),
  );
  slideAnim = Tween<Offset>(
    begin: const Offset(0, -1),
    end: Offset.zero,
  ).animate(CurvedAnimation(
    parent: controller,
    curve: Curves.easeOut,
  ));

  // السلايدر السفلي - يصعد من الأسفل
  // Bottom slider - slides up from bottom
  bottomController = AnimationController(
    vsync: this,
    duration: const Duration(milliseconds: 600),
    reverseDuration: const Duration(milliseconds: 600),
  );
  bottomSlideAnim = Tween<Offset>(
    begin: const Offset(0, 1),
    end: Offset.zero,
  ).animate(CurvedAnimation(
    parent: bottomController,
    curve: Curves.easeOut,
  ));

  // متحكم أنيميشن الارتفاع - للتحكم في ارتفاع السلايدر السفلي
  // Height animation controller - for bottom slider height control
  heightController = AnimationController(
    vsync: this,
    duration: const Duration(milliseconds: 600),
    reverseDuration: const Duration(milliseconds: 600),
  );

  // تهيئة أنيميشن الارتفاع مع القيمة الابتدائية
  // Initialize height animation with initial value
  heightAnimation = Tween<double>(
    begin: bottomSliderHeight.value,
    end: bottomSliderHeight.value,
  ).animate(CurvedAnimation(
    parent: heightController,
    curve: Curves.easeInOut,
  ));

  // ربط الأنيميشن بالقيمة الفعلية
  // Link animation to actual value
  heightAnimation.addListener(() {
    bottomSliderHeight.value = heightAnimation.value;
  });

  // متحكم أنيميشن الارتفاع - للتحكم في ارتفاع السلايدر العلوي
  // Height animation controller - for top slider height control
  topHeightController = AnimationController(
    vsync: this,
    duration: const Duration(milliseconds: 600),
    reverseDuration: const Duration(milliseconds: 600),
  );

  // تهيئة أنيميشن الارتفاع للسلايدر العلوي مع القيمة الابتدائية
  // Initialize top height animation with initial value
  topHeightAnimation = Tween<double>(
    begin: topSliderHeight.value,
    end: topSliderHeight.value,
  ).animate(CurvedAnimation(
    parent: topHeightController,
    curve: Curves.easeInOut,
  ));

  // ربط الأنيميشن بالقيمة الفعلية للسلايدر العلوي
  // Link animation to actual value for top slider
  topHeightAnimation.addListener(() {
    topSliderHeight.value = topHeightAnimation.value;
  });

  log('SliderController initialized', name: 'SliderController');
}