Merge remote-tracking branch 'origin/Florian'
This commit is contained in:
commit
b87db2d95d
@ -73,7 +73,10 @@ fun HeaderCard(modifier: Modifier = Modifier, balance: String, onCategoryButton:
|
||||
elevation = 8.dp,
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
clip = false
|
||||
)
|
||||
),
|
||||
onClick = {
|
||||
onCategoryButton()
|
||||
}
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
|
@ -1,6 +1,7 @@
|
||||
package at.xaxa.ledger.ui.category.overview
|
||||
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableFloatStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
@ -9,7 +10,6 @@ import androidx.lifecycle.viewModelScope
|
||||
import at.xaxa.ledger.data.EntryRepository
|
||||
import at.xaxa.ledger.data.db.Category.CategoryEntity
|
||||
import at.xaxa.ledger.ui.category.add.CategoryListUIState
|
||||
import at.xaxa.ledger.ui.category.add.CategoryUIState
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
@ -24,6 +24,8 @@ class OverviewCategoryViewModel(
|
||||
private val savedStateHandle: SavedStateHandle,
|
||||
private val repository: EntryRepository
|
||||
) : ViewModel() {
|
||||
var balance by mutableFloatStateOf(0.0f)
|
||||
private set // Restrict external modification
|
||||
var categoryUiState by mutableStateOf(CategoryListUIState())
|
||||
private set
|
||||
|
||||
@ -40,4 +42,9 @@ class OverviewCategoryViewModel(
|
||||
|
||||
}
|
||||
}
|
||||
fun calculateBalance() {
|
||||
viewModelScope.launch {
|
||||
balance = repository.calculateBalance()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user