Start loading incomes and assets for reporting.
This commit is contained in:
parent
84f1ec2f70
commit
777d263efe
@ -1,5 +1,6 @@
|
|||||||
// Flutter
|
// Flutter
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_expense_tracker/models/item_type.dart';
|
||||||
|
|
||||||
// Local
|
// Local
|
||||||
import '/db.dart';
|
import '/db.dart';
|
||||||
@ -27,24 +28,22 @@ class _ProjectionPageState extends State<ProjectionPage> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Widget expenseSummary = SummaryCardForTotals(
|
Widget expenseSummary = SummaryCardForTotals(
|
||||||
list: DatabaseHelper.instance.getExpenses(),
|
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(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
expenseSummary,
|
expenseSummary,
|
||||||
SummaryCard(
|
incomeSummary,
|
||||||
name: "Income Totals",
|
assetSummary,
|
||||||
leftText: "left",
|
|
||||||
middleText: "middle",
|
|
||||||
rightText: "right",
|
|
||||||
),
|
|
||||||
SummaryCard(
|
|
||||||
name: "Asset Totals",
|
|
||||||
leftText: "left",
|
|
||||||
middleText: "middle",
|
|
||||||
rightText: "right",
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -71,6 +70,7 @@ class SummaryCardForTotals extends StatelessWidget {
|
|||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return Text('Loading $summaryTypeLabel Section...');
|
return Text('Loading $summaryTypeLabel Section...');
|
||||||
}
|
}
|
||||||
|
// TODO: Do not show all 3 sections or any text for Assets.
|
||||||
double dailyTotal = 0, monthlyTotal = 0, yearlyTotal = 0;
|
double dailyTotal = 0, monthlyTotal = 0, yearlyTotal = 0;
|
||||||
for (TrackedItem e in snapshot.data!) {
|
for (TrackedItem e in snapshot.data!) {
|
||||||
dailyTotal += e.calcComparableAmountDaily();
|
dailyTotal += e.calcComparableAmountDaily();
|
||||||
@ -122,9 +122,7 @@ class SummaryCard extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
name,
|
name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline, fontSize: 16),
|
||||||
fontSize: 16
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user