-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update home tab navigation (#1631)
- Loading branch information
1 parent
50fa213
commit f83f824
Showing
4 changed files
with
58 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/espressocash_app/lib/features/router/models/activities_tab.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enum ActivitiesTab { pending, transactions } |
26 changes: 26 additions & 0 deletions
26
packages/espressocash_app/lib/features/router/service/navigation_service.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:injectable/injectable.dart'; | ||
|
||
import '../../accounts/auth_scope.dart'; | ||
import '../models/activities_tab.dart'; | ||
|
||
@Singleton(scope: authScope) | ||
class HomeNavigationService { | ||
final tabNotifier = ValueNotifier<int>(0); | ||
final activitiesTabNotifier = | ||
ValueNotifier<ActivitiesTab>(ActivitiesTab.pending); | ||
|
||
void openWalletTab(BuildContext context) { | ||
tabNotifier.value = 1; | ||
Navigator.of(context).popUntil((route) => route.isFirst); | ||
} | ||
|
||
void openActivitiesTab( | ||
BuildContext context, { | ||
ActivitiesTab tab = ActivitiesTab.pending, | ||
}) { | ||
tabNotifier.value = 2; | ||
activitiesTabNotifier.value = tab; | ||
Navigator.of(context).popUntil((route) => route.isFirst); | ||
} | ||
} |