Icon List added for Category

This commit is contained in:
Florian 2025-01-15 17:11:33 +01:00
parent 63083c6cab
commit 359a67e560
2 changed files with 42 additions and 10 deletions

View File

@ -90,7 +90,7 @@ fun LedgerApp(modifier: Modifier = Modifier){
navController.navigate("home")
},
onCardClick = {
navController.navigate("catEdit/$it")
navController.navigate("categoryEdit/$it")
}
)
}

View File

@ -1,5 +1,6 @@
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.fillMaxSize
@ -7,6 +8,22 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountBox
import androidx.compose.material.icons.filled.ArrowForward
import androidx.compose.material.icons.filled.Build
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.Home
import androidx.compose.material.icons.filled.Info
import androidx.compose.material.icons.filled.LocationOn
import androidx.compose.material.icons.filled.Lock
import androidx.compose.material.icons.filled.Notifications
import androidx.compose.material.icons.filled.Share
import androidx.compose.material.icons.filled.ShoppingCart
import androidx.compose.material.icons.filled.Warning
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
@ -34,6 +51,21 @@ fun addCategory(
onCardClick: (Int) -> Unit,
categoryViewModel: CategoryViewModel = viewModel(factory = AppViewModelProvider.Factory)
) {
val icons = listOf(
Icons.Filled.Call,
Icons.Filled.Home,
Icons.Filled.Build,
Icons.Filled.ShoppingCart,
Icons.Filled.Notifications,
Icons.Filled.LocationOn,
Icons.Filled.Delete,
Icons.Filled.Lock,
Icons.Filled.Info,
Icons.Filled.Warning,
Icons.Filled.Check,
Icons.Filled.Close,
Icons.Filled.AccountBox
)
var name by remember { mutableStateOf("") }
var icon by remember { mutableStateOf(0) }
@ -48,8 +80,9 @@ fun addCategory(
.padding(16.dp, 0.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
OutlinedTextField(
value = category.categoryName,
value = name,
onValueChange = { name = it },
label = { Text("Name") },
modifier = Modifier
@ -83,25 +116,24 @@ fun addCategory(
}
)
}
LazyColumn(
Modifier.weight(1f)
) {
items(categories) { item ->
Column(
modifier = Modifier.padding(vertical = 4.dp)
) {
Log.w("KRAUSI", item.categoryName )
CategoryCard(
modifier = modifier,
name = category.categoryName,
icon = category.icon,
onClick = { onCardClick(category._id) }
name = item.categoryName,
icon = item.icon,
onClick = { onCardClick(item._id) }
)
}
}
}
}
}