#18 Move to edit screen on click
This commit is contained in:
parent
3900e3c18a
commit
3ff4f82298
7 changed files with 58 additions and 18 deletions
|
@ -2,7 +2,6 @@ package be.ugent.sel.studeez.screens.navbar
|
|||
|
||||
import be.ugent.sel.studeez.domain.AccountDAO
|
||||
import be.ugent.sel.studeez.domain.LogService
|
||||
import be.ugent.sel.studeez.navigation.StudeezDestinations
|
||||
import be.ugent.sel.studeez.navigation.StudeezDestinations.HOME_SCREEN
|
||||
import be.ugent.sel.studeez.navigation.StudeezDestinations.PROFILE_SCREEN
|
||||
import be.ugent.sel.studeez.screens.StudeezViewModel
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package be.ugent.sel.studeez.screens.profile
|
||||
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import be.ugent.sel.studeez.R
|
||||
import be.ugent.sel.studeez.common.composable.SecondaryScreenTemplate
|
||||
import be.ugent.sel.studeez.resources
|
||||
import be.ugent.sel.studeez.ui.theme.StudeezTheme
|
||||
|
||||
@Composable
|
||||
fun EditProfileScreen(
|
||||
goBack: () -> Unit
|
||||
) {
|
||||
SecondaryScreenTemplate(
|
||||
title = resources().getString(R.string.editing_profile),
|
||||
popUp = goBack
|
||||
) {
|
||||
Text(text = "TODO")
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun EditProfileScreenComposable() {
|
||||
StudeezTheme {
|
||||
EditProfileScreen {
|
||||
{}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,15 +27,17 @@ fun ProfileScreen(
|
|||
title = resources().getString(AppText.profile),
|
||||
open = open,
|
||||
openAndPopUp = openAndPopUp,
|
||||
action = { EditAction() }
|
||||
action = { EditAction { viewModel.onEditProfileClick(open) } }
|
||||
) {
|
||||
Headline(text = (username ?: resources().getString(R.string.no_username)))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EditAction() {
|
||||
IconButton(onClick = { /*TODO*/ }) {
|
||||
fun EditAction(
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
IconButton(onClick = onClick) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Edit,
|
||||
contentDescription = resources().getString(AppText.edit_profile)
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
package be.ugent.sel.studeez.screens.profile
|
||||
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import be.ugent.sel.studeez.R
|
||||
import be.ugent.sel.studeez.domain.LogService
|
||||
import be.ugent.sel.studeez.domain.UserDAO
|
||||
import be.ugent.sel.studeez.resources
|
||||
import be.ugent.sel.studeez.navigation.StudeezDestinations
|
||||
import be.ugent.sel.studeez.screens.StudeezViewModel
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
|
@ -27,4 +17,8 @@ class ProfileViewModel @Inject constructor(
|
|||
return userDAO.getUsername()
|
||||
}
|
||||
|
||||
fun onEditProfileClick(open: (String) -> Unit) {
|
||||
open(StudeezDestinations.EDIT_PROFILE_SCREEN)
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue