diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/OutlinedTextField.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/OutlinedTextField.kt index 055a6fd..23d70be 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/OutlinedTextField.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/OutlinedTextField.kt @@ -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 ) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/Select.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/Select.kt index 7c276d1..393303e 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/Select.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/forms/Select.kt @@ -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 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 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