Skip to content

Commit

Permalink
Added keyboard options for text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sirekanian committed Feb 3, 2024
1 parent 607e04d commit cf6ca3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -125,7 +126,10 @@ fun AddServerContent(router: Router) {
isError = state.error.isNotEmpty(),
supportingText = { Text(state.error) },
maxLines = 4,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Uri,
imeAction = ImeAction.Done,
),
keyboardActions = KeyboardActions(onDone = { state.onAddClicked() }),
)
LaunchedEffect(Unit) {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/sirekanyan/outline/ui/RenameContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -18,6 +19,7 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -102,6 +104,7 @@ fun RenameContent(
placeholder = { Text(defaultName) },
isError = state.error.isNotEmpty(),
supportingText = { Text(state.error) },
keyboardOptions = KeyboardOptions(KeyboardCapitalization.Words),
maxLines = 4,
)
LaunchedEffect(Unit) {
Expand Down

0 comments on commit cf6ca3f

Please sign in to comment.