Skip to content

Commit c5317ee

Browse files
committed
fix: enable custom color
1 parent d3c6318 commit c5317ee

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

app/src/main/java/to/bitkit/ui/components/Button.kt

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ enum class ButtonSize {
4949
}
5050
}
5151

52-
@Suppress("UnusedParameter")
5352
@Composable
5453
fun PrimaryButton(
5554
text: String?,
@@ -60,7 +59,7 @@ fun PrimaryButton(
6059
size: ButtonSize = ButtonSize.Large,
6160
enabled: Boolean = true,
6261
fullWidth: Boolean = true,
63-
color: Color = Colors.White16, // Deprecated: Color customization no longer supported
62+
color: Color? = null,
6463
) {
6564
val contentPadding = PaddingValues(horizontal = size.horizontalPadding.takeIf { text != null } ?: 0.dp)
6665
val buttonShape = MaterialTheme.shapes.large
@@ -86,36 +85,37 @@ fun PrimaryButton(
8685
.requiredHeight(size.height)
8786
.primaryButtonStyle(
8887
isEnabled = enabled && !isLoading,
89-
shape = buttonShape
88+
shape = buttonShape,
89+
primaryColor = color
9090
)
9191
.padding(contentPadding)
9292
) {
93-
if (isLoading) {
94-
CircularProgressIndicator(
95-
color = Colors.White32,
96-
strokeWidth = 2.dp,
97-
modifier = Modifier.size(size.height / 2)
98-
)
99-
} else {
100-
Row(
101-
verticalAlignment = Alignment.CenterVertically,
102-
horizontalArrangement = Arrangement.spacedBy(8.dp),
103-
) {
104-
if (icon != null) {
105-
Box(modifier = if (enabled) Modifier else Modifier.alpha(0.5f)) {
106-
icon()
93+
if (isLoading) {
94+
CircularProgressIndicator(
95+
color = Colors.White32,
96+
strokeWidth = 2.dp,
97+
modifier = Modifier.size(size.height / 2)
98+
)
99+
} else {
100+
Row(
101+
verticalAlignment = Alignment.CenterVertically,
102+
horizontalArrangement = Arrangement.spacedBy(8.dp),
103+
) {
104+
if (icon != null) {
105+
Box(modifier = if (enabled) Modifier else Modifier.alpha(0.5f)) {
106+
icon()
107+
}
108+
}
109+
text?.let {
110+
Text(
111+
text = text,
112+
maxLines = 1,
113+
overflow = TextOverflow.Ellipsis,
114+
)
107115
}
108-
}
109-
text?.let {
110-
Text(
111-
text = text,
112-
maxLines = 1,
113-
overflow = TextOverflow.Ellipsis,
114-
)
115116
}
116117
}
117118
}
118-
}
119119
}
120120
}
121121

app/src/main/java/to/bitkit/ui/settings/backups/ShowMnemonicScreen.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ private fun ShowMnemonicContent(
168168
text = stringResource(R.string.security__mnemonic_reveal),
169169
fullWidth = false,
170170
onClick = onRevealClick,
171-
color = Colors.Black50,
172171
modifier = Modifier
173172
.alpha(buttonAlpha)
174173
.testTag("TapToReveal")

app/src/main/java/to/bitkit/ui/shared/util/Modifiers.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ fun Modifier.screen(
107107

108108
fun Modifier.primaryButtonStyle(
109109
isEnabled: Boolean,
110-
shape: Shape
110+
shape: Shape,
111+
primaryColor: Color? = null
111112
): Modifier {
112113
return this
113114
// Step 1: Add shadow (only when enabled)
@@ -130,7 +131,7 @@ fun Modifier.primaryButtonStyle(
130131
Modifier.drawWithContent {
131132
// Draw the main gradient background filling entire button
132133
val mainBrush = Brush.verticalGradient(
133-
colors = listOf(Color(0xFF2A2A2A), Color(0xFF1C1C1C)),
134+
colors = listOf(primaryColor ?: Color(0xFF2A2A2A), Color(0xFF1C1C1C)),
134135
startY = 0f,
135136
endY = size.height
136137
)

0 commit comments

Comments
 (0)