Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round textfield unless showing dropdown #5353

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading