feat: added cards reordering feature

This commit is contained in:
2026-06-24 22:05:03 +03:00
parent c1a4414f10
commit 4748a46156
7 changed files with 197 additions and 83 deletions
@@ -40,6 +40,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material.icons.outlined.Add
import androidx.compose.material.icons.outlined.QrCode
import androidx.compose.material.icons.outlined.DensityMedium
import androidx.compose.material.icons.outlined.DragHandle
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.FloatingActionButton
@@ -185,7 +186,7 @@ fun TopBar(
}
@Composable
fun CardButton(cardInfo: CardInfo, onDeleteCard: (Int) -> Unit) {
fun CardButton(cardInfo: CardInfo, onDeleteCard: (Int) -> Unit, reorderIcon: @Composable () -> Unit) {
val context = LocalContext.current
var menuExpanded by remember { mutableStateOf(false) }
@@ -222,20 +223,28 @@ fun CardButton(cardInfo: CardInfo, onDeleteCard: (Int) -> Unit) {
.background(Color.Transparent)
.padding(horizontal = 8.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
horizontalArrangement = Arrangement.SpaceBetween
) {
CardIcon(
if (cardInfo.icon == null) null else base64ToImageBitmap(cardInfo.icon),
cardColor = cardColor
)
Row(
modifier = Modifier.weight(1f),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
CardIcon(
if (cardInfo.icon == null) null else base64ToImageBitmap(cardInfo.icon),
cardColor = cardColor
)
Text(
cardInfo.name,
fontSize = 16.sp,
color = MaterialTheme.colorScheme.onPrimaryContainer,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Start
)
Text(
cardInfo.name,
fontSize = 16.sp,
color = MaterialTheme.colorScheme.onPrimaryContainer,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Start
)
}
reorderIcon()
}
}