From 57d93a4743b753537ea9523aad959b54904dff55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Tue, 24 Oct 2023 10:54:22 +0200 Subject: [PATCH] Round textfield unless focused --- .../mullvadvpn/compose/screen/LoginScreen.kt | 9 ++++++++- .../compose/textfield/TextFieldColors.kt | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt index d1c64b6c5a15..8f27cf9ebee7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt @@ -183,7 +183,14 @@ private fun LoginContent( left = FocusRequester.Cancel right = FocusRequester.Cancel } - .fillMaxWidth(), + .fillMaxWidth() + .let { + if (!expandedDropdown || uiState.lastUsedAccount == null) { + it.clip(MaterialTheme.shapes.small) + } else { + it + } + }, value = uiState.accountNumberInput, label = { Text( diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt index b45fe5a38a78..b0770632bbec 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import net.mullvad.mullvadvpn.lib.theme.AppTheme import net.mullvad.mullvadvpn.lib.theme.color.Alpha20 +import net.mullvad.mullvadvpn.lib.theme.color.Alpha40 @Composable fun mullvadWhiteTextFieldColors(): TextFieldColors = @@ -27,12 +28,15 @@ fun mullvadWhiteTextFieldColors(): TextFieldColors = errorTextColor = Color.Black, cursorColor = MaterialTheme.colorScheme.background, focusedPlaceholderColor = MaterialTheme.colorScheme.background, - unfocusedPlaceholderColor = MaterialTheme.colorScheme.primary, + unfocusedPlaceholderColor = MaterialTheme.colorScheme.primary.copy(alpha = Alpha40), focusedLabelColor = MaterialTheme.colorScheme.background, disabledLabelColor = Color.Gray, - unfocusedLabelColor = MaterialTheme.colorScheme.background, + unfocusedLabelColor = MaterialTheme.colorScheme.primary.copy(alpha = Alpha40), focusedLeadingIconColor = Color.Black, unfocusedSupportingTextColor = Color.Black, + focusedIndicatorColor = MaterialTheme.colorScheme.onPrimary, + unfocusedIndicatorColor = MaterialTheme.colorScheme.onPrimary, + errorIndicatorColor = MaterialTheme.colorScheme.error ) @Preview @@ -49,7 +53,8 @@ private fun PreviewDarkTextField() { onValueChange = {}, placeholder = { Text(text = "Placeholder") }, label = { Text(text = "Label") }, - colors = mullvadDarkTextFieldColors() + colors = mullvadDarkTextFieldColors(), + shape = MaterialTheme.shapes.small ) // Normal empty @@ -58,7 +63,8 @@ private fun PreviewDarkTextField() { onValueChange = {}, placeholder = { Text(text = "Placeholder") }, label = { Text(text = "Label") }, - colors = mullvadDarkTextFieldColors() + colors = mullvadDarkTextFieldColors(), + shape = MaterialTheme.shapes.small ) // Error