getAyahWithSajdaInPage method
Retrieves the Ayah with a Sajda (prostration) on the given page.
This method returns the AyahFontsModel 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.
Returns:
AyahFontsModel?: The AyahFontsModel of the first Ayah on the given page that contains a Sajda, or null if no Sajda is found.
Implementation
AyahFontsModel? getAyahWithSajdaInPage(int pageIndex) =>
state.pages[pageIndex].firstWhereOrNull((ayah) {
if (ayah.sajda != false) {
if (ayah.sajda is Map) {
var sajdaDetails = ayah.sajda;
if (sajdaDetails['recommended'] == true ||
sajdaDetails['obligatory'] == true) {
return state.isSajda.value = true;
}
} else {
return ayah.sajda == true;
}
}
return state.isSajda.value = false;
});