Move down to only 1 abstract data type with a nully Frequency. Should aid in making the Expense page usable for all 3 data type.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Local
|
||||
import 'package:flutter_expense_tracker/db.dart';
|
||||
import 'package:flutter_expense_tracker/models/tracked_type_recurring.dart';
|
||||
import '/db.dart';
|
||||
import '/models/tracked_item.dart';
|
||||
|
||||
/// TODO:
|
||||
/// - Expenses (total number, totals by day / month / year)
|
||||
@@ -57,22 +57,22 @@ class SummaryCardForTotals extends StatelessWidget {
|
||||
required this.summaryTypeLabel,
|
||||
});
|
||||
|
||||
final Future<List<RecurringTrackedType>> list;
|
||||
final Future<List<TrackedItem>> list;
|
||||
final String summaryTypeLabel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<List<RecurringTrackedType>>(
|
||||
return FutureBuilder<List<TrackedItem>>(
|
||||
future: list,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
AsyncSnapshot<List<RecurringTrackedType>> snapshot,
|
||||
AsyncSnapshot<List<TrackedItem>> snapshot,
|
||||
) {
|
||||
if (!snapshot.hasData) {
|
||||
return Text('Loading $summaryTypeLabel Section...');
|
||||
}
|
||||
double dailyTotal = 0, monthlyTotal = 0, yearlyTotal = 0;
|
||||
for (RecurringTrackedType e in snapshot.data!) {
|
||||
for (TrackedItem e in snapshot.data!) {
|
||||
dailyTotal += e.calcComparableAmountDaily();
|
||||
monthlyTotal += e.calcComparableAmountYearly() / 12;
|
||||
yearlyTotal += e.calcComparableAmountYearly();
|
||||
|
||||
Reference in New Issue
Block a user