basic csv loader, transaction list & half done stats page
This commit is contained in:
123
lib/domains/charts/chart_state.dart
Normal file
123
lib/domains/charts/chart_state.dart
Normal file
@@ -0,0 +1,123 @@
|
||||
part of 'chart_bloc.dart';
|
||||
|
||||
final class ChartState extends Equatable {
|
||||
final List<Transaction> transactions;
|
||||
final List<TransactionLine> transactionsLines;
|
||||
|
||||
final double globalTotal;
|
||||
final Map<String, double> accountsTotals;
|
||||
|
||||
final DateTime? firstDate;
|
||||
final DateTime? lastDate;
|
||||
|
||||
final num currentYear;
|
||||
|
||||
final Map<String, double> categoriesTotals;
|
||||
final List<FlSpot> monthlyTotals;
|
||||
final Map<String, Map<String, double>> categoriesMonthlyTotals;
|
||||
|
||||
final List<ChartItem> scopedCategoriesPositiveTotals;
|
||||
final List<ChartItem> scopedCategoriesPositiveTotalsPercents;
|
||||
final List<ChartItem> scopedCategoriesNegativeTotals;
|
||||
final List<ChartItem> scopedCategoriesNegativeTotalsPercents;
|
||||
|
||||
final List<ChartItem> scopedSimplifiedCategoriesPositiveTotals;
|
||||
final List<ChartItem> scopedSimplifiedCategoriesPositiveTotalsPercents;
|
||||
final List<ChartItem> scopedSimplifiedCategoriesNegativeTotals;
|
||||
final List<ChartItem> scopedSimplifiedCategoriesNegativeTotalsPercents;
|
||||
|
||||
final List<FlSpot> scopedMonthlyTotals;
|
||||
final Map<String, Map<String, double>> scopedCategoriesMonthlyTotals;
|
||||
|
||||
const ChartState({
|
||||
this.transactions = const [],
|
||||
this.transactionsLines = const [],
|
||||
this.globalTotal = 0,
|
||||
this.accountsTotals = const {},
|
||||
this.firstDate,
|
||||
this.lastDate,
|
||||
this.currentYear = 2000,
|
||||
this.categoriesTotals = const {},
|
||||
this.monthlyTotals = const [],
|
||||
this.categoriesMonthlyTotals = const {},
|
||||
this.scopedCategoriesPositiveTotals = const [],
|
||||
this.scopedCategoriesPositiveTotalsPercents = const [],
|
||||
this.scopedCategoriesNegativeTotals = const [],
|
||||
this.scopedCategoriesNegativeTotalsPercents = const [],
|
||||
this.scopedSimplifiedCategoriesPositiveTotals = const [],
|
||||
this.scopedSimplifiedCategoriesPositiveTotalsPercents = const [],
|
||||
this.scopedSimplifiedCategoriesNegativeTotals = const [],
|
||||
this.scopedSimplifiedCategoriesNegativeTotalsPercents = const [],
|
||||
this.scopedMonthlyTotals = const [],
|
||||
this.scopedCategoriesMonthlyTotals = const {},
|
||||
});
|
||||
|
||||
ChartState copyWith({
|
||||
List<Transaction>? transactions,
|
||||
List<TransactionLine>? transactionsLines,
|
||||
double? globalTotal,
|
||||
Map<String, double>? accountsTotals,
|
||||
DateTime? firstDate,
|
||||
DateTime? lastDate,
|
||||
num? currentYear,
|
||||
Map<String, double>? categoriesTotals,
|
||||
List<FlSpot>? monthlyTotals,
|
||||
Map<String, Map<String, double>>? categoriesMonthlyTotals,
|
||||
List<ChartItem>? scopedCategoriesPositiveTotals,
|
||||
List<ChartItem>? scopedCategoriesPositiveTotalsPercents,
|
||||
List<ChartItem>? scopedCategoriesNegativeTotals,
|
||||
List<ChartItem>? scopedCategoriesNegativeTotalsPercents,
|
||||
List<ChartItem>? scopedSimplifiedCategoriesPositiveTotals,
|
||||
List<ChartItem>? scopedSimplifiedCategoriesPositiveTotalsPercents,
|
||||
List<ChartItem>? scopedSimplifiedCategoriesNegativeTotals,
|
||||
List<ChartItem>? scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||
List<FlSpot>? scopedMonthlyTotals,
|
||||
Map<String, Map<String, double>>? scopedCategoriesMonthlyTotals,
|
||||
}) {
|
||||
return ChartState(
|
||||
transactions: transactions ?? this.transactions,
|
||||
transactionsLines: transactionsLines ?? this.transactionsLines,
|
||||
globalTotal: globalTotal ?? this.globalTotal,
|
||||
accountsTotals: accountsTotals ?? this.accountsTotals,
|
||||
firstDate: firstDate ?? this.firstDate,
|
||||
lastDate: lastDate ?? this.lastDate,
|
||||
currentYear: currentYear ?? this.currentYear,
|
||||
categoriesTotals: categoriesTotals ?? this.categoriesTotals,
|
||||
monthlyTotals: monthlyTotals ?? this.monthlyTotals,
|
||||
categoriesMonthlyTotals: categoriesMonthlyTotals ?? this.categoriesMonthlyTotals,
|
||||
scopedCategoriesPositiveTotals: scopedCategoriesPositiveTotals ?? this.scopedCategoriesPositiveTotals,
|
||||
scopedCategoriesPositiveTotalsPercents: scopedCategoriesPositiveTotalsPercents ?? this.scopedCategoriesPositiveTotalsPercents,
|
||||
scopedCategoriesNegativeTotals: scopedCategoriesNegativeTotals ?? this.scopedCategoriesNegativeTotals,
|
||||
scopedCategoriesNegativeTotalsPercents: scopedCategoriesNegativeTotalsPercents ?? this.scopedCategoriesNegativeTotalsPercents,
|
||||
scopedSimplifiedCategoriesPositiveTotals: scopedSimplifiedCategoriesPositiveTotals ?? this.scopedSimplifiedCategoriesPositiveTotals,
|
||||
scopedSimplifiedCategoriesPositiveTotalsPercents: scopedSimplifiedCategoriesPositiveTotalsPercents ?? this.scopedSimplifiedCategoriesPositiveTotalsPercents,
|
||||
scopedSimplifiedCategoriesNegativeTotals: scopedSimplifiedCategoriesNegativeTotals ?? this.scopedSimplifiedCategoriesNegativeTotals,
|
||||
scopedSimplifiedCategoriesNegativeTotalsPercents: scopedSimplifiedCategoriesNegativeTotalsPercents ?? this.scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||
scopedMonthlyTotals: scopedMonthlyTotals ?? this.scopedMonthlyTotals,
|
||||
scopedCategoriesMonthlyTotals: scopedCategoriesMonthlyTotals ?? this.scopedCategoriesMonthlyTotals,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get props => [
|
||||
transactions,
|
||||
transactionsLines,
|
||||
globalTotal,
|
||||
accountsTotals,
|
||||
currentYear,
|
||||
categoriesTotals,
|
||||
monthlyTotals,
|
||||
categoriesMonthlyTotals,
|
||||
scopedCategoriesPositiveTotals,
|
||||
scopedCategoriesPositiveTotalsPercents,
|
||||
scopedCategoriesNegativeTotals,
|
||||
scopedCategoriesNegativeTotalsPercents,
|
||||
scopedSimplifiedCategoriesPositiveTotals,
|
||||
scopedSimplifiedCategoriesPositiveTotalsPercents,
|
||||
scopedSimplifiedCategoriesNegativeTotals,
|
||||
scopedSimplifiedCategoriesNegativeTotalsPercents,
|
||||
scopedMonthlyTotals,
|
||||
scopedCategoriesMonthlyTotals,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user