Skip to content

Instantly share code, notes, and snippets.

@AzizaHelmy
Last active November 10, 2023 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AzizaHelmy/4354c01fcab8f789bfe978f13355fb3f to your computer and use it in GitHub Desktop.
Save AzizaHelmy/4354c01fcab8f789bfe978f13355fb3f to your computer and use it in GitHub Desktop.
package presentation.meals
class MealsScreen(private val cuisineId: String, private val cuisineName: String) :
BaseScreen<MealsScreenModel, MealsUiState, MealsUiEffect, MealsInteractionListener>() {
@Composable
override fun Content() {
initScreen(getScreenModel { parametersOf(cuisineId, cuisineName) })
}
@OptIn(ExperimentalResourceApi::class)
@Composable
private fun content(
state: MealsUiState,
onMealSelected: (MealUIState) -> Unit,
onBackClicked: () -> Unit,
) {
val meals = state.meals.collectAsLazyPagingItems()
Column(
Modifier.fillMaxSize().background(Theme.colors.background).padding(
getNavigationBarPadding()
)
) {
...
BpPagingList(data = meals) { meal ->
meal?.let {
MealCard(
meal = it,
modifier = Modifier.noRippleEffect { onMealSelected(it) }
)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment