Skip to content

Commit b28903d

Browse files
committed
feat: Update CartScreen and ListScreen UI
This commit updates the CartScreen and ListScreen UI to improve the user experience. - Updates padding on CartScreen for better layout. - Centers items horizontally within the LazyColumn. - Updates padding on ListScreen for better layout. - Updates title style to titleLarge on ListScreen.
1 parent 9b7e77c commit b28903d

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Fruitties/androidApp/src/main/java/com/example/fruitties/android/ui/CartScreen.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import androidx.compose.material3.MaterialTheme
3838
import androidx.compose.material3.Scaffold
3939
import androidx.compose.material3.Text
4040
import androidx.compose.material3.TopAppBarColors
41+
import androidx.compose.material3.TopAppBarDefaults
4142
import androidx.compose.runtime.Composable
4243
import androidx.compose.runtime.collectAsState
4344
import androidx.compose.runtime.getValue
@@ -86,7 +87,7 @@ fun CartScreen(onNavBack: () -> Unit) {
8687
title = {
8788
Text(text = stringResource(R.string.frutties))
8889
},
89-
colors = TopAppBarColors(
90+
colors = TopAppBarDefaults.topAppBarColors(
9091
containerColor = MaterialTheme.colorScheme.primary,
9192
scrolledContainerColor = MaterialTheme.colorScheme.primary,
9293
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
@@ -103,10 +104,10 @@ fun CartScreen(onNavBack: () -> Unit) {
103104
) { paddingValues ->
104105
Column(
105106
modifier = Modifier
106-
.padding(16.dp)
107107
// Support edge-to-edge (required on Android 15)
108108
// https://developer.android.com/develop/ui/compose/layouts/insets#inset-size
109-
.padding(paddingValues),
109+
.padding(paddingValues)
110+
.padding(16.dp),
110111
) {
111112
val cartItemCount = cartState.cartDetails.sumOf { it.count }
112113
Text(

Fruitties/androidApp/src/main/java/com/example/fruitties/android/ui/ListScreen.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ fun ListScreen(onClickViewCart: () -> Unit = {}) {
100100
.padding(horizontal = 16.dp)
101101
// Support edge-to-edge (required on Android 15)
102102
// https://developer.android.com/develop/ui/compose/layouts/insets#inset-size
103-
.padding(paddingValues),
103+
.padding(
104+
// Draw to bottom edge. LazyColumn adds a Spacer for WindowInsets.systemBars.
105+
// No bottom padding.
106+
top = paddingValues.calculateTopPadding(),
107+
start = 16.dp,
108+
end = 16.dp,
109+
),
104110
horizontalAlignment = Alignment.CenterHorizontally,
105111
) {
106112
Button(
@@ -150,7 +156,7 @@ fun FruittieItem(
150156
Text(
151157
text = item.name,
152158
color = MaterialTheme.colorScheme.onBackground,
153-
style = MaterialTheme.typography.titleMedium,
159+
style = MaterialTheme.typography.titleLarge,
154160
maxLines = 1,
155161
overflow = TextOverflow.Ellipsis,
156162
)

Fruitties/iosApp/iosApp/CartView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct CartView : View {
3131
/// and proper initialization of the ViewModel with its required `AppContainer`.
3232
let cartViewModel: CartViewModel = viewModelStoreOwner.value.getCartViewModel(
3333
factory: CartViewModel.companion.Factory,
34-
extras: CartViewModel.creationExtras(appContainer: appContainer.value)
34+
extras: CartViewModel.companion.creationExtras(appContainer: appContainer.value)
3535
)
3636

3737
/// Observes the `cartUiState` `StateFlow` from the `CartViewModel` using SKIE's `Observing` utility.

0 commit comments

Comments
 (0)