11package com.davidcrespo.onewallet.presentation.onboarding
22
3+ import android.os.Build
34import androidx.compose.animation.core.LinearEasing
45import androidx.compose.animation.core.animateDpAsState
56import androidx.compose.animation.core.tween
@@ -10,26 +11,30 @@ import androidx.compose.foundation.layout.Box
1011import androidx.compose.foundation.layout.Column
1112import androidx.compose.foundation.layout.Row
1213import androidx.compose.foundation.layout.Spacer
14+ import androidx.compose.foundation.layout.WindowInsets
15+ import androidx.compose.foundation.layout.aspectRatio
1316import androidx.compose.foundation.layout.fillMaxSize
1417import androidx.compose.foundation.layout.fillMaxWidth
1518import androidx.compose.foundation.layout.height
1619import androidx.compose.foundation.layout.navigationBarsPadding
1720import androidx.compose.foundation.layout.padding
21+ import androidx.compose.foundation.layout.statusBarsPadding
1822import androidx.compose.foundation.layout.width
1923import androidx.compose.foundation.pager.HorizontalPager
2024import androidx.compose.foundation.pager.rememberPagerState
2125import androidx.compose.foundation.shape.CircleShape
2226import androidx.compose.foundation.shape.RoundedCornerShape
2327import androidx.compose.material3.MaterialTheme
2428import androidx.compose.material3.Scaffold
29+ import androidx.compose.material3.ScaffoldDefaults
2530import androidx.compose.material3.Text
2631import androidx.compose.runtime.Composable
27- import androidx.compose.runtime.LaunchedEffect
2832import androidx.compose.runtime.getValue
2933import androidx.compose.runtime.rememberCoroutineScope
3034import androidx.compose.ui.Alignment
3135import androidx.compose.ui.Modifier
3236import androidx.compose.ui.draw.clip
37+ import androidx.compose.ui.layout.ContentScale
3338import androidx.compose.ui.res.painterResource
3439import androidx.compose.ui.res.stringResource
3540import androidx.compose.ui.text.font.FontWeight
@@ -135,6 +140,11 @@ private fun OnboardingScreen(
135140 )
136141 }
137142 },
143+ contentWindowInsets = if (Build .VERSION .SDK_INT < Build .VERSION_CODES .S ) {
144+ WindowInsets (0 , 0 , 0 , 0 )
145+ } else {
146+ ScaffoldDefaults .contentWindowInsets
147+ },
138148 modifier = modifier.fillMaxSize()
139149 ) { paddingValues ->
140150 HorizontalPager (
@@ -155,16 +165,20 @@ fun OnboardingContent(
155165 Column (
156166 modifier = Modifier
157167 .fillMaxSize()
158- .padding(32 .dp),
168+ .statusBarsPadding()
169+ .padding(horizontal = 32 .dp, vertical = 24 .dp),
159170 horizontalAlignment = Alignment .CenterHorizontally ,
160171 verticalArrangement = Arrangement .Center
161172 ) {
162173 Image (
163174 painter = painterResource(page.icon),
164175 contentDescription = null ,
165176 modifier = Modifier
177+ .weight(1f , fill = false )
166178 .fillMaxWidth(0.95f )
167- .clip(RoundedCornerShape (50 .dp))
179+ .aspectRatio(1f , matchHeightConstraintsFirst = true )
180+ .clip(RoundedCornerShape (20 )),
181+ contentScale = ContentScale .Fit
168182 )
169183
170184 Spacer (modifier = Modifier .height(32 .dp))
@@ -175,15 +189,15 @@ fun OnboardingContent(
175189 fontWeight = FontWeight .Bold ,
176190 color = MaterialTheme .colorScheme.onBackground,
177191 textAlign = TextAlign .Center ,
178- modifier = Modifier .padding(bottom = 16 .dp)
192+ modifier = Modifier .padding(bottom = 8 .dp)
179193 )
180194
181195 Text (
182196 text = page.description,
183197 style = MaterialTheme .typography.bodyLarge,
184198 color = MaterialTheme .colorScheme.onSurfaceVariant,
185199 textAlign = TextAlign .Center ,
186- lineHeight = 24 .sp
200+ lineHeight = 22 .sp
187201 )
188202 }
189203}
0 commit comments