我的页面排版优化 && 超管标识优化
This commit is contained in:
@@ -13,11 +13,11 @@ android {
|
||||
applicationId = "com.memory.app"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 17
|
||||
versionName = "1.3.3"
|
||||
versionCode = 19
|
||||
versionName = "1.3.5"
|
||||
|
||||
buildConfigField("String", "API_BASE_URL", "\"https://x.amos.us.kg/api/\"")
|
||||
buildConfigField("int", "VERSION_CODE", "17")
|
||||
buildConfigField("int", "VERSION_CODE", "19")
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
@@ -556,10 +556,8 @@ fun UserInfoDialog(
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
Spacer(modifier = Modifier.width(6.dp))
|
||||
if (isSuperAdmin) {
|
||||
RainbowShieldBadge(size = 20.dp)
|
||||
} else {
|
||||
if (!isSuperAdmin) {
|
||||
Spacer(modifier = Modifier.width(6.dp))
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Verified,
|
||||
contentDescription = null,
|
||||
@@ -569,10 +567,17 @@ fun UserInfoDialog(
|
||||
}
|
||||
}
|
||||
|
||||
// 超级管理员标签
|
||||
// 超管标识单独一行
|
||||
if (isSuperAdmin) {
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
SuperAdminLabel()
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center
|
||||
) {
|
||||
RainbowShieldBadge(size = 18.dp)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
RainbowShimmerText(text = "超级管理员", fontSize = 12.sp)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(2.dp))
|
||||
@@ -788,10 +793,52 @@ fun RainbowShieldBadge(
|
||||
// 超级管理员文字标签 - 带彩虹渐变和闪光效果
|
||||
@Composable
|
||||
fun SuperAdminLabel(modifier: Modifier = Modifier) {
|
||||
RainbowShimmerText(text = "超级管理员", fontSize = 11.sp, modifier = modifier)
|
||||
}
|
||||
|
||||
// 彩虹闪光文字组件
|
||||
@Composable
|
||||
fun RainbowShimmerText(
|
||||
text: String,
|
||||
fontSize: androidx.compose.ui.unit.TextUnit = 12.sp,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
// 彩虹色列表
|
||||
val rainbowColors = listOf(
|
||||
Color(0xFFFF6B6B), // 红
|
||||
Color(0xFFFF9F43), // 橙
|
||||
Color(0xFFFECA57), // 黄
|
||||
Color(0xFF5CD85A), // 绿
|
||||
Color(0xFF54A0FF), // 蓝
|
||||
Color(0xFF9B59B6), // 紫
|
||||
Color(0xFFFF6B6B), // 红 (循环)
|
||||
)
|
||||
|
||||
// 闪光动画
|
||||
val infiniteTransition = rememberInfiniteTransition(label = "textShimmer")
|
||||
val shimmerProgress by infiniteTransition.animateFloat(
|
||||
initialValue = 0f,
|
||||
targetValue = 1f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
animation = tween(durationMillis = 2000, easing = LinearEasing)
|
||||
),
|
||||
label = "textShimmer"
|
||||
)
|
||||
|
||||
// 动态渐变画刷 - 根据动画进度偏移颜色
|
||||
val animatedBrush = Brush.linearGradient(
|
||||
colors = rainbowColors,
|
||||
start = Offset(shimmerProgress * 200f - 100f, 0f),
|
||||
end = Offset(shimmerProgress * 200f + 100f, 0f)
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "超级管理员",
|
||||
fontSize = 11.sp,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
text = text,
|
||||
fontSize = fontSize,
|
||||
fontWeight = FontWeight.Bold,
|
||||
style = LocalTextStyle.current.copy(
|
||||
brush = animatedBrush
|
||||
),
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
||||
@@ -74,111 +74,125 @@ fun ProfileScreen(
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
// Header with icon buttons
|
||||
// Header - 标题居中,左右各两个按钮
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.statusBarsPadding()
|
||||
.padding(horizontal = 20.dp, vertical = 12.dp),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
.padding(horizontal = 16.dp, vertical = 12.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
// Notification Button with badge
|
||||
Box {
|
||||
// 左侧按钮组
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
// Notification Button with badge
|
||||
Box {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(36.dp)
|
||||
.clip(CircleShape)
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
|
||||
.clickable { onNotificationClick?.invoke() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Notifications,
|
||||
contentDescription = "消息",
|
||||
modifier = Modifier.size(18.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
if (unreadCount > 0) {
|
||||
val badgeText = if (unreadCount > 99) "99+" else unreadCount.toString()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.offset(x = 4.dp, y = (-4).dp)
|
||||
.height(16.dp)
|
||||
.defaultMinSize(minWidth = 16.dp)
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.background(ErrorRed)
|
||||
.padding(horizontal = 4.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = badgeText,
|
||||
color = Color.White,
|
||||
fontSize = 10.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
lineHeight = 10.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Theme Toggle
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.size(36.dp)
|
||||
.clip(CircleShape)
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
|
||||
.clickable { onNotificationClick?.invoke() },
|
||||
.clickable { onToggleTheme?.invoke() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Notifications,
|
||||
contentDescription = "消息",
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = if (isDarkTheme) Icons.Outlined.DarkMode else Icons.Outlined.LightMode,
|
||||
contentDescription = "切换主题",
|
||||
modifier = Modifier.size(18.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
if (unreadCount > 0) {
|
||||
val badgeText = if (unreadCount > 99) "99+" else unreadCount.toString()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.offset(x = 6.dp, y = (-6).dp)
|
||||
.height(20.dp)
|
||||
.defaultMinSize(minWidth = 20.dp)
|
||||
.clip(RoundedCornerShape(10.dp))
|
||||
.background(ErrorRed)
|
||||
.padding(horizontal = 6.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = badgeText,
|
||||
color = Color.White,
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
lineHeight = 11.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 中间标题
|
||||
Text(
|
||||
text = "我的",
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
// 右侧按钮组
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
// Check Update
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(36.dp)
|
||||
.clip(CircleShape)
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
|
||||
.clickable { onCheckUpdate?.invoke() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.SystemUpdate,
|
||||
contentDescription = "检查更新",
|
||||
modifier = Modifier.size(18.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
|
||||
// Theme Toggle
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
|
||||
.clickable { onToggleTheme?.invoke() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isDarkTheme) Icons.Outlined.DarkMode else Icons.Outlined.LightMode,
|
||||
contentDescription = "切换主题",
|
||||
modifier = Modifier.size(20.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
|
||||
// Check Update
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.5f))
|
||||
.clickable { onCheckUpdate?.invoke() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.SystemUpdate,
|
||||
contentDescription = "检查更新",
|
||||
modifier = Modifier.size(20.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
|
||||
// Logout
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.clip(CircleShape)
|
||||
.background(ErrorRed.copy(alpha = 0.1f))
|
||||
.clickable { onLogout() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Logout,
|
||||
contentDescription = "退出登录",
|
||||
modifier = Modifier.size(20.dp),
|
||||
tint = ErrorRed
|
||||
)
|
||||
// Logout
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(36.dp)
|
||||
.clip(CircleShape)
|
||||
.background(ErrorRed.copy(alpha = 0.1f))
|
||||
.clickable { onLogout() },
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Logout,
|
||||
contentDescription = "退出登录",
|
||||
modifier = Modifier.size(18.dp),
|
||||
tint = ErrorRed
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user