Skip to content

Commit 946f469

Browse files
committed
feat: scan button refactor WIP
1 parent 843403d commit 946f469

File tree

1 file changed

+49
-18
lines changed
  • app/src/main/java/to/bitkit/ui/components

1 file changed

+49
-18
lines changed

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

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ import androidx.compose.runtime.Composable
2525
import androidx.compose.ui.Alignment
2626
import androidx.compose.ui.Modifier
2727
import androidx.compose.ui.draw.clip
28+
import androidx.compose.ui.draw.drawWithContent
29+
import androidx.compose.ui.draw.shadow
30+
import androidx.compose.ui.geometry.Offset
2831
import androidx.compose.ui.graphics.Brush
2932
import androidx.compose.ui.graphics.Color
33+
import androidx.compose.ui.graphics.drawscope.Stroke
3034
import androidx.compose.ui.platform.testTag
3135
import androidx.compose.ui.res.painterResource
3236
import androidx.compose.ui.res.stringResource
@@ -114,34 +118,61 @@ fun BoxScope.TabBar(
114118
}
115119
}
116120

117-
// Scan Button
118-
val scanBg = Colors.Gray6.copy(alpha = 0.75f)
119-
// Outer Border
121+
// Scan button matching iOS reference
120122
Box(
121-
content = {},
122123
contentAlignment = Alignment.Center,
123124
modifier = Modifier
124-
.size(80.dp)
125-
.clip(CircleShape)
126-
.background(
127-
Brush.verticalGradient(colors = listOf(Colors.White10, Color.Transparent))
125+
.size(64.dp)
126+
// Shadow 1: gray2 shadow with radius 0 at y=-1 (top highlight)
127+
.drawWithContent {
128+
// Draw a subtle top highlight (simulating iOS gray2 shadow at y=-1)
129+
drawCircle(
130+
color = Colors.Gray2,
131+
radius = size.width / 2 + 0.5.dp.toPx(),
132+
center = Offset(size.width / 2, size.height / 2 - 1.dp.toPx()),
133+
alpha = 0.15f
134+
)
135+
drawContent()
136+
}
137+
// Shadow 2: black 25% opacity, radius 25, y offset 20
138+
.shadow(
139+
elevation = 25.dp,
140+
shape = CircleShape,
141+
ambientColor = Colors.Black25,
142+
spotColor = Colors.Black25
128143
)
144+
.clip(CircleShape)
145+
.background(Colors.Gray7)
146+
// Overlay: Circle strokeBorder with linear gradient mask (top to bottom)
147+
.drawWithContent {
148+
drawContent()
149+
150+
// Draw 2px black border with vertical gradient mask (black at top, clear at bottom)
151+
val borderWidth = 2.dp.toPx()
152+
val gradientBrush = Brush.verticalGradient(
153+
colors = listOf(
154+
Color.Black, // Top: full black
155+
Color.Transparent // Bottom: transparent
156+
),
157+
startY = 0f,
158+
endY = size.height
159+
)
160+
161+
// Draw the circular border with gradient
162+
drawCircle(
163+
brush = gradientBrush,
164+
radius = (size.width - borderWidth) / 2,
165+
center = Offset(size.width / 2, size.height / 2),
166+
style = Stroke(width = borderWidth)
167+
)
168+
}
129169
.clickable { onScanClick() }
130-
.padding(2.dp)
131170
.testTag("Scan")
132-
)
133-
// Inner Content
134-
Box(
135-
contentAlignment = Alignment.Center,
136-
modifier = Modifier
137-
.size(76.dp)
138-
.clip(CircleShape)
139-
.background(scanBg)
140171
) {
141172
Icon(
142173
painter = painterResource(R.drawable.ic_scan),
143174
contentDescription = stringResource(R.string.wallet__recipient_scan),
144-
tint = Colors.Gray2,
175+
tint = Colors.Gray1,
145176
modifier = Modifier.size(32.dp)
146177
)
147178
}

0 commit comments

Comments
 (0)