Skip to content

Commit

Permalink
Merge pull request #124 from enrique-lozano/hot-fixes
Browse files Browse the repository at this point in the history
Allow entering in the stats page with a custom date range and filters
  • Loading branch information
enrique-lozano authored Feb 23, 2024
2 parents 370b42c + 0609ad4 commit 77240fc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
23 changes: 19 additions & 4 deletions lib/app/home/dashboard.page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ class _DashboardPageState extends State<DashboardPage> {
child: CardWithHeader(
title: t.financial_health.display,
onHeaderButtonClick: () => RouteUtils.pushRoute(
context, const StatsPage(initialIndex: 0)),
context,
StatsPage(
dateRangeService: dateRangeService,
initialIndex: 0)),
bodyPadding: const EdgeInsets.only(right: 8),
body: StreamBuilder(
stream: FinanceHealthService().getHealthyValue(
Expand Down Expand Up @@ -343,7 +346,11 @@ class _DashboardPageState extends State<DashboardPage> {
),
onHeaderButtonClick: () {
RouteUtils.pushRoute(
context, const StatsPage(initialIndex: 2));
context,
StatsPage(
dateRangeService: dateRangeService,
initialIndex: 2),
);
}),
),
],
Expand All @@ -364,7 +371,11 @@ class _DashboardPageState extends State<DashboardPage> {
datePeriodState: dateRangeService),
onHeaderButtonClick: () {
RouteUtils.pushRoute(
context, const StatsPage(initialIndex: 1));
context,
StatsPage(
dateRangeService: dateRangeService,
initialIndex: 1),
);
}),
),
ResponsiveRowColumnItem(
Expand All @@ -379,7 +390,11 @@ class _DashboardPageState extends State<DashboardPage> {
),
onHeaderButtonClick: () {
RouteUtils.pushRoute(
context, const StatsPage(initialIndex: 3));
context,
StatsPage(
dateRangeService: dateRangeService,
initialIndex: 3),
);
}),
),
],
Expand Down
17 changes: 14 additions & 3 deletions lib/app/stats/stats_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,34 @@ import 'package:monekin/i18n/translations.g.dart';
import '../accounts/all_accounts_balance.dart';

class StatsPage extends StatefulWidget {
const StatsPage({super.key, this.initialIndex = 0});
const StatsPage({
super.key,
this.initialIndex = 0,
this.filters = const TransactionFilters(),
this.dateRangeService = const DatePeriodState(),
});

final int initialIndex;

final TransactionFilters filters;
final DatePeriodState dateRangeService;

@override
State<StatsPage> createState() => _StatsPageState();
}

class _StatsPageState extends State<StatsPage> {
DatePeriodState dateRangeService = const DatePeriodState();
final accountService = AccountService.instance;

TransactionFilters filters = const TransactionFilters();
late TransactionFilters filters;
late DatePeriodState dateRangeService;

@override
void initState() {
super.initState();

filters = widget.filters;
dateRangeService = widget.dateRangeService;
}

Widget buildContainerWithPadding(
Expand Down

0 comments on commit 77240fc

Please sign in to comment.