From 89fe8df459891e7d69f15c3e04d3590bba88d800 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Fri, 10 Feb 2023 19:45:48 +0200 Subject: [PATCH] Update trailing icon to open transaction page --- assets/images/solid_desktop_menu.png | Bin 0 -> 390 bytes lib/di.dart | 2 ++ lib/router.dart | 7 ++++++ lib/routes.dart | 1 + .../dashboard/desktop_dashboard_page.dart | 21 +++++++++++++++++- .../desktop_dashboard_view.dart | 3 +++ 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 assets/images/solid_desktop_menu.png diff --git a/assets/images/solid_desktop_menu.png b/assets/images/solid_desktop_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..d793803da134d885e089e6993a925df8f810d151 GIT binary patch literal 390 zcmV;10eSw3P)8w54%xz5D!itco$nZ&X_#N%xnF1EjA8S*9g8nEvF%yd$ z7=S4Z%p`x%;|DtuQUuxT@|HyWyO;Ck&rT2f(>pPWfa zJNR6%d%YU*_`Nfw-n+c!idh6&U;?{+>>M_VD|=(E4;lkR$OW_4&J-4MfMV0aoa@^I kY!IzdV$DO-9T;ij1priDa{-xuivR!s07*qoM6N<$f_A~1=l}o! literal 0 HcmV?d00001 diff --git a/lib/di.dart b/lib/di.dart index 067c2f19b..6180df576 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -8,6 +8,7 @@ import 'package:cake_wallet/ionia/ionia_gift_card.dart'; import 'package:cake_wallet/ionia/ionia_tip.dart'; import 'package:cake_wallet/src/screens/buy/onramper_page.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart'; +import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart'; import 'package:cake_wallet/src/screens/settings/display_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/privacy_page.dart'; @@ -367,6 +368,7 @@ Future setup( BalancePage(dashboardViewModel: getIt.get(), settingsStore: getIt.get())); getIt.registerFactory(() => DashboardPage( balancePage: getIt.get(), walletViewModel: getIt.get(), addressListViewModel: getIt.get())); + getIt.registerFactory(() => TransactionsPage(dashboardViewModel: getIt.get())); getIt.registerFactory(() => ReceivePage( addressListViewModel: getIt.get())); getIt.registerFactory(() => AddressPage( diff --git a/lib/router.dart b/lib/router.dart index 83d247e76..7a0f71e2d 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -6,6 +6,7 @@ import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart'; import 'package:cake_wallet/src/screens/buy/onramper_page.dart'; import 'package:cake_wallet/src/screens/buy/pre_order_page.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_actions.dart'; +import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart'; import 'package:cake_wallet/src/screens/settings/desktop_settings/dashboard_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/display_settings_page.dart'; import 'package:cake_wallet/src/screens/settings/other_settings_page.dart'; @@ -526,6 +527,12 @@ Route createRoute(RouteSettings settings) { case Routes.empty_no_route: return MaterialPageRoute( builder: (_) => SizedBox.shrink()); + + case Routes.transactionsPage: + return CupertinoPageRoute( + settings: settings, + fullscreenDialog: true, + builder: (_) => getIt.get()); default: return MaterialPageRoute( diff --git a/lib/routes.dart b/lib/routes.dart index 26bc9b3bb..8bf5603e0 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -84,4 +84,5 @@ class Routes { static const otherSettingsPage = '/other_settings_page'; static const advancedPrivacySettings = '/advanced_privacy_settings'; static const desktop_actions = '/desktop_actions'; + static const transactionsPage = '/transactions_page'; } diff --git a/lib/src/screens/dashboard/desktop_dashboard_page.dart b/lib/src/screens/dashboard/desktop_dashboard_page.dart index 5d529c39b..4b8a4bb44 100644 --- a/lib/src/screens/dashboard/desktop_dashboard_page.dart +++ b/lib/src/screens/dashboard/desktop_dashboard_page.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/src/screens/dashboard/widgets/transactions_page.dart'; import 'package:cake_wallet/src/screens/yat_emoji_id.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/themes/theme_base.dart'; @@ -57,7 +58,25 @@ class DesktopDashboardPage extends BasePage { @override Widget trailing(BuildContext context) { - return Image.asset('assets/images/desktop_menu.png', color: Theme.of(context).highlightColor); + final iconPath = Image.asset('assets/images/solid_desktop_menu.png', + color: Theme.of(context).accentTextTheme.headline2!.backgroundColor!); + return InkWell( + onTap: () { + String? currentPath; + + desktopKey.currentState?.popUntil((route) { + currentPath = route.settings.name; + return true; + }); + + if (currentPath == Routes.transactionsPage) { + return Navigator.pop(desktopKey.currentContext!); + } + + desktopKey.currentState!.pushNamed(Routes.transactionsPage); + }, + child: iconPath, + ); } final BalancePage balancePage; diff --git a/lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart b/lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart index dccf6c441..7e2bba777 100644 --- a/lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart +++ b/lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_view.dart @@ -2,6 +2,8 @@ import 'package:cake_wallet/routes.dart'; import 'package:flutter/material.dart'; import 'package:cake_wallet/router.dart' as Router; +GlobalKey desktopKey = GlobalKey(); + class DesktopDashboardView extends StatelessWidget { final Widget balancePage; @@ -19,6 +21,7 @@ class DesktopDashboardView extends StatelessWidget { Expanded( flex: 5, child: Navigator( + key: desktopKey, initialRoute: Routes.desktop_actions, onGenerateRoute: (settings) => Router.createRoute(settings), onGenerateInitialRoutes: (NavigatorState navigator, String initialRouteName) {