Skip to content

Commit 9e002a5

Browse files
committed
adjust textfield colors
1 parent 185e4c4 commit 9e002a5

1 file changed

Lines changed: 30 additions & 9 deletions

File tree

  • Examples/OneSignalDemoV2/app/src/main/java/com/onesignal/sdktest/ui/components

Examples/OneSignalDemoV2/app/src/main/java/com/onesignal/sdktest/ui/components/Dialogs.kt

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,20 @@ import androidx.compose.ui.text.input.KeyboardType
1717
import androidx.compose.ui.unit.dp
1818
import androidx.compose.ui.window.Dialog
1919
import androidx.compose.ui.window.DialogProperties
20+
import androidx.compose.ui.graphics.Color
21+
import com.onesignal.sdktest.ui.theme.OneSignalRed
2022
import org.json.JSONObject
2123

24+
private val TextFieldShape = RoundedCornerShape(10.dp)
25+
26+
@Composable
27+
private fun dialogTextFieldColors() = OutlinedTextFieldDefaults.colors(
28+
unfocusedBorderColor = Color(0xFFBDBDBD),
29+
focusedBorderColor = OneSignalRed,
30+
cursorColor = OneSignalRed,
31+
focusedLabelColor = OneSignalRed
32+
)
33+
2234
/**
2335
* Dialog for entering a single value.
2436
*/
@@ -45,7 +57,8 @@ fun SingleInputDialog(
4557
modifier = Modifier.fillMaxWidth(),
4658
keyboardOptions = KeyboardOptions(keyboardType = keyboardType),
4759
singleLine = true,
48-
shape = RoundedCornerShape(10.dp)
60+
shape = TextFieldShape,
61+
colors = dialogTextFieldColors()
4962
)
5063
},
5164
confirmButton = {
@@ -101,15 +114,17 @@ fun PairInputDialog(
101114
label = { Text(keyLabel) },
102115
modifier = Modifier.weight(1f),
103116
singleLine = true,
104-
shape = RoundedCornerShape(10.dp)
117+
shape = TextFieldShape,
118+
colors = dialogTextFieldColors()
105119
)
106120
OutlinedTextField(
107121
value = value,
108122
onValueChange = { value = it },
109123
label = { Text(valueLabel) },
110124
modifier = Modifier.weight(1f),
111125
singleLine = true,
112-
shape = RoundedCornerShape(10.dp)
126+
shape = TextFieldShape,
127+
colors = dialogTextFieldColors()
113128
)
114129
}
115130
Spacer(modifier = Modifier.height(24.dp))
@@ -181,7 +196,8 @@ fun MultiPairInputDialog(
181196
label = { Text(keyLabel) },
182197
modifier = Modifier.weight(1f),
183198
singleLine = true,
184-
shape = RoundedCornerShape(10.dp)
199+
shape = TextFieldShape,
200+
colors = dialogTextFieldColors()
185201
)
186202
OutlinedTextField(
187203
value = value,
@@ -193,7 +209,8 @@ fun MultiPairInputDialog(
193209
label = { Text(valueLabel) },
194210
modifier = Modifier.weight(1f),
195211
singleLine = true,
196-
shape = RoundedCornerShape(10.dp)
212+
shape = TextFieldShape,
213+
colors = dialogTextFieldColors()
197214
)
198215
if (pairs.size > 1) {
199216
IconButton(
@@ -383,7 +400,8 @@ fun OutcomeDialog(
383400
label = { Text("Outcome Name") },
384401
modifier = Modifier.fillMaxWidth(),
385402
singleLine = true,
386-
shape = RoundedCornerShape(10.dp)
403+
shape = TextFieldShape,
404+
colors = dialogTextFieldColors()
387405
)
388406

389407
if (selectedType == 2) {
@@ -395,7 +413,8 @@ fun OutcomeDialog(
395413
modifier = Modifier.fillMaxWidth(),
396414
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
397415
singleLine = true,
398-
shape = RoundedCornerShape(10.dp)
416+
shape = TextFieldShape,
417+
colors = dialogTextFieldColors()
399418
)
400419
}
401420
}
@@ -475,7 +494,8 @@ fun TrackEventDialog(
475494
modifier = Modifier.fillMaxWidth(),
476495
singleLine = true,
477496
isError = eventName.isBlank() && showError,
478-
shape = RoundedCornerShape(10.dp)
497+
shape = TextFieldShape,
498+
colors = dialogTextFieldColors()
479499
)
480500

481501
Spacer(modifier = Modifier.height(10.dp))
@@ -493,7 +513,8 @@ fun TrackEventDialog(
493513
minLines = 2,
494514
maxLines = 4,
495515
isError = !isValueValid && eventValue.isNotBlank(),
496-
shape = RoundedCornerShape(10.dp),
516+
shape = TextFieldShape,
517+
colors = dialogTextFieldColors(),
497518
supportingText = if (!isValueValid && eventValue.isNotBlank()) {
498519
{
499520
Text(

0 commit comments

Comments
 (0)