Skip to content

Commit 53f39ce

Browse files
authored
Merge pull request #433 from synonymdev/fix/onboarding-transitions
fix: onboarding screens transition
2 parents 778e580 + bae7d8d commit 53f39ce

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Box
66
import androidx.compose.foundation.layout.Column
77
import androidx.compose.foundation.layout.Row
88
import androidx.compose.foundation.layout.Spacer
9-
import androidx.compose.foundation.layout.fillMaxSize
109
import androidx.compose.foundation.layout.fillMaxWidth
1110
import androidx.compose.foundation.layout.height
1211
import androidx.compose.foundation.layout.padding
@@ -29,6 +28,7 @@ import to.bitkit.ui.components.FillHeight
2928
import to.bitkit.ui.components.PrimaryButton
3029
import to.bitkit.ui.components.SecondaryButton
3130
import to.bitkit.ui.components.VerticalSpacer
31+
import to.bitkit.ui.shared.util.screen
3232
import to.bitkit.ui.theme.AppThemeSurface
3333
import to.bitkit.ui.theme.Colors
3434
import to.bitkit.ui.utils.withAccent
@@ -42,7 +42,7 @@ fun CreateWalletScreen(
4242
Box(
4343
contentAlignment = Alignment.TopCenter,
4444
modifier = modifier
45-
.fillMaxSize()
45+
.screen(insets = null)
4646
) {
4747
Image(
4848
painter = painterResource(id = R.drawable.wallet),
@@ -55,7 +55,7 @@ fun CreateWalletScreen(
5555
Column(
5656
modifier = Modifier
5757
.fillMaxWidth()
58-
.align(Alignment.BottomCenter),
58+
.align(Alignment.BottomCenter)
5959
) {
6060
FillHeight()
6161
Display(text = stringResource(R.string.onboarding__slide4_header).withAccent())
@@ -106,7 +106,7 @@ private fun CreateWalletScreenPreview() {
106106

107107
@Preview(showSystemUi = true, device = NEXUS_5)
108108
@Composable
109-
private fun CreateWalletScreenPreview2() {
109+
private fun PreviewSmall() {
110110
AppThemeSurface {
111111
CreateWalletScreen(
112112
onCreateClick = {},

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Box
55
import androidx.compose.foundation.layout.Column
66
import androidx.compose.foundation.layout.Row
77
import androidx.compose.foundation.layout.Spacer
8-
import androidx.compose.foundation.layout.fillMaxSize
98
import androidx.compose.foundation.layout.fillMaxWidth
109
import androidx.compose.foundation.layout.height
1110
import androidx.compose.foundation.layout.imePadding
@@ -37,8 +36,10 @@ import to.bitkit.ui.components.Display
3736
import to.bitkit.ui.components.HighlightLabel
3837
import to.bitkit.ui.components.PrimaryButton
3938
import to.bitkit.ui.components.TopBarSpacer
39+
import to.bitkit.ui.components.VerticalSpacer
4040
import to.bitkit.ui.components.mainRectHeight
4141
import to.bitkit.ui.scaffold.AppTopBar
42+
import to.bitkit.ui.shared.util.screen
4243
import to.bitkit.ui.theme.AppTextFieldDefaults
4344
import to.bitkit.ui.theme.AppThemeSurface
4445
import to.bitkit.ui.theme.Colors
@@ -53,7 +54,8 @@ fun CreateWalletWithPassphraseScreen(
5354
var bip39Passphrase by remember { mutableStateOf("") }
5455

5556
Box(
56-
modifier = Modifier.fillMaxSize(),
57+
modifier = Modifier
58+
.screen()
5759
) {
5860
Row(
5961
verticalAlignment = Alignment.Bottom,
@@ -117,7 +119,7 @@ fun CreateWalletWithPassphraseScreen(
117119
enabled = bip39Passphrase.isNotBlank(),
118120
modifier = Modifier.testTag("CreateNewWallet")
119121
)
120-
Spacer(modifier = Modifier.height(32.dp))
122+
VerticalSpacer(16.dp)
121123
}
122124
}
123125
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxSize
1010
import androidx.compose.foundation.layout.fillMaxWidth
1111
import androidx.compose.foundation.layout.height
1212
import androidx.compose.foundation.layout.padding
13-
import androidx.compose.foundation.layout.systemBarsPadding
1413
import androidx.compose.runtime.Composable
1514
import androidx.compose.ui.Alignment
1615
import androidx.compose.ui.Modifier
@@ -25,6 +24,7 @@ import to.bitkit.ui.components.BodyM
2524
import to.bitkit.ui.components.Display
2625
import to.bitkit.ui.components.PrimaryButton
2726
import to.bitkit.ui.components.SecondaryButton
27+
import to.bitkit.ui.shared.util.screen
2828
import to.bitkit.ui.theme.AppThemeSurface
2929
import to.bitkit.ui.theme.Colors
3030
import to.bitkit.ui.utils.withAccent
@@ -46,8 +46,7 @@ fun IntroScreen(
4646
)
4747
Box(
4848
modifier = Modifier
49-
.fillMaxSize()
50-
.systemBarsPadding()
49+
.screen(noBackground = true)
5150
) {
5251
Image(
5352
painter = painterResource(id = R.drawable.logo),

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.height
1717
import androidx.compose.foundation.layout.offset
1818
import androidx.compose.foundation.layout.padding
1919
import androidx.compose.foundation.layout.size
20-
import androidx.compose.foundation.layout.systemBarsPadding
2120
import androidx.compose.foundation.pager.HorizontalPager
2221
import androidx.compose.foundation.pager.rememberPagerState
2322
import androidx.compose.foundation.shape.CircleShape
@@ -46,6 +45,7 @@ import to.bitkit.ui.components.Display
4645
import to.bitkit.ui.components.Footnote
4746
import to.bitkit.ui.components.VerticalSpacer
4847
import to.bitkit.ui.scaffold.AppTopBar
48+
import to.bitkit.ui.shared.util.screen
4949
import to.bitkit.ui.theme.AppThemeSurface
5050
import to.bitkit.ui.theme.Colors
5151
import to.bitkit.ui.utils.withAccent
@@ -63,8 +63,7 @@ fun OnboardingSlidesScreen(
6363

6464
Box(
6565
modifier = Modifier
66-
.fillMaxSize()
67-
.systemBarsPadding()
66+
.screen()
6867
) {
6968
HorizontalPager(
7069
state = pagerState,
@@ -195,8 +194,8 @@ fun OnboardingTab(
195194
title: String,
196195
titleAccentColor: Color,
197196
text: String,
198-
disclaimerText: String? = null,
199197
modifier: Modifier = Modifier,
198+
disclaimerText: String? = null,
200199
) {
201200
Box(
202201
contentAlignment = Alignment.TopCenter,

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import androidx.compose.foundation.background
55
import androidx.compose.foundation.clickable
66
import androidx.compose.foundation.interaction.MutableInteractionSource
77
import androidx.compose.foundation.interaction.collectIsPressedAsState
8+
import androidx.compose.foundation.layout.WindowInsets
89
import androidx.compose.foundation.layout.fillMaxSize
9-
import androidx.compose.foundation.layout.systemBarsPadding
10+
import androidx.compose.foundation.layout.systemBars
11+
import androidx.compose.foundation.layout.windowInsetsPadding
1012
import androidx.compose.material3.MaterialTheme
1113
import androidx.compose.runtime.Composable
1214
import androidx.compose.runtime.LaunchedEffect
@@ -89,8 +91,9 @@ fun Modifier.blockPointerInputPassthrough(): Modifier {
8991

9092
@Composable
9193
fun Modifier.screen(
92-
noBackground: Boolean = false
94+
noBackground: Boolean = false,
95+
insets: WindowInsets? = WindowInsets.systemBars,
9396
): Modifier = this
9497
.fillMaxSize()
9598
.then(if (noBackground) Modifier else Modifier.background(MaterialTheme.colorScheme.background))
96-
.systemBarsPadding()
99+
.then(if (insets == null) Modifier else Modifier.windowInsetsPadding(insets))

0 commit comments

Comments
 (0)