startAutoScroll method

void startAutoScroll(
  1. int fromPage
)

بدء السكرول التلقائي من الصفحة الحالية

Implementation

void startAutoScroll(int fromPage) {
  state.startPage.value = fromPage;
  state.currentScrollPage.value = fromPage;
  state.isActive.value = true;
  state.isPaused.value = false;

  QuranCtrl.instance.isShowControl.value = false;

  _calculateAndSetTargetPage(fromPage);

  // إنشاء ScrollController جديد — سيتم ربطه بالـ ListView
  _scrollController?.dispose();
  _scrollController = ScrollController();

  // بدء الـ ticker بعد أن يتم بناء الـ ListView
  WidgetsBinding.instance.addPostFrameCallback((_) {
    _startTicker();
  });
}