首页优化

This commit is contained in:
2024-10-11 21:23:28 +08:00
parent 58a1824e80
commit 6b750b507b

View File

@@ -152,33 +152,22 @@ fun LoginPage() {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
// .offset(
// y = (-72).dp
// ),
) { ) {
val context = LocalContext.current // 获取 Context val localContext = LocalContext.current // 获取 Context
MovingImageWall(context.resources) // 将 resources 传递给 MovingImageWall MovingImageWall(localContext.resources) // 将 resources 传递给 MovingImageWall
// MovingImageWall()
} }
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.padding(horizontal = 24.dp), .padding(horizontal = 24.dp),
horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))
// to bottom
Box(
contentAlignment = Alignment.TopCenter,
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()
) {
Image( Image(
painter = painterResource(id = R.mipmap.rider_pro_color_logo), painter = painterResource(id = R.mipmap.rider_pro_color_logo),
contentDescription = "Rider Pro", contentDescription = "Rider Pro",
modifier = Modifier modifier = Modifier
.size(48.dp) .size(52.dp)
) )
Spacer(modifier = Modifier.height(32.dp)) Spacer(modifier = Modifier.height(32.dp))
Text( Text(
@@ -187,9 +176,6 @@ fun LoginPage() {
fontWeight = FontWeight.W900 fontWeight = FontWeight.W900
) )
Text("Worldwide", fontSize = 28.sp, fontWeight = FontWeight.W900) Text("Worldwide", fontSize = 28.sp, fontWeight = FontWeight.W900)
}
}
Spacer(modifier = Modifier.height(32.dp)) Spacer(modifier = Modifier.height(32.dp))
ActionButton( ActionButton(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -235,7 +221,7 @@ fun LoginPage() {
} }
) )
} }
Spacer(modifier = Modifier.height(120.dp)) Spacer(modifier = Modifier.height(70.dp))
} }
} }
} }
@@ -274,7 +260,7 @@ fun MovingImageWall(resources: Resources) {
} }
Lifecycle.Event.ON_PAUSE -> { Lifecycle.Event.ON_PAUSE -> {
// 可选: 在Composable暂停时取消协程 // 可选: 在Composable暂停时取消协程
coroutineScope.cancel() // coroutineScope.cancel()
} }
else -> {} else -> {}
} }
@@ -285,8 +271,6 @@ fun MovingImageWall(resources: Resources) {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
// .height(5000.dp)
// .offset(y = (-72).dp)
) { ) {
val scrollState1 = rememberScrollState() val scrollState1 = rememberScrollState()
val scrollableState1 = rememberScrollableState { delta -> val scrollableState1 = rememberScrollableState { delta ->
@@ -339,13 +323,13 @@ fun MovingImageWall(resources: Resources) {
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.fillMaxHeight() .fillMaxHeight()
.background(Color.White.copy(alpha = 0.5f)), .background(Color.White.copy(alpha = 0.3f)),
contentAlignment = Alignment.BottomCenter contentAlignment = Alignment.BottomCenter
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(650.dp) .height(500.dp)
.background( .background(
Brush.verticalGradient( Brush.verticalGradient(
colors = listOf( colors = listOf(
@@ -353,7 +337,7 @@ fun MovingImageWall(resources: Resources) {
Color.White Color.White
), ),
startY = 0f, startY = 0f,
endY = 650f endY = 500f
) )
) )
) )
@@ -379,17 +363,11 @@ fun ImageColumn(
.height(208.dp) .height(208.dp)
.scale(1f) .scale(1f)
.graphicsLayer { .graphicsLayer {
var translation = if (reverse) { val translation = if (reverse) {
offset offset
} else { } else {
offset offset
} }
// 检查是否超出屏幕范围
// if (translation < -imageHeight.value * 3) { // 移出屏幕底部
//// translation += (imageHeight.value * 3)
// } else if (translation > (totalHeight / 2)) { // 移出屏幕顶部
// translation -= (totalHeight / 2)
// }
translationY = translation translationY = translation
} }
.clip(RoundedCornerShape(16.dp)), .clip(RoundedCornerShape(16.dp)),