57 lines
1.9 KiB
Kotlin
57 lines
1.9 KiB
Kotlin
package co.electriccoin.zcash.ui.design.component
|
|
|
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
import androidx.compose.foundation.text.KeyboardActions
|
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
import androidx.compose.material.LocalTextStyle
|
|
import androidx.compose.material.TextFieldDefaults
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.remember
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.text.TextStyle
|
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
|
|
// Material3 does not have its own TextField component yet, so proxy the one from Material 2
|
|
@Suppress("LongParameterList")
|
|
@Composable
|
|
fun TextField(
|
|
value: String,
|
|
onValueChange: (String) -> Unit,
|
|
modifier: Modifier = Modifier,
|
|
enabled: Boolean = true,
|
|
readOnly: Boolean = false,
|
|
textStyle: TextStyle = LocalTextStyle.current,
|
|
label: @Composable (() -> Unit)? = null,
|
|
placeholder: @Composable (() -> Unit)? = null,
|
|
leadingIcon: @Composable (() -> Unit)? = null,
|
|
trailingIcon: @Composable (() -> Unit)? = null,
|
|
isError: Boolean = false,
|
|
visualTransformation: VisualTransformation = VisualTransformation.None,
|
|
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
|
|
keyboardActions: KeyboardActions = KeyboardActions(),
|
|
singleLine: Boolean = false,
|
|
maxLines: Int = Int.MAX_VALUE,
|
|
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
|
|
) {
|
|
androidx.compose.material.TextField(
|
|
value,
|
|
onValueChange,
|
|
modifier,
|
|
enabled,
|
|
readOnly,
|
|
textStyle,
|
|
label,
|
|
placeholder,
|
|
leadingIcon,
|
|
trailingIcon,
|
|
isError,
|
|
visualTransformation,
|
|
keyboardOptions,
|
|
keyboardActions,
|
|
singleLine,
|
|
maxLines,
|
|
interactionSource,
|
|
colors = TextFieldDefaults.textFieldColors()
|
|
)
|
|
}
|