Skip to content

Commit 64be347

Browse files
committed
ui(profile, apps): Refine appearance and improve layout for installed apps
This commit updates the UI components across the profile and apps features to enhance visual consistency and layout. It introduces `ExpressiveCard` for a more modern look, adjusts spacing and corner radii, and improves the `AppsRoot` screen with better bottom navigation awareness. - **ui(profile)**: Reduced vertical spacing in the appearance section from 16dp to 12dp. - **ui(profile)**: Increased `RoundedCornerShape` values (16dp to 24dp for theme previews, 20dp to 32dp for cards) to match the new expressive design. - **ui(apps)**: Refactored `AppItem` to use `ExpressiveCard` and updated its layout with larger avatars (64dp) and bold typography. - **ui(apps)**: Added `LocalBottomNavigationHeight` integration to provide proper padding for the `SnackbarHost` and list content, preventing overlap with navigation. - **ui(apps)**: Removed the back navigation icon from the `TopAppBar` in the apps root. - **ui(apps)**: Enhanced empty state styling with specific typography and colors. - **refactor(apps)**: Standardized card shapes and colors using `ElevatedCard` with a `surfaceContainer` background and 32dp rounded corners.
1 parent 754831b commit 64be347

2 files changed

Lines changed: 55 additions & 29 deletions

File tree

  • feature
    • apps/presentation/src/commonMain/kotlin/zed/rainxch/apps/presentation
    • profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/components/sections

feature/apps/presentation/src/commonMain/kotlin/zed/rainxch/apps/presentation/AppsRoot.kt

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.width
1818
import androidx.compose.foundation.lazy.LazyColumn
1919
import androidx.compose.foundation.lazy.items
2020
import androidx.compose.foundation.shape.CircleShape
21+
import androidx.compose.foundation.shape.RoundedCornerShape
2122
import androidx.compose.material.icons.Icons
2223
import androidx.compose.material.icons.automirrored.filled.ArrowBack
2324
import androidx.compose.material.icons.automirrored.filled.OpenInNew
@@ -31,8 +32,10 @@ import androidx.compose.material.icons.outlined.DeleteOutline
3132
import androidx.compose.material3.Button
3233
import androidx.compose.material3.ButtonDefaults
3334
import androidx.compose.material3.Card
35+
import androidx.compose.material3.CardDefaults
3436
import androidx.compose.material3.CircularProgressIndicator
3537
import androidx.compose.material3.CircularWavyProgressIndicator
38+
import androidx.compose.material3.ElevatedCard
3639
import androidx.compose.material3.ExperimentalMaterial3Api
3740
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
3841
import androidx.compose.material3.Icon
@@ -69,6 +72,7 @@ import org.koin.compose.viewmodel.koinViewModel
6972
import zed.rainxch.apps.presentation.model.AppItem
7073
import zed.rainxch.apps.presentation.model.UpdateAllProgress
7174
import zed.rainxch.apps.presentation.model.UpdateState
75+
import zed.rainxch.core.presentation.locals.LocalBottomNavigationHeight
7276
import zed.rainxch.core.presentation.locals.LocalBottomNavigationLiquid
7377
import zed.rainxch.core.presentation.theme.GithubStoreTheme
7478
import zed.rainxch.core.presentation.utils.ObserveAsEvents
@@ -127,19 +131,11 @@ fun AppsScreen(
127131
snackbarHostState: SnackbarHostState
128132
) {
129133
val liquidState = LocalBottomNavigationLiquid.current
134+
val bottomNavHeight = LocalBottomNavigationHeight.current
135+
130136
Scaffold(
131137
topBar = {
132138
TopAppBar(
133-
navigationIcon = {
134-
IconButton(
135-
onClick = { onAction(AppsAction.OnNavigateBackClick) }
136-
) {
137-
Icon(
138-
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
139-
contentDescription = stringResource(Res.string.navigate_back)
140-
)
141-
}
142-
},
143139
title = {
144140
Text(
145141
text = stringResource(Res.string.installed_apps),
@@ -161,7 +157,10 @@ fun AppsScreen(
161157
)
162158
},
163159
snackbarHost = {
164-
SnackbarHost(snackbarHostState)
160+
SnackbarHost(
161+
hostState = snackbarHostState,
162+
modifier = Modifier.padding(bottomNavHeight + 16.dp)
163+
)
165164
},
166165
modifier = Modifier.liquefiable(liquidState)
167166
) { innerPadding ->
@@ -247,7 +246,9 @@ fun AppsScreen(
247246
if (state.isUpdatingAll && state.updateAllProgress != null) {
248247
UpdateAllProgressCard(
249248
progress = state.updateAllProgress,
250-
onCancel = { onAction(AppsAction.OnCancelUpdateAll) }
249+
onCancel = {
250+
onAction(AppsAction.OnCancelUpdateAll)
251+
}
251252
)
252253
}
253254

@@ -266,7 +267,11 @@ fun AppsScreen(
266267
modifier = Modifier.fillMaxSize(),
267268
contentAlignment = Alignment.Center
268269
) {
269-
Text(stringResource(Res.string.no_apps_found))
270+
Text(
271+
text = stringResource(Res.string.no_apps_found),
272+
style = MaterialTheme.typography.titleMedium,
273+
color = MaterialTheme.colorScheme.onBackground
274+
)
270275
}
271276
}
272277

@@ -290,6 +295,10 @@ fun AppsScreen(
290295
modifier = Modifier.liquefiable(liquidState)
291296
)
292297
}
298+
299+
item {
300+
Spacer(Modifier.height(bottomNavHeight + 32.dp))
301+
}
293302
}
294303
}
295304
}
@@ -365,22 +374,20 @@ fun AppItemCard(
365374
) {
366375
val app = appItem.installedApp
367376

368-
Card(
369-
modifier = modifier.fillMaxWidth()
370-
) {
377+
ExpressiveCard {
371378
Column(
372-
modifier = Modifier.padding(16.dp)
379+
modifier = modifier
380+
.padding(16.dp)
381+
.clickable { onRepoClick() }
373382
) {
374383
Row(
375-
modifier = Modifier
376-
.fillMaxWidth()
377-
.clickable { onRepoClick() },
384+
modifier = Modifier.fillMaxWidth(),
378385
horizontalArrangement = Arrangement.spacedBy(12.dp)
379386
) {
380387
CoilImage(
381388
imageModel = { app.repoOwnerAvatarUrl },
382389
modifier = Modifier
383-
.size(48.dp)
390+
.size(64.dp)
384391
.clip(CircleShape),
385392
loading = {
386393
Box(
@@ -395,7 +402,9 @@ fun AppItemCard(
395402
Column(modifier = Modifier.weight(1f)) {
396403
Text(
397404
text = app.appName,
398-
style = MaterialTheme.typography.titleMedium
405+
style = MaterialTheme.typography.titleMedium,
406+
color = MaterialTheme.colorScheme.onSurface,
407+
fontWeight = FontWeight.Bold
399408
)
400409

401410
Text(
@@ -412,13 +421,15 @@ fun AppItemCard(
412421
color = MaterialTheme.colorScheme.tertiary
413422
)
414423
}
424+
415425
app.isUpdateAvailable -> {
416426
Text(
417427
text = "${app.installedVersion}${app.latestVersion}",
418428
style = MaterialTheme.typography.bodySmall,
419429
color = MaterialTheme.colorScheme.primary
420430
)
421431
}
432+
422433
else -> {
423434
Text(
424435
text = app.installedVersion,
@@ -435,7 +446,7 @@ fun AppItemCard(
435446

436447
Text(
437448
text = app.repoDescription!!,
438-
style = MaterialTheme.typography.bodySmall,
449+
style = MaterialTheme.typography.bodyMediumEmphasized,
439450
maxLines = 2,
440451
overflow = TextOverflow.Ellipsis
441452
)
@@ -528,8 +539,7 @@ fun AppItemCard(
528539
)
529540
}
530541

531-
UpdateState.Idle -> {
532-
}
542+
UpdateState.Idle -> {}
533543
}
534544

535545
Spacer(Modifier.height(12.dp))
@@ -556,6 +566,7 @@ fun AppItemCard(
556566
}
557567

558568
Button(
569+
shapes = ButtonDefaults.shapes(),
559570
onClick = onOpenClick,
560571
modifier = Modifier.weight(1f),
561572
enabled = !app.isPendingInstall &&
@@ -635,6 +646,21 @@ private fun formatLastChecked(timestamp: Long): String {
635646
}
636647
}
637648

649+
@Composable
650+
private fun ExpressiveCard(
651+
modifier: Modifier = Modifier,
652+
content: @Composable () -> Unit
653+
) {
654+
ElevatedCard(
655+
modifier = modifier.fillMaxWidth(),
656+
colors = CardDefaults.elevatedCardColors(
657+
containerColor = MaterialTheme.colorScheme.surfaceContainer
658+
),
659+
shape = RoundedCornerShape(32.dp),
660+
content = { content() }
661+
)
662+
}
663+
638664
@Preview
639665
@Composable
640666
private fun Preview() {

feature/profile/presentation/src/commonMain/kotlin/zed/rainxch/profile/presentation/components/sections/Appearance.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fun LazyListScope.appearanceSection(
8484
}
8585
)
8686

87-
VerticalSpacer(16.dp)
87+
VerticalSpacer(12.dp)
8888

8989
ThemeColorCard(
9090
selectedThemeColor = state.selectedThemeColor,
@@ -137,7 +137,7 @@ private fun ThemeSelectionCard(
137137
isDarkTheme: Boolean?,
138138
onDarkThemeChange: (Boolean?) -> Unit
139139
) {
140-
ExpressiveCard {
140+
ExpressiveCard{
141141
Row(
142142
modifier = Modifier
143143
.fillMaxWidth()
@@ -192,7 +192,7 @@ private fun ThemeModeOption(
192192
Column(
193193
modifier = modifier
194194
.scale(scale)
195-
.clip(RoundedCornerShape(16.dp))
195+
.clip(RoundedCornerShape(24.dp))
196196
.background(
197197
if (isSelected) {
198198
MaterialTheme.colorScheme.primaryContainer
@@ -410,7 +410,7 @@ private fun ExpressiveCard(
410410
colors = CardDefaults.elevatedCardColors(
411411
containerColor = MaterialTheme.colorScheme.surfaceContainer
412412
),
413-
shape = RoundedCornerShape(20.dp),
413+
shape = RoundedCornerShape(32.dp),
414414
content = { content() }
415415
)
416416
}

0 commit comments

Comments
 (0)