@@ -29,14 +29,17 @@ import androidx.compose.ui.tooling.preview.Preview
29
29
import net.mullvad.mullvadvpn.R
30
30
import net.mullvad.mullvadvpn.lib.theme.AppTheme
31
31
import net.mullvad.mullvadvpn.lib.theme.Dimens
32
- import net.mullvad.mullvadvpn.lib.theme.color.MullvadWhite10
33
32
34
33
@Preview
35
34
@Composable
36
35
private fun PreviewSearchTextField () {
37
36
AppTheme {
38
37
Column (modifier = Modifier .background(color = MaterialTheme .colorScheme.background)) {
39
- SearchTextField (placeHolder = " Search for..." ) {}
38
+ SearchTextField (
39
+ placeHolder = " Search for..." ,
40
+ backgroundColor = MaterialTheme .colorScheme.tertiaryContainer,
41
+ textColor = MaterialTheme .colorScheme.onTertiaryContainer,
42
+ ) {}
40
43
}
41
44
}
42
45
}
@@ -46,7 +49,8 @@ private fun PreviewSearchTextField() {
46
49
fun SearchTextField (
47
50
modifier : Modifier = Modifier ,
48
51
placeHolder : String = stringResource(id = R .string.search_placeholder),
49
- backgroundColor : Color = MullvadWhite10 ,
52
+ backgroundColor : Color ,
53
+ textColor : Color ,
50
54
enabled : Boolean = true,
51
55
singleLine : Boolean = true,
52
56
interactionSource : MutableInteractionSource = remember { MutableInteractionSource () },
@@ -57,14 +61,13 @@ fun SearchTextField(
57
61
58
62
BasicTextField (
59
63
value = searchTerm,
60
- textStyle =
61
- MaterialTheme .typography.labelLarge.copy(color = MaterialTheme .colorScheme.onSecondary),
64
+ textStyle = MaterialTheme .typography.labelLarge.copy(color = textColor),
62
65
onValueChange = { text: String ->
63
66
searchTerm = text
64
67
onValueChange.invoke(text)
65
68
},
66
69
singleLine = singleLine,
67
- cursorBrush = SolidColor (MaterialTheme .colorScheme.onSecondary ),
70
+ cursorBrush = SolidColor (textColor ),
68
71
decorationBox =
69
72
@Composable { innerTextField ->
70
73
TextFieldDefaults .DecorationBox (
@@ -83,8 +86,7 @@ fun SearchTextField(
83
86
width = Dimens .searchIconSize,
84
87
height = Dimens .searchIconSize,
85
88
),
86
- colorFilter =
87
- ColorFilter .tint(color = MaterialTheme .colorScheme.onSecondary),
89
+ colorFilter = ColorFilter .tint(color = textColor),
88
90
)
89
91
},
90
92
placeholder = {
@@ -106,15 +108,15 @@ fun SearchTextField(
106
108
shape = MaterialTheme .shapes.medium,
107
109
colors =
108
110
TextFieldDefaults .colors(
109
- focusedTextColor = MaterialTheme .colorScheme.onSecondary ,
110
- unfocusedTextColor = MaterialTheme .colorScheme.onSecondary ,
111
+ focusedTextColor = textColor ,
112
+ unfocusedTextColor = textColor ,
111
113
focusedContainerColor = backgroundColor,
112
114
unfocusedContainerColor = backgroundColor,
113
115
focusedIndicatorColor = Color .Transparent ,
114
116
unfocusedIndicatorColor = Color .Transparent ,
115
- cursorColor = MaterialTheme .colorScheme.onSecondary ,
116
- focusedPlaceholderColor = MaterialTheme .colorScheme.onSecondary ,
117
- unfocusedPlaceholderColor = MaterialTheme .colorScheme.onSecondary
117
+ cursorColor = textColor ,
118
+ focusedPlaceholderColor = textColor ,
119
+ unfocusedPlaceholderColor = textColor
118
120
),
119
121
contentPadding = PaddingValues (),
120
122
)
0 commit comments