Skip to content

Commit 298c5a6

Browse files
authored
Merge branch 'master' into claude/issue-548-20260120-1551
2 parents ef65734 + 69439eb commit 298c5a6

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ fun PrimaryButton(
6464
enabled: Boolean = true,
6565
fullWidth: Boolean = true,
6666
color: Color? = null,
67+
enableGradient: Boolean = true,
6768
) {
6869
val contentPadding = PaddingValues(horizontal = size.horizontalPadding.takeIf { text != null } ?: 0.dp)
6970
val buttonShape = MaterialTheme.shapes.large
@@ -83,7 +84,8 @@ fun PrimaryButton(
8384
.primaryButtonStyle(
8485
isEnabled = enabled && !isLoading,
8586
shape = buttonShape,
86-
primaryColor = color
87+
primaryColor = color,
88+
enableGradient = enableGradient
8789
)
8890
.alphaFeedback(enabled = enabled && !isLoading)
8991
) {
@@ -315,6 +317,7 @@ private fun PrimaryButtonPreview() {
315317
onClick = {},
316318
fullWidth = false,
317319
color = Colors.Brand,
320+
enableGradient = false
318321
)
319322
PrimaryButton(
320323
text = "Primary Small Loading",

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,11 @@ private fun ConfirmMnemonicContent(
159159
.testTag("backup_shuffled_words_grid")
160160
) {
161161
shuffledWords.forEachIndexed { index, word ->
162+
val isSelected = pressedStates.getOrElse(index, defaultValue = { false })
162163
PrimaryButton(
163164
text = word,
164-
color = if (pressedStates.getOrNull(index) == true) Colors.White32 else Colors.White16,
165+
color = if (isSelected) Colors.White32 else Colors.White16,
166+
enableGradient = !isSelected,
165167
fullWidth = false,
166168
size = ButtonSize.Small,
167169
onClick = { onWordPress(word, index) },

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ fun Modifier.primaryButtonStyle(
157157
isEnabled: Boolean,
158158
shape: Shape,
159159
primaryColor: Color? = null,
160+
enableGradient: Boolean = true,
160161
): Modifier {
161162
return this
162163
// Step 1: Add shadow (only when enabled)
@@ -177,17 +178,25 @@ fun Modifier.primaryButtonStyle(
177178
.then(
178179
if (isEnabled) {
179180
Modifier.drawWithContent {
180-
// Draw the main gradient background filling entire button
181-
val mainBrush = Brush.verticalGradient(
182-
colors = listOf(primaryColor ?: Colors.Gray5, Colors.Gray6),
183-
startY = 0f,
184-
endY = size.height
185-
)
186-
drawRect(
187-
brush = mainBrush,
188-
topLeft = Offset.Zero,
189-
size = size
190-
)
181+
// Draw the main background filling entire button
182+
val baseColor = primaryColor ?: Colors.Gray5
183+
if (enableGradient) {
184+
drawRect(
185+
brush = Brush.verticalGradient(
186+
colors = listOf(baseColor, Colors.Gray6),
187+
startY = 0f,
188+
endY = size.height
189+
),
190+
topLeft = Offset.Zero,
191+
size = size
192+
)
193+
} else {
194+
drawRect(
195+
color = baseColor,
196+
topLeft = Offset.Zero,
197+
size = size
198+
)
199+
}
191200

192201
// Draw top border highlight (2dp gradient fade)
193202
val borderHeight = 2.dp.toPx()

0 commit comments

Comments
 (0)