-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/add navigation rail catalog home layout (#35)
* feat(mobile-app): Added catalog home layout when navigation rail is displayed and is in tabletop mode
- Loading branch information
Showing
4 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...lin/dev/marlonlom/apps/cappajv/features/catalog_list/screens/TableTopCatalogListScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2024 Marlonlom | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package dev.marlonlom.apps.cappajv.features.catalog_list.screens | ||
|
||
import androidx.compose.foundation.ExperimentalFoundationApi | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ExperimentalLayoutApi | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxHeight | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.safeContentPadding | ||
import androidx.compose.foundation.lazy.LazyListState | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import dev.marlonlom.apps.cappajv.core.database.entities.CatalogItemTuple | ||
import dev.marlonlom.apps.cappajv.features.catalog_list.parts.CatalogListHeadline | ||
import dev.marlonlom.apps.cappajv.features.catalog_list.slots.CatalogCategoriesChipGroup | ||
import dev.marlonlom.apps.cappajv.features.catalog_list.slots.CatalogListBanner | ||
import dev.marlonlom.apps.cappajv.features.catalog_list.slots.CatalogListTuplesSlot | ||
import dev.marlonlom.apps.cappajv.ui.layout.DevicePosture | ||
import dev.marlonlom.apps.cappajv.ui.main.CappajvAppState | ||
|
||
|
||
/** | ||
* TableTop catalog list screen composable ui. | ||
* | ||
* @author marlonlom | ||
* | ||
* @param appState Application ui state. | ||
* @param catalogItemsListState Catalog items lazy list state. | ||
* @param catalogItems Catalog items list. | ||
* @param categories Categories list. | ||
* @param selectedCategory Selected category name. | ||
* @param onSelectedCategoryChanged Action for category selected. | ||
* @param onCatalogItemSelected Action for catalog item selected. | ||
* @param modifier Modifier for this composable. | ||
*/ | ||
@ExperimentalLayoutApi | ||
@ExperimentalFoundationApi | ||
@Composable | ||
fun TableTopCatalogListScreen( | ||
appState: CappajvAppState, | ||
catalogItemsListState: LazyListState, | ||
catalogItems: List<CatalogItemTuple>, | ||
categories: List<String>, | ||
selectedCategory: String, | ||
onSelectedCategoryChanged: (String) -> Unit, | ||
onCatalogItemSelected: (Long) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
val hingeRatio = (appState.devicePosture as DevicePosture.Separating.TableTop).hingeRatio | ||
|
||
Column( | ||
modifier = modifier.fillMaxWidth(), | ||
) { | ||
Row( | ||
modifier = modifier.fillMaxHeight(hingeRatio), | ||
horizontalArrangement = Arrangement.spacedBy(20.dp) | ||
) { | ||
Column(modifier = modifier.fillMaxWidth(0.45f)) { | ||
CatalogListHeadline(appState) | ||
CatalogListBanner(appState) | ||
CatalogCategoriesChipGroup( | ||
categories = categories, | ||
selectedCategory = selectedCategory, | ||
onCategoryChipSelected = { onSelectedCategoryChanged(it) }, | ||
) | ||
} | ||
Column(modifier = modifier.safeContentPadding()) { | ||
CatalogListTuplesSlot( | ||
appState = appState, | ||
catalogItemsListState = catalogItemsListState, | ||
catalogTuples = catalogItems, | ||
onCatalogItemTupleClicked = onCatalogItemSelected, | ||
) | ||
} | ||
} | ||
Row( | ||
modifier = modifier | ||
.fillMaxSize() | ||
.padding(top = 30.dp) | ||
.safeContentPadding() | ||
.background( | ||
MaterialTheme.colorScheme.primaryContainer.copy(alpha = 0.25f) | ||
), | ||
) { | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters