simple photo viewer

This commit is contained in:
2024-07-16 10:29:37 +03:00
parent 9e09cbb640
commit 1817698031
27 changed files with 484 additions and 278 deletions
@@ -16,6 +16,7 @@ object Profile
fun NavGraphBuilder.profileScreen(
onError: (BaseError) -> Unit,
onSettingsButtonClicked: () -> Unit,
onPhotoClicked: (url: String) -> Unit,
navController: NavController
) {
composable<Profile> {
@@ -25,6 +26,7 @@ fun NavGraphBuilder.profileScreen(
ProfileRoute(
onError = onError,
onSettingsButtonClicked = onSettingsButtonClicked,
onPhotoClicked = onPhotoClicked,
viewModel = viewModel
)
}
@@ -1,5 +1,6 @@
package dev.meloda.fast.profile.presentation
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
@@ -46,6 +47,7 @@ import dev.meloda.fast.ui.R as UiR
fun ProfileRoute(
onError: (BaseError) -> Unit,
onSettingsButtonClicked: () -> Unit,
onPhotoClicked: (url: String) -> Unit,
viewModel: ProfileViewModel = koinViewModel<ProfileViewModelImpl>()
) {
val screenState by viewModel.screenState.collectAsStateWithLifecycle()
@@ -54,8 +56,8 @@ fun ProfileRoute(
ProfileScreen(
screenState = screenState,
baseError = baseError,
onSettingsButtonClicked = onSettingsButtonClicked
onSettingsButtonClicked = onSettingsButtonClicked,
onPhotoClicked = onPhotoClicked
)
}
@@ -66,6 +68,7 @@ fun ProfileScreen(
screenState: ProfileScreenState = ProfileScreenState.EMPTY,
baseError: BaseError? = null,
onSettingsButtonClicked: () -> Unit = {},
onPhotoClicked: (url: String) -> Unit = {}
) {
Scaffold(
topBar = {
@@ -105,7 +108,10 @@ fun ProfileScreen(
AsyncImage(
modifier = Modifier
.size(120.dp)
.clip(CircleShape),
.clip(CircleShape)
.clickable {
onPhotoClicked(screenState.avatarUrl.orEmpty())
},
model = screenState.avatarUrl,
contentDescription = null,
contentScale = ContentScale.Crop,