diff --git a/app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt b/app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt index fe61548..f6e6c0e 100644 --- a/app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt +++ b/app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt @@ -1,27 +1,18 @@ package eu.steffo.twom.composables.fields -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.text.KeyboardActions -import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.RemoveRedEye import androidx.compose.material.icons.outlined.RemoveRedEye import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.TextField -import androidx.compose.material3.TextFieldColors -import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Shape import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.PasswordVisualTransformation import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.tooling.preview.Preview @@ -33,52 +24,22 @@ fun PasswordField( modifier: Modifier = Modifier, value: String = "", onValueChange: (String) -> Unit = {}, - enabled: Boolean = true, - readOnly: Boolean = false, - textStyle: TextStyle = LocalTextStyle.current, label: @Composable (() -> Unit)? = null, placeholder: @Composable (() -> Unit)? = null, - leadingIcon: @Composable (() -> Unit)? = null, - prefix: @Composable (() -> Unit)? = null, - suffix: @Composable (() -> Unit)? = null, supportingText: @Composable (() -> Unit)? = null, - isError: Boolean = false, - keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions.Default, - singleLine: Boolean = false, - maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE, - minLines: Int = 1, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - shape: Shape = TextFieldDefaults.shape, - colors: TextFieldColors = TextFieldDefaults.colors() ) { var showPassword by rememberSaveable { mutableStateOf(false) } TextField( - // TODO: Is there a better way...? modifier = modifier, value = value, onValueChange = onValueChange, - enabled = enabled, - readOnly = readOnly, - textStyle = textStyle, label = label, placeholder = placeholder, - leadingIcon = leadingIcon, - prefix = prefix, - suffix = suffix, supportingText = supportingText, - isError = isError, - keyboardOptions = keyboardOptions, - keyboardActions = keyboardActions, - singleLine = singleLine, - maxLines = maxLines, - minLines = minLines, - interactionSource = interactionSource, - shape = shape, - colors = colors, + singleLine = true, - visualTransformation = if(showPassword) VisualTransformation.None else PasswordVisualTransformation(), + visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(), trailingIcon = { IconButton( diff --git a/app/src/main/java/eu/steffo/twom/composables/login/LoginForm.kt b/app/src/main/java/eu/steffo/twom/composables/login/LoginForm.kt index c08d80f..1423447 100644 --- a/app/src/main/java/eu/steffo/twom/composables/login/LoginForm.kt +++ b/app/src/main/java/eu/steffo/twom/composables/login/LoginForm.kt @@ -196,7 +196,6 @@ fun LoginForm( Row(Modifier.basePadding()) { PasswordField( modifier = Modifier.fillMaxWidth(), - singleLine = true, value = password, onValueChange = { password = it }, label = {