Start loading incomes and assets for reporting.

This commit is contained in:
Hyperling 2025-03-07 13:36:24 -07:00
parent 84f1ec2f70
commit 777d263efe

View File

@ -1,5 +1,6 @@
// Flutter
import 'package:flutter/material.dart';
import 'package:flutter_expense_tracker/models/item_type.dart';
// Local
import '/db.dart';
@ -27,24 +28,22 @@ class _ProjectionPageState extends State<ProjectionPage> {
Widget build(BuildContext context) {
Widget expenseSummary = SummaryCardForTotals(
list: DatabaseHelper.instance.getExpenses(),
summaryTypeLabel: "Expense",
summaryTypeLabel: ItemType.expense.title,
);
Widget incomeSummary = SummaryCardForTotals(
list: DatabaseHelper.instance.getIncomes(),
summaryTypeLabel: ItemType.income.title,
);
Widget assetSummary = SummaryCardForTotals(
list: DatabaseHelper.instance.getAssets(),
summaryTypeLabel: ItemType.asset.title,
);
return ListView(
children: [
expenseSummary,
SummaryCard(
name: "Income Totals",
leftText: "left",
middleText: "middle",
rightText: "right",
),
SummaryCard(
name: "Asset Totals",
leftText: "left",
middleText: "middle",
rightText: "right",
),
incomeSummary,
assetSummary,
],
);
}
@ -71,6 +70,7 @@ class SummaryCardForTotals extends StatelessWidget {
if (!snapshot.hasData) {
return Text('Loading $summaryTypeLabel Section...');
}
// TODO: Do not show all 3 sections or any text for Assets.
double dailyTotal = 0, monthlyTotal = 0, yearlyTotal = 0;
for (TrackedItem e in snapshot.data!) {
dailyTotal += e.calcComparableAmountDaily();
@ -122,9 +122,7 @@ class SummaryCard extends StatelessWidget {
Text(
name,
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: 16
),
decoration: TextDecoration.underline, fontSize: 16),
),
Row(
children: [