@@ -2,6 +2,7 @@ package to.bitkit.ui.sheets
22
33import androidx.compose.foundation.Image
44import androidx.compose.foundation.layout.Arrangement
5+ import androidx.compose.foundation.layout.Box
56import androidx.compose.foundation.layout.BoxWithConstraints
67import androidx.compose.foundation.layout.Column
78import androidx.compose.foundation.layout.Row
@@ -11,6 +12,7 @@ import androidx.compose.foundation.layout.navigationBarsPadding
1112import androidx.compose.foundation.layout.offset
1213import androidx.compose.foundation.layout.padding
1314import androidx.compose.foundation.layout.size
15+ import androidx.compose.foundation.layout.width
1416import androidx.compose.runtime.Composable
1517import androidx.compose.runtime.DisposableEffect
1618import androidx.compose.runtime.getValue
@@ -22,9 +24,6 @@ import androidx.compose.ui.Modifier
2224import androidx.compose.ui.platform.testTag
2325import androidx.compose.ui.res.painterResource
2426import androidx.compose.ui.res.stringResource
25- import androidx.compose.ui.text.SpanStyle
26- import androidx.compose.ui.text.buildAnnotatedString
27- import androidx.compose.ui.text.withStyle
2827import androidx.compose.ui.tooling.preview.Preview
2928import androidx.compose.ui.unit.dp
3029import androidx.navigation.compose.NavHost
@@ -173,14 +172,21 @@ private fun HardwarePairing(
173172 ) {
174173 BodyM (stringResource(R .string.hardware__pairing_text), color = Colors .White64 )
175174 FillHeight ()
176- Display (
177- buildAnnotatedString {
178- append(code)
179- withStyle(SpanStyle (color = Colors .White32 )) {
180- repeat(PAIRING_CODE_LENGTH - code.length) { append(' •' ) }
175+ // Fixed-width cells so digits replace dots without the row shifting.
176+ Row (horizontalArrangement = Arrangement .spacedBy(8 .dp)) {
177+ repeat(PAIRING_CODE_LENGTH ) { index ->
178+ val digit = code.getOrNull(index)?.toString()
179+ Box (
180+ contentAlignment = Alignment .Center ,
181+ modifier = Modifier .width(PAIRING_CELL_WIDTH )
182+ ) {
183+ Display (
184+ text = digit ? : " •" ,
185+ color = if (digit != null ) Colors .White else Colors .White32 ,
186+ )
181187 }
182188 }
183- )
189+ }
184190 FillHeight ()
185191 }
186192 NumberPad (
@@ -210,6 +216,7 @@ sealed interface HardwareRoute {
210216}
211217
212218private const val PAIRING_CODE_LENGTH = 6
219+ private val PAIRING_CELL_WIDTH = 32 .dp
213220
214221// Proportions taken from the 375dp-wide Figma frame: 256dp visuals bleeding
215222// 84dp off the left edge and 53dp off the right, staggered by 12dp vertically.
0 commit comments