mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-16 17:27:37 +00:00
Merge pull request #90 from cake-tech/CAKE-284-add-support-to-the-main-menu
Cake 284 add support to the main menu
This commit is contained in:
commit
46b7175c4e
8 changed files with 112 additions and 23 deletions
|
@ -33,6 +33,7 @@ import 'package:cake_wallet/src/screens/send/send_template_page.dart';
|
|||
import 'package:cake_wallet/src/screens/settings/change_language.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/settings.dart';
|
||||
import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart';
|
||||
import 'package:cake_wallet/src/screens/support/support_page.dart';
|
||||
import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart';
|
||||
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
|
||||
|
@ -65,6 +66,7 @@ import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.
|
|||
import 'package:cake_wallet/view_model/rescan_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/restore_from_backup_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/support_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/trade_details_view_model.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart';
|
||||
|
@ -509,5 +511,9 @@ Future setup(
|
|||
getIt.registerFactoryParam<TradeDetailsPage, Trade, void>((Trade trade, _) =>
|
||||
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
||||
|
||||
getIt.registerFactory(() => SupportViewModel());
|
||||
|
||||
getIt.registerFactory(() => SupportPage(getIt.get<SupportViewModel>()));
|
||||
|
||||
_isSetupFinished = true;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
|
|||
import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart';
|
||||
import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart';
|
||||
import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart';
|
||||
import 'package:cake_wallet/src/screens/support/support_page.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
@ -331,6 +332,10 @@ Route<dynamic> createRoute(RouteSettings settings) {
|
|||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<RestoreFromBackupPage>());
|
||||
|
||||
case Routes.support:
|
||||
return CupertinoPageRoute<void>(
|
||||
builder: (_) => getIt.get<SupportPage>());
|
||||
|
||||
default:
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (_) => Scaffold(
|
||||
|
|
|
@ -51,4 +51,5 @@ class Routes {
|
|||
static const backup = '/backup';
|
||||
static const editBackupPassword = '/edit_backup_passowrd';
|
||||
static const restoreFromBackup = '/restore_from_backup';
|
||||
static const support = '/support';
|
||||
}
|
|
@ -20,7 +20,7 @@ class WalletMenu {
|
|||
WalletMenuItem(
|
||||
title: S.current.rescan,
|
||||
image: Image.asset('assets/images/filter_icon.png',
|
||||
height: 16, width: 16)),
|
||||
height: 16, width: 16, color: Palette.darkBlue)),
|
||||
WalletMenuItem(
|
||||
title: S.current.wallets,
|
||||
image: Image.asset('assets/images/wallet_menu.png',
|
||||
|
@ -47,6 +47,10 @@ class WalletMenu {
|
|||
title: S.current.settings_title,
|
||||
image: Image.asset('assets/images/settings_menu.png',
|
||||
height: 16, width: 16)),
|
||||
WalletMenuItem(
|
||||
title: S.current.settings_support,
|
||||
image: Image.asset('assets/images/question_mark.png',
|
||||
height: 16, width: 16, color: Palette.darkBlue)),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -99,6 +103,9 @@ class WalletMenu {
|
|||
case 7:
|
||||
Navigator.of(context).pushNamed(Routes.settings);
|
||||
break;
|
||||
case 8:
|
||||
Navigator.of(context).pushNamed(Routes.support);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,10 @@ class MenuWidgetState extends State<MenuWidget> {
|
|||
screenWidth = 0;
|
||||
screenHeight = 0;
|
||||
|
||||
headerHeight = 137;
|
||||
tileHeight = 75;
|
||||
headerHeight = 120;
|
||||
tileHeight = 60;
|
||||
fromTopEdge = 50;
|
||||
fromBottomEdge = 30;
|
||||
fromBottomEdge = 25;
|
||||
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback(afterLayout);
|
||||
|
|
45
lib/src/screens/support/support_page.dart
Normal file
45
lib/src/screens/support/support_page.dart
Normal file
|
@ -0,0 +1,45 @@
|
|||
import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arrow.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_link_provider_cell.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/view_model/settings/link_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/regular_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/support_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class SupportPage extends BasePage {
|
||||
SupportPage(this.supportViewModel);
|
||||
|
||||
final SupportViewModel supportViewModel;
|
||||
|
||||
@override
|
||||
String get title => S.current.settings_support;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
return SectionStandardList(
|
||||
sectionCount: 1,
|
||||
itemCounter: (int _) => supportViewModel.items.length,
|
||||
itemBuilder: (_, __, index) {
|
||||
final item = supportViewModel.items[index];
|
||||
|
||||
if (item is RegularListItem) {
|
||||
return SettingsCellWithArrow(
|
||||
title: item.title, handler: item.handler);
|
||||
}
|
||||
|
||||
if (item is LinkListItem) {
|
||||
return SettingsLinkProviderCell(
|
||||
title: item.title,
|
||||
icon: item.icon,
|
||||
link: item.link,
|
||||
linkTitle: item.linkTitle);
|
||||
}
|
||||
|
||||
return Container();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -148,25 +148,6 @@ abstract class SettingsViewModelBase with Store {
|
|||
_settingsStore.currentTheme = theme)
|
||||
],
|
||||
[
|
||||
LinkListItem(
|
||||
title: 'Email',
|
||||
linkTitle: 'support@cakewallet.com',
|
||||
link: 'mailto:support@cakewallet.com'),
|
||||
LinkListItem(
|
||||
title: 'Telegram',
|
||||
icon: 'assets/images/Telegram.png',
|
||||
linkTitle: '@cakewallet_bot',
|
||||
link: 'https:t.me/cakewallet_bot'),
|
||||
LinkListItem(
|
||||
title: 'Twitter',
|
||||
icon: 'assets/images/Twitter.png',
|
||||
linkTitle: '@cakewallet',
|
||||
link: 'https://twitter.com/cakewallet'),
|
||||
LinkListItem(
|
||||
title: 'ChangeNow',
|
||||
icon: 'assets/images/change_now.png',
|
||||
linkTitle: 'support@changenow.io',
|
||||
link: 'mailto:support@changenow.io'),
|
||||
RegularListItem(
|
||||
title: S.current.settings_terms_and_conditions,
|
||||
handler: (BuildContext context) =>
|
||||
|
|
44
lib/view_model/support_view_model.dart
Normal file
44
lib/view_model/support_view_model.dart
Normal file
|
@ -0,0 +1,44 @@
|
|||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/view_model/settings/link_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/regular_list_item.dart';
|
||||
import 'package:cake_wallet/view_model/settings/settings_list_item.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
part 'support_view_model.g.dart';
|
||||
|
||||
class SupportViewModel = SupportViewModelBase with _$SupportViewModel;
|
||||
|
||||
abstract class SupportViewModelBase with Store {
|
||||
SupportViewModelBase() {
|
||||
items = [
|
||||
RegularListItem(
|
||||
title: S.current.faq,
|
||||
handler: (BuildContext context) =>
|
||||
Navigator.pushNamed(context, Routes.faq),
|
||||
),
|
||||
LinkListItem(
|
||||
title: 'Email',
|
||||
linkTitle: 'support@cakewallet.com',
|
||||
link: 'mailto:support@cakewallet.com'),
|
||||
LinkListItem(
|
||||
title: 'Telegram',
|
||||
icon: 'assets/images/Telegram.png',
|
||||
linkTitle: '@cakewallet_bot',
|
||||
link: 'https:t.me/cakewallet_bot'),
|
||||
LinkListItem(
|
||||
title: 'Twitter',
|
||||
icon: 'assets/images/Twitter.png',
|
||||
linkTitle: '@cakewallet',
|
||||
link: 'https://twitter.com/cakewallet'),
|
||||
LinkListItem(
|
||||
title: 'ChangeNow',
|
||||
icon: 'assets/images/change_now.png',
|
||||
linkTitle: 'support@changenow.io',
|
||||
link: 'mailto:support@changenow.io')
|
||||
];
|
||||
}
|
||||
List<SettingsListItem> items;
|
||||
}
|
Loading…
Reference in a new issue