Skip to content
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
18 changes: 14 additions & 4 deletions core/ui/src/main/java/ru/yeahub/core_ui/component/TextField.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ internal fun CoreTextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
textFieldModifier: Modifier = Modifier,
title: String? = null,
placeholder: String? = null,
error: TextOrResource? = null,
readOnly: Boolean = false,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
visualTransformation: VisualTransformation = VisualTransformation.None,
Expand Down Expand Up @@ -162,18 +164,18 @@ internal fun CoreTextField(

Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(4.dp)
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
if (title != null) {
Text(
text = title,
style = Theme.typography.body2Accent,
style = Theme.typography.body7,
color = colors.titleColor
)
}

OutlinedTextField(
modifier = Modifier
modifier = textFieldModifier
.fillMaxWidth()
.onFocusChanged { onFocusChanged(it.isFocused) }
.then(
Expand All @@ -190,13 +192,15 @@ internal fun CoreTextField(
onValueChange(newTextFieldValue.text)
}
},
textStyle = Theme.typography.body7,
readOnly = readOnly,
enabled = enabled,
isError = error != null,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
placeholder = placeholder?.let {
{ Text(text = it, style = Theme.typography.body2, color = colors.placeholderColor) }
{ Text(text = it, style = Theme.typography.body7, color = colors.placeholderColor) }
},
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
Expand Down Expand Up @@ -264,9 +268,11 @@ fun PrimaryTextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
textFieldModifier: Modifier = Modifier,
title: String? = null,
placeholder: String? = null,
error: TextOrResource? = null,
readOnly: Boolean = false,
leadingIcon: Painter? = null,
leadingIconContentDescription: String? = null,
trailingIcon: Painter? = null,
Expand All @@ -284,8 +290,10 @@ fun PrimaryTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier,
textFieldModifier = textFieldModifier,
title = title,
placeholder = placeholder,
readOnly = readOnly,
error = error,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
Expand Down Expand Up @@ -346,6 +354,7 @@ fun SearchTextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
textFieldModifier: Modifier = Modifier,
title: String? = null,
placeholder: String,
suggestions: List<String>,
Expand All @@ -366,6 +375,7 @@ fun SearchTextField(
value = value,
title = title,
onValueChange = onValueChange,
textFieldModifier = textFieldModifier,
placeholder = placeholder,
enabled = enabled,
colors = colors,
Expand Down
Loading