getSajdaInfoForPage method

bool getSajdaInfoForPage(
  1. List<AyahFontsModel> pageAyahs
)

Determines if there is a Sajda (prostration) on the given page of Ayahs.

This function iterates through a list of AyahFontsModel representing Ayahs on a page, checking if any Ayah contains a Sajda. If a Sajda is found, and it is either recommended or obligatory, the function updates the application state to indicate the presence of a Sajda on the page.

Parameters: pageAyahs (List<AyahFontsModel>): The list of Ayahs to check for Sajda.

Returns: bool: A boolean value indicating whether a Sajda is present on the page.

Implementation

bool getSajdaInfoForPage(List<AyahFontsModel> pageAyahs) {
  for (var ayah in pageAyahs) {
    if (ayah.sajda != false && ayah.sajda is Map) {
      var sajdaDetails = ayah.sajda;
      if (sajdaDetails['recommended'] == true ||
          sajdaDetails['obligatory'] == true) {
        return state.isSajda.value = true;
      }
    }
  }
  // No sajda found on this page
  return state.isSajda.value = false;
}