mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
Clean up text field typography (#4011)
This commit is contained in:
parent
53b1bec42b
commit
757baf0290
5 changed files with 8 additions and 7 deletions
|
@ -24,6 +24,7 @@ import com.x8bit.bitwarden.R
|
|||
import com.x8bit.bitwarden.ui.platform.base.util.mirrorIfRtl
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.tabNavigation
|
||||
import com.x8bit.bitwarden.ui.platform.components.button.BitwardenStandardIconButton
|
||||
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
|
||||
|
||||
/**
|
||||
* Represents a Bitwarden styled [TopAppBar] that assumes the following components:
|
||||
|
@ -74,6 +75,7 @@ fun BitwardenSearchTopAppBar(
|
|||
focusedIndicatorColor = Color.Transparent,
|
||||
unfocusedIndicatorColor = Color.Transparent,
|
||||
),
|
||||
textStyle = BitwardenTheme.typography.bodyLarge,
|
||||
placeholder = { Text(text = placeholder) },
|
||||
value = searchTerm,
|
||||
singleLine = true,
|
||||
|
|
|
@ -27,7 +27,7 @@ fun BitwardenHiddenPasswordField(
|
|||
) {
|
||||
OutlinedTextField(
|
||||
modifier = modifier,
|
||||
textStyle = BitwardenTheme.typography.bodyLarge,
|
||||
textStyle = BitwardenTheme.typography.sensitiveInfoSmall,
|
||||
label = { Text(text = label) },
|
||||
value = value,
|
||||
onValueChange = { },
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.platform.components.field
|
|||
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.LocalTextStyle
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
|
@ -61,7 +60,7 @@ fun BitwardenTextField(
|
|||
singleLine: Boolean = true,
|
||||
readOnly: Boolean = false,
|
||||
enabled: Boolean = true,
|
||||
textStyle: TextStyle? = null,
|
||||
textStyle: TextStyle = BitwardenTheme.typography.bodyLarge,
|
||||
shouldAddCustomLineBreaks: Boolean = false,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
isError: Boolean = false,
|
||||
|
@ -70,12 +69,11 @@ fun BitwardenTextField(
|
|||
) {
|
||||
var widthPx by remember { mutableIntStateOf(0) }
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
val currentTextStyle = textStyle ?: LocalTextStyle.current
|
||||
val formattedText = if (shouldAddCustomLineBreaks) {
|
||||
value.withLineBreaksAtWidth(
|
||||
// Adjust for built in padding
|
||||
widthPx = widthPx - 16.dp.toPx(),
|
||||
monospacedTextStyle = currentTextStyle,
|
||||
monospacedTextStyle = textStyle,
|
||||
)
|
||||
} else {
|
||||
value
|
||||
|
@ -114,7 +112,7 @@ fun BitwardenTextField(
|
|||
onValueChange = onValueChange,
|
||||
singleLine = singleLine,
|
||||
readOnly = readOnly,
|
||||
textStyle = currentTextStyle,
|
||||
textStyle = textStyle,
|
||||
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
|
||||
isError = isError,
|
||||
visualTransformation = visualTransformation,
|
||||
|
|
|
@ -49,7 +49,7 @@ fun BitwardenTextFieldWithActions(
|
|||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
textStyle: TextStyle? = null,
|
||||
textStyle: TextStyle = BitwardenTheme.typography.bodyLarge,
|
||||
shouldAddCustomLineBreaks: Boolean = false,
|
||||
visualTransformation: VisualTransformation = VisualTransformation.None,
|
||||
readOnly: Boolean = false,
|
||||
|
|
|
@ -74,6 +74,7 @@ fun BitwardenSlider(
|
|||
) {
|
||||
OutlinedTextField(
|
||||
value = sliderValue.toString(),
|
||||
textStyle = BitwardenTheme.typography.bodyLarge,
|
||||
readOnly = true,
|
||||
onValueChange = { },
|
||||
label = {
|
||||
|
|
Loading…
Reference in a new issue