icons in list and reformatting
This commit is contained in:
parent
c65b271f9c
commit
4dbeeda782
@ -158,7 +158,7 @@ fun HorizontalCard(modifier: Modifier = Modifier, name: String, date: String, am
|
||||
fun CategoryCard(
|
||||
modifier: Modifier = Modifier,
|
||||
name: String,
|
||||
iconid: Int,
|
||||
iconId: Int,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
Surface(
|
||||
@ -176,12 +176,7 @@ fun CategoryCard(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
LayoutMediaText(modifier, name)
|
||||
|
||||
Icon(
|
||||
icons[iconid],
|
||||
contentDescription = "$name Icon"
|
||||
)
|
||||
LayoutMediaText(modifier, name, iconId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,17 +230,20 @@ fun LayoutMediaText(modifier: Modifier = Modifier, name: String, date: String, a
|
||||
}
|
||||
}
|
||||
@Composable
|
||||
fun LayoutMediaText(modifier: Modifier = Modifier, name: String) {
|
||||
fun LayoutMediaText(modifier: Modifier = Modifier, name: String, iconId: Int) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp, Alignment.Top),
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically, // Aligns items vertically in the center
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp) // Adds space between the icon and text
|
||||
) {
|
||||
Icon(
|
||||
icons[iconId],
|
||||
contentDescription = "$name Icon"
|
||||
)
|
||||
Text(
|
||||
text = name,
|
||||
color = Color(0xff1b1b1b),
|
||||
@ -256,7 +254,6 @@ fun LayoutMediaText(modifier: Modifier = Modifier, name: String) {
|
||||
letterSpacing = 0.15.sp
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ fun CategoryOverview(
|
||||
CategoryCard(
|
||||
modifier = modifier,
|
||||
name = item.categoryName,
|
||||
icon = item.icon,
|
||||
iconId = item.icon,
|
||||
onClick = { onCardClick(item._id) }
|
||||
)
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package at.xaxa.ledger.ui.category.add
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.defaultMinSize
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@ -16,6 +17,7 @@ import androidx.compose.material.icons.filled.Call
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.filled.Favorite
|
||||
import androidx.compose.material.icons.filled.Home
|
||||
import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material.icons.filled.LocationOn
|
||||
@ -28,6 +30,7 @@ import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||
import androidx.compose.material3.ExposedDropdownMenuDefaults
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@ -60,9 +63,10 @@ fun AddCategory(
|
||||
var selectedIconIndex by remember { mutableStateOf(0) } // Store index of selected icon
|
||||
var expanded by remember { mutableStateOf(false) } // Controls dropdown visibility
|
||||
|
||||
/*
|
||||
val categories by categoryViewModel.categoryUiState.categories.collectAsState(initial = emptyList())
|
||||
val category = categoryViewModel.categoryUi.category
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
var expanded by remember { mutableStateOf(false) }*/
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
@ -87,6 +91,12 @@ fun AddCategory(
|
||||
onValueChange = {},
|
||||
label = { Text("Icon") },
|
||||
readOnly = true,
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
imageVector = icons[selectedIconIndex], // Replace with your desired icon
|
||||
contentDescription = "Leading Icon"
|
||||
)
|
||||
},
|
||||
trailingIcon = {
|
||||
ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded)
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user