Fixed if a textColor is set, than also unfocused border color is displayed is displayed in this color
This commit is contained in:
parent
4a180b5970
commit
255cc41dce
|
@ -3,9 +3,7 @@ package net.codinux.banking.ui.forms
|
|||
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.MaterialTheme
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -47,6 +45,8 @@ fun OutlinedTextField(
|
|||
) {
|
||||
val textFieldColors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = Colors.CodinuxSecondaryColor,
|
||||
// a workaround: we assume textStyle is set to change text color, so we set unfocusedBorderColor according to it // TODO: fix by passing textColor to OutlinedTextField
|
||||
unfocusedBorderColor = if (textStyle != LocalTextStyle.current) textStyle.color else MaterialTheme.colors.primary.copy(alpha = ContentAlpha.high),
|
||||
focusedLabelColor = Colors.CodinuxSecondaryColor // does not work
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import androidx.compose.runtime.*
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import net.codinux.banking.ui.config.Colors
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
|
@ -24,7 +23,7 @@ fun <T> Select(
|
|||
var showDropDownMenu by remember { mutableStateOf(false) }
|
||||
|
||||
ExposedDropdownMenuBox(showDropDownMenu, { isExpanded -> showDropDownMenu = isExpanded }, modifier.fillMaxWidth()) {
|
||||
OutlinedTextField(
|
||||
net.codinux.banking.ui.forms.OutlinedTextField(
|
||||
value = getItemDisplayText(selectedItem),
|
||||
onValueChange = { },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
@ -33,9 +32,7 @@ fun <T> Select(
|
|||
readOnly = true,
|
||||
maxLines = 1,
|
||||
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(showDropDownMenu) },
|
||||
leadingIcon = leadingIcon,
|
||||
colors = if (textColor == null) TextFieldDefaults.outlinedTextFieldColors()
|
||||
else TextFieldDefaults.outlinedTextFieldColors(textColor = textColor, unfocusedBorderColor = textColor, unfocusedLabelColor = textColor, placeholderColor = textColor, focusedBorderColor = Colors.CodinuxSecondaryColor)
|
||||
leadingIcon = leadingIcon
|
||||
)
|
||||
|
||||
// due to a bug (still not fixed since 2021) in ExposedDropdownMenu its popup has a maximum width of 800 pixel / 320dp which is too less to fit
|
||||
|
|
Loading…
Reference in New Issue