Skip to content

Commit d15bf84

Browse files
committed
feat: dark gradient
1 parent adf3d54 commit d15bf84

File tree

1 file changed

+21
-9
lines changed
  • app/src/main/java/to/bitkit/ui/components

1 file changed

+21
-9
lines changed

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,27 +143,39 @@ fun BoxScope.TabBar(
143143
)
144144
.clip(CircleShape)
145145
.background(Colors.Gray7)
146-
// Overlay: Circle strokeBorder with linear gradient mask (top to bottom)
146+
// Overlay: Circle strokeBorder with linear gradient mask (iOS: .mask)
147147
.drawWithContent {
148148
drawContent()
149149

150-
// Draw 2px black border with vertical gradient mask (black at top, clear at bottom)
150+
// The mask gradient goes from black (visible) at top to clear (invisible) at bottom
151151
val borderWidth = 2.dp.toPx()
152-
val gradientBrush = Brush.verticalGradient(
152+
153+
// Create vertical gradient mask (black to clear)
154+
val maskGradient = Brush.verticalGradient(
153155
colors = listOf(
154-
Color.Black, // Top: full black
155-
Color.Transparent // Bottom: transparent
156+
Color.White, // Top: full opacity (shows border)
157+
Color.Transparent // Bottom: transparent (hides border)
156158
),
157159
startY = 0f,
158160
endY = size.height
159161
)
160162

161-
// Draw the circular border with gradient
163+
// Draw solid black circular border first, then apply gradient as alpha mask
164+
drawCircle(
165+
color = Color.Black,
166+
radius = (size.width - borderWidth) / 2,
167+
center = Offset(size.width / 2, size.height / 2),
168+
style = Stroke(width = borderWidth),
169+
alpha = 1f
170+
)
171+
172+
// Apply gradient mask by drawing gradient as overlay with BlendMode
162173
drawCircle(
163-
brush = gradientBrush,
174+
brush = maskGradient,
164175
radius = (size.width - borderWidth) / 2,
165176
center = Offset(size.width / 2, size.height / 2),
166-
style = Stroke(width = borderWidth)
177+
style = Stroke(width = borderWidth),
178+
blendMode = androidx.compose.ui.graphics.BlendMode.DstIn
167179
)
168180
}
169181
.clickable { onScanClick() }
@@ -173,7 +185,7 @@ fun BoxScope.TabBar(
173185
painter = painterResource(R.drawable.ic_scan),
174186
contentDescription = stringResource(R.string.wallet__recipient_scan),
175187
tint = Colors.Gray1,
176-
modifier = Modifier.size(32.dp)
188+
modifier = Modifier.size(22.dp)
177189
)
178190
}
179191
}

0 commit comments

Comments
 (0)