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() async {
  super.onInit();
  state.currentPageNumber.value = _quranRepository.getLastPage() ?? 1;
  junpTolastPage();

  // QuranFontsService.ensurePagesLoaded(state.currentPageNumber.value,
  //         radius: 5)
  //     .then((_) {
  //   // quranCtrl.update();
  //   // update(['_pageViewBuild']);
  //   // تحميل بقية الصفحات في الخلفية
  //   QuranFontsService.loadRemainingInBackground(
  //     startNearPage: state.currentPageNumber.value,
  //     progress: state.fontsLoadProgress,
  //     ready: state.fontsReady,
  //   ).then((_) {
  //     // update();
  //     update(['_pageViewBuild']);
  //   });
  // });

  // ضمان تحميل بيانات المصحف حتى لو لم يتم استدعاء QuranLibrary.init() في التطبيق المضيف.
  // نطلقها بشكل غير متزامن لتجنب إبطاء onInit.
  Future(() => ensureCoreDataLoaded());

  // تحميل آخر وضع عرض محفوظ
  // Load saved display mode
  loadSavedDisplayMode();

  searchFocusNode = FocusNode();
  searchTextController = TextEditingController();
}