selectRecitation method
اختيار قراءة/خط المصحف باستخدام QuranRecitation كمصدر الحقيقة.
خطوط التجويد تُحمّل ديناميكيًا عبر QuranFontsService عند الاختيار.
Implementation
Future<void> selectRecitation(
QuranRecitation recitation, {
bool isFontsLocal = false,
}) async {
final int idx = recitation.recitationIndex;
if (state.fontsSelected.value == idx) {
return;
}
state.fontsSelected.value = idx;
GetStorage().write(_StorageConstants().fontsSelected, idx);
Get.forceAppUpdate();
if (idx == 0 && !QuranFontsService.allLoaded) {
// خطوط التجويد: تحميل كسول — الصفحات القريبة أولاً ثم البقية في الخلفية
final currentPage = lastPage.clamp(1, 604);
QuranFontsService.ensurePagesLoaded(currentPage, radius: 10).then((_) {
// update();
// update(['_pageViewBuild']);
// تحميل بقية الصفحات في الخلفية
QuranFontsService.loadRemainingInBackground(
startNearPage: currentPage,
progress: state.fontsLoadProgress,
ready: state.fontsReady,
).then((_) {
// update();
update(['_pageViewBuild']);
});
});
}
}