更新登录UI

This commit is contained in:
2024-10-01 01:49:29 +08:00
parent c43006d38b
commit 45a698003f
5 changed files with 28 additions and 28 deletions

View File

@@ -22,6 +22,7 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.buildAnnotatedString
@@ -30,11 +31,12 @@ import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import com.aiosman.riderpro.R
import com.aiosman.riderpro.data.DictService import com.aiosman.riderpro.data.DictService
import com.aiosman.riderpro.data.DictServiceImpl import com.aiosman.riderpro.data.DictServiceImpl
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterialApi::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun PolicyCheckbox( fun PolicyCheckbox(
checked: Boolean = false, checked: Boolean = false,
@@ -84,17 +86,19 @@ fun PolicyCheckbox(
size = 16 size = 16
) )
val text = buildAnnotatedString { val text = buildAnnotatedString {
append("I agree to the ") val keyword = stringResource(R.string.private_policy_keyword)
val template = stringResource(R.string.private_policy_template)
append(template)
withStyle(style = SpanStyle(color = if (error) Color.Red else Color.Black)) { withStyle(style = SpanStyle(color = if (error) Color.Red else Color.Black)) {
append("terms and conditions") append(keyword)
} }
addStyle( addStyle(
style = SpanStyle( style = SpanStyle(
color = Color.Blue, color = Color.Blue,
textDecoration = TextDecoration.Underline textDecoration = TextDecoration.Underline
), ),
start = "I agree to the ".length, start = template.length,
end = "I agree to the terms and conditions".length end = template.length + keyword.length
) )
} }
ClickableText( ClickableText(

View File

@@ -137,7 +137,7 @@ fun Profile(
val bannerHeight = 500 val bannerHeight = 500
var headerBannerMaxHeight: Int = userHeight + bannerHeight var headerBannerMaxHeight: Int = userHeight + bannerHeight
val headerBannerMinHeight = 100 val headerBannerMinHeight = 100
val speedFactor = 0.5f val speedFactor = 0.75f
var currentHeaderHeight by rememberSaveable { mutableStateOf<Int>(headerBannerMaxHeight) } var currentHeaderHeight by rememberSaveable { mutableStateOf<Int>(headerBannerMaxHeight) }
var scrollState = rememberLazyListState() var scrollState = rememberLazyListState()
var gridScrollState = rememberLazyStaggeredGridState() var gridScrollState = rememberLazyStaggeredGridState()
@@ -189,16 +189,13 @@ fun Profile(
return Offset(x = 0f, y = consumedHeader / speedFactor) return Offset(x = 0f, y = consumedHeader / speedFactor)
} }
override suspend fun onPreFling(available: Velocity): Velocity { // override fun onPostScroll(
return Velocity.Zero // consumed: Offset,
} // available: Offset,
// source: NestedScrollSource
override suspend fun onPostFling( // ): Offset {
consumed: Velocity, // return Offset.Zero
available: Velocity // }
): Velocity {
return Velocity.Zero
}
} }
} }
@@ -448,7 +445,7 @@ fun Profile(
} }
) { ) {
Text( Text(
text = "Gallery", text = stringResource(R.string.gallery),
fontSize = 14.sp, fontSize = 14.sp,
fontWeight = FontWeight.W600, fontWeight = FontWeight.W600,
color = Color.Black, color = Color.Black,
@@ -471,7 +468,7 @@ fun Profile(
} }
) { ) {
Text( Text(
text = "Moments", text = stringResource(R.string.moment),
fontSize = 14.sp, fontSize = 14.sp,
fontWeight = FontWeight.W600, fontWeight = FontWeight.W600,
color = Color.Black, color = Color.Black,
@@ -784,7 +781,7 @@ fun OtherProfileAction(
) )
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
Text( Text(
text = "CHAT", text = stringResource(R.string.chat_upper),
fontSize = 14.sp, fontSize = 14.sp,
fontWeight = FontWeight.W600, fontWeight = FontWeight.W600,
color = Color.Black, color = Color.Black,

View File

@@ -241,15 +241,6 @@ fun EmailSignupScreen() {
) { ) {
acceptTerms = it acceptTerms = it
} }
// CheckboxWithLabel(
// checked = acceptTerms,
// checkSize = 16,
// fontSize = 12,
// label = stringResource(R.string.agree_terms_of_service),
// error = termsError
// ) {
// acceptTerms = it
// }
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
CheckboxWithLabel( CheckboxWithLabel(
checked = acceptPromotions, checked = acceptPromotions,

View File

@@ -72,4 +72,8 @@
<string name="reset_mail_send_failed">邮件发送失败,请检查您的网络连接或稍后重试。</string> <string name="reset_mail_send_failed">邮件发送失败,请检查您的网络连接或稍后重试。</string>
<string name="seconds_ago">%1d秒前</string> <string name="seconds_ago">%1d秒前</string>
<string name="minutes_ago">%1d分钟前</string> <string name="minutes_ago">%1d分钟前</string>
<string name="private_policy_template">同意</string>
<string name="private_policy_keyword">用户协议</string>
<string name="gallery">图片</string>
<string name="chat_upper">私信</string>
</resources> </resources>

View File

@@ -71,4 +71,8 @@
<string name="reset_mail_send_failed">Failed to send email. Please check your network connection or try again later.</string> <string name="reset_mail_send_failed">Failed to send email. Please check your network connection or try again later.</string>
<string name="seconds_ago">%1d seconds ago</string> <string name="seconds_ago">%1d seconds ago</string>
<string name="minutes_ago">%1d minutes ago</string> <string name="minutes_ago">%1d minutes ago</string>
<string name="private_policy_template">I agree to the</string>
<string name="private_policy_keyword">term of service</string>
<string name="gallery">Gallery</string>
<string name="chat_upper">CHAT</string>
</resources> </resources>