getRealQuranPageNumber method

int getRealQuranPageNumber(
  1. int surahPageIndex
)

الحصول على رقم الصفحة الحقيقي في القرآن الكريم Get the real page number in the Quran

Implementation

int getRealQuranPageNumber(int surahPageIndex) {
  if (_surahNumber == null || surahAyahs.isEmpty) return 1;

  // شرح: البحث عن الآية الأولى في الصفحة المحددة
  // Explanation: Find the first ayah in the specified page
  if (surahPageIndex >= 0 && surahPageIndex < surahPages.length) {
    final pageAyahs = surahPages[surahPageIndex].ayahs;
    if (pageAyahs.isNotEmpty) {
      // شرح: إرجاع رقم الصفحة الحقيقي من الآية الأولى
      // Explanation: Return the real page number from the first ayah
      return pageAyahs.first.page;
    }
  }

  // شرح: في حالة عدم وجود آيات، نرجع الصفحة الأولى للسورة
  // Explanation: If no ayahs found, return the first page of the surah
  return surahAyahs.isNotEmpty ? surahAyahs.first.page : 1;
}