| 1 | import 'package:cake_wallet/di.dart'; |
| 2 | import 'package:cake_wallet/entities/main_actions.dart'; |
| 3 | import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_action_button.dart'; |
| 4 | import 'package:cake_wallet/src/screens/dashboard/pages/cake_features_page.dart'; |
| 5 | import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; |
| 6 | import 'package:cake_wallet/view_model/dashboard/cake_features_view_model.dart'; |
| 7 | import 'package:flutter/material.dart'; |
| 8 | import 'package:flutter_mobx/flutter_mobx.dart'; |
| 9 | |
| 10 | class DesktopDashboardActions extends StatelessWidget { |
| 11 | final DashboardViewModel dashboardViewModel; |
| 12 | |
| 13 | const DesktopDashboardActions(this.dashboardViewModel, {Key? key}) : super(key: key); |
| 14 | |
| 15 | @override |
| 16 | Widget build(BuildContext context) { |
| 17 | return Container( |
| 18 | color: Theme.of(context).colorScheme.surface, |
| 19 | child: Observer(builder: (_) { |
| 20 | return Column( |
| 21 | children: [ |
| 22 | const SizedBox(height: 16), |
| 23 | DesktopActionButton( |
| 24 | title: MainActions.showWalletsAction.name(context), |
| 25 | image: MainActions.showWalletsAction.image, |
| 26 | canShow: MainActions.showWalletsAction.canShow?.call(dashboardViewModel), |
| 27 | isEnabled: MainActions.showWalletsAction.isEnabled?.call(dashboardViewModel), |
| 28 | onTap: () async => |
| 29 | await MainActions.showWalletsAction.onTap(context, dashboardViewModel), |
| 30 | ), |
| 31 | DesktopActionButton( |
| 32 | title: MainActions.swapAction.name(context), |
| 33 | image: MainActions.swapAction.image, |
| 34 | canShow: MainActions.swapAction.canShow?.call(dashboardViewModel), |
| 35 | isEnabled: MainActions.swapAction.isEnabled?.call(dashboardViewModel), |
| 36 | onTap: () async => await MainActions.swapAction.onTap(context, dashboardViewModel), |
| 37 | ), |
| 38 | Row( |
| 39 | children: [ |
| 40 | Expanded( |
| 41 | child: DesktopActionButton( |
| 42 | title: MainActions.receiveAction.name(context), |
| 43 | image: MainActions.receiveAction.image, |
| 44 | canShow: MainActions.receiveAction.canShow?.call(dashboardViewModel), |
| 45 | isEnabled: MainActions.receiveAction.isEnabled?.call(dashboardViewModel), |
| 46 | onTap: () async => |
| 47 | await MainActions.receiveAction.onTap(context, dashboardViewModel), |
| 48 | ), |
| 49 | ), |
| 50 | Expanded( |
| 51 | child: DesktopActionButton( |
| 52 | title: MainActions.sendAction.name(context), |
| 53 | image: MainActions.sendAction.image, |
| 54 | canShow: MainActions.sendAction.canShow?.call(dashboardViewModel), |
| 55 | isEnabled: MainActions.sendAction.isEnabled?.call(dashboardViewModel), |
| 56 | onTap: () async => |
| 57 | await MainActions.sendAction.onTap(context, dashboardViewModel), |
| 58 | ), |
| 59 | ), |
| 60 | ], |
| 61 | ), |
| 62 | Row( |
| 63 | children: [ |
| 64 | Expanded( |
| 65 | child: DesktopActionButton( |
| 66 | title: MainActions.tradeAction.name(context), |
| 67 | image: MainActions.tradeAction.image, |
| 68 | canShow: MainActions.tradeAction.canShow?.call(dashboardViewModel), |
| 69 | isEnabled: MainActions.tradeAction.isEnabled?.call(dashboardViewModel), |
| 70 | onTap: () async => |
| 71 | await MainActions.tradeAction.onTap(context, dashboardViewModel), |
| 72 | ), |
| 73 | ), |
| 74 | ], |
| 75 | ), |
| 76 | Expanded( |
| 77 | child: CakeFeaturesPage( |
| 78 | dashboardViewModel: dashboardViewModel, |
| 79 | cakeFeaturesViewModel: getIt.get<CakeFeaturesViewModel>(), |
| 80 | ), |
| 81 | ), |
| 82 | ], |
| 83 | ); |
| 84 | }), |
| 85 | ); |
| 86 | } |
| 87 | } |