Add keyBoardOptions parameter to text fields

Set `autoCorrect = false` in incoming and outgoing server settings text fields.
This commit is contained in:
Bernhard Franke-Polz 2023-11-20 20:26:24 +01:00 committed by cketti
parent b7a449abea
commit be7310a5db
4 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package app.k9mail.core.ui.compose.designsystem.atom.textfield
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
@ -21,6 +22,7 @@ fun TextFieldOutlined(
isRequired: Boolean = false,
hasError: Boolean = false,
isSingleLine: Boolean = true,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
) {
MaterialOutlinedTextField(
value = value,
@ -32,6 +34,7 @@ fun TextFieldOutlined(
readOnly = isReadOnly,
isError = hasError,
singleLine = isSingleLine,
keyboardOptions = keyboardOptions,
)
}
@ -52,8 +55,8 @@ internal fun TextFieldOutlinedWithLabelPreview() {
PreviewWithThemes {
TextFieldOutlined(
value = "Input text",
label = "Label",
onValueChange = {},
label = "Label",
)
}
}

View file

@ -2,6 +2,7 @@ package app.k9mail.core.ui.compose.designsystem.molecule.input
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
@ -20,6 +21,7 @@ fun TextInput(
contentPadding: PaddingValues = inputContentPadding(),
isSingleLine: Boolean = true,
isEnabled: Boolean = true,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
) {
InputLayout(
modifier = modifier,
@ -35,6 +37,7 @@ fun TextInput(
hasError = errorMessage != null,
isSingleLine = isSingleLine,
modifier = Modifier.fillMaxWidth(),
keyboardOptions = keyboardOptions,
)
}
}

View file

@ -4,6 +4,7 @@ import android.content.res.Resources
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import app.k9mail.core.ui.compose.designsystem.molecule.input.NumberInput
@ -53,6 +54,7 @@ internal fun LazyListScope.incomingFormItems(
onTextChange = { onEvent(Event.ServerChanged(it)) },
label = stringResource(id = R.string.account_server_settings_server_label),
contentPadding = defaultItemPadding(),
keyboardOptions = KeyboardOptions(autoCorrect = false),
)
}
@ -95,6 +97,7 @@ internal fun LazyListScope.incomingFormItems(
onTextChange = { onEvent(Event.UsernameChanged(it)) },
label = stringResource(id = R.string.account_server_settings_username_label),
contentPadding = defaultItemPadding(),
keyboardOptions = KeyboardOptions(autoCorrect = false),
)
}

View file

@ -4,6 +4,7 @@ import android.content.res.Resources
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import app.k9mail.core.ui.compose.designsystem.molecule.input.NumberInput
@ -42,6 +43,7 @@ internal fun LazyListScope.outgoingFormItems(
label = stringResource(id = R.string.account_server_settings_server_label),
isRequired = true,
contentPadding = defaultItemPadding(),
keyboardOptions = KeyboardOptions(autoCorrect = false),
)
}
@ -87,6 +89,7 @@ internal fun LazyListScope.outgoingFormItems(
label = stringResource(id = R.string.account_server_settings_username_label),
isRequired = true,
contentPadding = defaultItemPadding(),
keyboardOptions = KeyboardOptions(autoCorrect = false),
)
}
}