This commit is contained in:
deepfal 2025-08-18 11:27:51 +08:00
parent d2a3e61b54
commit e2801b2a1d
4 changed files with 25 additions and 24 deletions

View File

@ -900,8 +900,8 @@ class MainActivity : ComponentActivity() {
modifier = Modifier modifier = Modifier
.fillMaxSize() .fillMaxSize()
.reorderable(reorderableState), .reorderable(reorderableState),
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp), contentPadding = PaddingValues(vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(12.dp) verticalArrangement = Arrangement.spacedBy(0.dp) // 移除间距,改为紧密列表
) { ) {
itemsIndexed(reorderableAccounts, key = { _, account -> account.key }) { index, account -> itemsIndexed(reorderableAccounts, key = { _, account -> account.key }) { index, account ->
// 为每个列表项添加错开的入场动画 // 为每个列表项添加错开的入场动画
@ -917,34 +917,28 @@ class MainActivity : ComponentActivity() {
) + fadeOut(animationSpec = tween(durationMillis = 200)) ) + fadeOut(animationSpec = tween(durationMillis = 200))
) { ) {
ReorderableItem(reorderableState, key = account.key) { isDragging -> ReorderableItem(reorderableState, key = account.key) { isDragging ->
val elevation = animateDpAsState(
targetValue = if (isDragging) 12.dp else 2.dp,
animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy),
label = "elevation"
)
// 拖拽时的缩放动画 - 与手环排序保持一致 // 拖拽时的缩放动画 - 与手环排序保持一致
val dragScale by animateFloatAsState( val dragScale by animateFloatAsState(
targetValue = if (isDragging) 1.03f else 1f, targetValue = if (isDragging) 1.02f else 1f,
animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy), animationSpec = spring(dampingRatio = Spring.DampingRatioMediumBouncy),
label = "drag_scale" label = "drag_scale"
) )
Card( // 直接使用Box作为列表项容器移除Card
Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.graphicsLayer( .graphicsLayer(
scaleX = dragScale, scaleX = dragScale,
scaleY = dragScale scaleY = dragScale
) )
.animateContentSize(), .background(
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp), if (isDragging)
colors = CardDefaults.cardColors( MaterialTheme.colorScheme.surfaceContainerHighest.copy(alpha = 0.5f)
containerColor = if (isDragging) else
MaterialTheme.colorScheme.surfaceContainerHighest MaterialTheme.colorScheme.surface
else )
MaterialTheme.colorScheme.surface .animateContentSize()
)
) { ) {
Row { Row {
// 拖拽排序模式下的账户卡片 // 拖拽排序模式下的账户卡片

View File

@ -168,8 +168,7 @@ fun ModernTOTPCard(
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(80.dp) .height(72.dp),
.padding(horizontal = 16.dp),
horizontalArrangement = Arrangement.End, horizontalArrangement = Arrangement.End,
verticalAlignment = Alignment.CenterVertically verticalAlignment = Alignment.CenterVertically
) { ) {
@ -233,12 +232,11 @@ fun ModernTOTPCard(
} }
} }
// 前景层:彻底修复圆角问题 - 使用Box+背景+clip的方式 // 前景层:列表项样式 - 移除圆角,改为全宽列表项
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.offset { IntOffset(offsetX.roundToInt(), 0) } .offset { IntOffset(offsetX.roundToInt(), 0) }
.clip(RoundedCornerShape(16.dp))
.background( .background(
if (urgentColorAlpha > 0f) { if (urgentColorAlpha > 0f) {
MaterialTheme.colorScheme.errorContainer.copy(alpha = urgentColorAlpha) MaterialTheme.colorScheme.errorContainer.copy(alpha = urgentColorAlpha)
@ -405,6 +403,15 @@ fun ModernTOTPCard(
} }
} }
} }
// 底部分割线
Box(
modifier = Modifier
.fillMaxWidth()
.height(1.dp)
.background(MaterialTheme.colorScheme.outline.copy(alpha = 0.12f))
.padding(start = 72.dp) // 与左侧图标对齐
)
} }
} }
} }

View File

@ -91,7 +91,7 @@ fun ReorderableBandAccountsList(
Card( Card(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
elevation = CardDefaults.cardElevation(defaultElevation = elevation.value), elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
colors = CardDefaults.cardColors( colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceContainerLow containerColor = MaterialTheme.colorScheme.surfaceContainerLow
) )

View File

@ -1064,7 +1064,7 @@ fun ReorderableBandAccountsListImpl(
scaleY = dragScale scaleY = dragScale
) )
.animateContentSize(), .animateContentSize(),
elevation = CardDefaults.cardElevation(defaultElevation = elevation.value), elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
colors = CardDefaults.cardColors( colors = CardDefaults.cardColors(
containerColor = if (isDragging) containerColor = if (isDragging)
MaterialTheme.colorScheme.surfaceContainerHighest MaterialTheme.colorScheme.surfaceContainerHighest