Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 We have made some modifications to the profile card screen so that focus is handled appropriately. #924

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -78,6 +79,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.testTag
Expand Down Expand Up @@ -231,6 +233,7 @@ internal fun ProfileCardScreen(
val snackbarHostState = remember { SnackbarHostState() }
val layoutDirection = LocalLayoutDirection.current
val keyboardController = LocalSoftwareKeyboardController.current
val focusManager = LocalFocusManager.current

SnackbarMessageEffect(
snackbarHostState = snackbarHostState,
Expand All @@ -256,6 +259,7 @@ internal fun ProfileCardScreen(
.pointerInput(Unit) {
detectTapGestures {
keyboardController?.hide()
focusManager.clearFocus()
}
},
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
Expand Down Expand Up @@ -387,6 +391,8 @@ internal fun EditScreen(
}
}

val focusManager = LocalFocusManager.current

Column(
modifier = modifier
.fillMaxWidth()
Expand Down Expand Up @@ -436,6 +442,11 @@ internal fun EditScreen(
imeAction = ImeAction.Done,
keyboardType = KeyboardType.Uri,
),
keyboardActions = KeyboardActions(
onDone = {
focusManager.clearFocus()
},
),
)

Column(
Expand Down Expand Up @@ -520,6 +531,7 @@ private fun InputFieldWithError(
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
maxLines: Int = 1,
) {
Column(modifier = modifier) {
Expand All @@ -539,6 +551,7 @@ private fun InputFieldWithError(
isError = isError,
shape = RoundedCornerShape(4.dp),
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
maxLines = maxLines,
modifier = Modifier
.indicatorLine(
Expand Down
Loading