Basic budget sliders
This commit is contained in:
@@ -113,7 +113,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
||||
double scoppedTotal = 0;
|
||||
List<ChartItem> scopedCategoriesPositiveTotals = [];
|
||||
List<ChartItem> scopedCategoriesNegativeTotals = [];
|
||||
Map<int, FlSpot> scopedMonthlyTotals = {};
|
||||
Map<int, FlSpot> scopedMonthlyTotalsMap = {};
|
||||
Map<int, MonthTotals> scopedCategoriesMonthlyTotals = {};
|
||||
|
||||
Map<int, double> scopedMonthlyPostitiveTotals = {};
|
||||
@@ -134,7 +134,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
||||
DateTime transactionDate = transactionLine.transaction.date;
|
||||
int transactionDateDay = transactionDate.difference(DateTime(transactionDate.year,1,1)).inDays + 1;
|
||||
|
||||
scopedMonthlyTotals[transactionDateDay] = FlSpot(transactionDateDay.toDouble(), transactionLine.subTotal);
|
||||
scopedMonthlyTotalsMap[transactionDateDay] = FlSpot(transactionDateDay.toDouble(), transactionLine.subTotal);
|
||||
|
||||
final category = state.categories[transaction.category];
|
||||
if (category == null || category.transfert) {
|
||||
@@ -229,6 +229,9 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
||||
_sortMapByValues(monthTotals.negatives);
|
||||
}
|
||||
|
||||
List<FlSpot> scopedMonthlyTotals = scopedMonthlyTotalsMap.values.toList();
|
||||
scopedMonthlyTotals.sort((a, b) => a.x.compareTo(b.x));
|
||||
|
||||
return state.copyWith(
|
||||
scoppedProfit: scoppedTotal,
|
||||
scopedCategoriesPositiveTotals: scopedCategoriesPositiveTotals,
|
||||
@@ -239,7 +242,7 @@ class ChartBloc extends Bloc<ChartEvent, ChartState> {
|
||||
scopedSimplifiedCategoriesPositiveTotalsPercents: scopedSimplifiedCategoriesPositiveTotalsPercents,
|
||||
scopedSimplifiedCategoriesNegativeTotals: scopedSimplifiedCategoriesNegativeTotals,
|
||||
scopedSimplifiedCategoriesNegativeTotalsPercents: scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||
scopedMonthlyTotals: scopedMonthlyTotals.values.toList(),
|
||||
scopedMonthlyTotals: scopedMonthlyTotals,
|
||||
scopedCategoriesMonthlyTotals: scopedCategoriesMonthlyTotals,
|
||||
scopedMonthlyPostitiveTotals: scopedMonthlyPostitiveTotals,
|
||||
scopedMonthlyNegativeTotals: scopedMonthlyNegativeTotals,
|
||||
|
||||
Reference in New Issue
Block a user