isThereAnySajdaInPage method
Retrieves the Ayah with a Sajda (prostration) on the given page.
This method returns the AyahModel of the first Ayah on the given page that contains a Sajda. If no Sajda is found on the page, the method returns null.
Parameters: pageIndex (int): The index of the page for which to retrieve the Ayah with a Sajda. isSurah (bool): Whether this is being called for a surah display (default: false). surahNumber (int): The surah number if isSurah is true.
Returns:
AyahModel?
: The AyahModel of the first Ayah on the given page that contains a Sajda, or null if no Sajda is found.
Implementation
bool isThereAnySajdaInPage(
int pageIndex,
) {
if (pageIndex > 0 || pageIndex < state.pages.length) {
return state.pages[pageIndex].any((ayah) {
if (ayah.sajda != false) {
if (ayah.sajda is Map) {
var sajdaDetails = ayah.sajda;
if (sajdaDetails['recommended'] == true ||
sajdaDetails['obligatory'] == true) {
return true;
}
} else if (ayah.sajda == true) {
return true;
}
}
return false;
});
}
return false;
}