首页优化

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

View File

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