Skip to content

Commit aa59efb

Browse files
authored
Merge pull request #304 from synonymdev/fix/adapt-create-wallet-screen-small-screens
Adapt onboarding to short screens
2 parents 915d6ac + 38716a5 commit aa59efb

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ fun BodyM(
127127
color: Color = MaterialTheme.colorScheme.primary,
128128
textAlign: TextAlign = TextAlign.Start,
129129
maxLines: Int = Int.MAX_VALUE,
130+
minLines: Int = 1,
130131
overflow: TextOverflow = if (maxLines == 1) TextOverflow.Ellipsis else TextOverflow.Clip,
131132
) {
132133
BodyM(
@@ -135,6 +136,7 @@ fun BodyM(
135136
modifier = modifier,
136137
textAlign = textAlign,
137138
maxLines = maxLines,
139+
minLines = minLines,
138140
overflow = overflow,
139141
)
140142
}
@@ -146,6 +148,7 @@ fun BodyM(
146148
color: Color = MaterialTheme.colorScheme.primary,
147149
textAlign: TextAlign = TextAlign.Start,
148150
maxLines: Int = Int.MAX_VALUE,
151+
minLines: Int = 1,
149152
overflow: TextOverflow = if (maxLines == 1) TextOverflow.Ellipsis else TextOverflow.Clip,
150153
) {
151154
Text(
@@ -155,6 +158,7 @@ fun BodyM(
155158
textAlign = textAlign,
156159
),
157160
maxLines = maxLines,
161+
minLines = minLines,
158162
overflow = overflow,
159163
modifier = modifier,
160164
)

app/src/main/java/to/bitkit/ui/onboarding/CreateWalletScreen.kt

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ import androidx.compose.ui.res.painterResource
1919
import androidx.compose.ui.res.stringResource
2020
import androidx.compose.ui.text.SpanStyle
2121
import androidx.compose.ui.text.font.FontWeight
22+
import androidx.compose.ui.tooling.preview.Devices.NEXUS_5
2223
import androidx.compose.ui.tooling.preview.Preview
2324
import androidx.compose.ui.unit.dp
2425
import to.bitkit.R
2526
import to.bitkit.ui.components.BodyM
2627
import to.bitkit.ui.components.Display
28+
import to.bitkit.ui.components.FillHeight
2729
import to.bitkit.ui.components.PrimaryButton
2830
import to.bitkit.ui.components.SecondaryButton
31+
import to.bitkit.ui.components.VerticalSpacer
2932
import to.bitkit.ui.theme.AppThemeSurface
3033
import to.bitkit.ui.theme.Colors
3134
import to.bitkit.ui.utils.withAccent
@@ -52,19 +55,20 @@ fun CreateWalletScreen(
5255
Column(
5356
modifier = Modifier
5457
.fillMaxWidth()
55-
.height(264.dp)
5658
.align(Alignment.BottomCenter),
5759
) {
60+
FillHeight()
5861
Display(text = stringResource(R.string.onboarding__slide4_header).withAccent())
59-
Spacer(modifier = Modifier.height(8.dp))
62+
VerticalSpacer(8.dp)
6063
BodyM(
6164
text = stringResource(R.string.onboarding__slide4_text).withAccent(
6265
defaultColor = Colors.White64,
6366
accentStyle = SpanStyle(fontWeight = FontWeight.Bold, color = Colors.White),
6467
),
6568
)
6669

67-
Spacer(modifier = Modifier.weight(1f))
70+
VerticalSpacer(32.dp)
71+
6872
Row(
6973
modifier = Modifier.fillMaxWidth(),
7074
horizontalArrangement = Arrangement.spacedBy(16.dp)
@@ -99,3 +103,14 @@ private fun CreateWalletScreenPreview() {
99103
)
100104
}
101105
}
106+
107+
@Preview(showSystemUi = true, device = NEXUS_5)
108+
@Composable
109+
private fun CreateWalletScreenPreview2() {
110+
AppThemeSurface {
111+
CreateWalletScreen(
112+
onCreateClick = {},
113+
onRestoreClick = {}
114+
)
115+
}
116+
}

app/src/main/java/to/bitkit/ui/onboarding/OnboardingSlidesScreen.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import to.bitkit.R
4444
import to.bitkit.ui.components.BodyM
4545
import to.bitkit.ui.components.Display
4646
import to.bitkit.ui.components.Footnote
47+
import to.bitkit.ui.components.VerticalSpacer
4748
import to.bitkit.ui.scaffold.AppTopBar
4849
import to.bitkit.ui.theme.AppThemeSurface
4950
import to.bitkit.ui.theme.Colors
@@ -212,19 +213,19 @@ fun OnboardingTab(
212213
Column(
213214
modifier = Modifier
214215
.fillMaxWidth()
215-
.height(264.dp)
216216
.align(Alignment.BottomCenter),
217217
) {
218218
Display(text = title.withAccent(accentColor = titleAccentColor))
219219
Spacer(modifier = Modifier.height(8.dp))
220220
BodyM(
221221
text = text,
222222
color = Colors.White64,
223+
minLines = 3
223224
)
224225
disclaimerText?.let {
225-
Spacer(modifier = Modifier.height(6.5.dp))
226226
Footnote(text = it)
227227
}
228+
VerticalSpacer(70.dp)
228229
}
229230
}
230231
}
@@ -270,3 +271,17 @@ private fun OnboardingViewPreview3() {
270271
)
271272
}
272273
}
274+
275+
@Preview(showSystemUi = true)
276+
@Composable
277+
private fun OnboardingViewPreview4() {
278+
AppThemeSurface {
279+
OnboardingSlidesScreen(
280+
currentTab = 4,
281+
onAdvancedSetupClick = {},
282+
onCreateClick = {},
283+
onRestoreClick = {},
284+
isGeoBlocked = false
285+
)
286+
}
287+
}

0 commit comments

Comments
 (0)