CAKE-126 | added seed item to wallet_keys_view_model; changed title of wallet_keys_page; created wallet menu item; applied wallet menu item to wallet menu; removed show seed item from wallet menu

This commit is contained in:
OleksandrSobol 2020-10-22 19:50:53 +03:00
parent ca5b4c7cc7
commit 753e898112
5 changed files with 48 additions and 34 deletions

View file

@ -1,7 +1,7 @@
import 'package:cake_wallet/src/screens/dashboard/wallet_menu_item.dart';
import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.dart'; import 'package:cake_wallet/src/screens/auth/auth_page.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
@ -11,26 +11,35 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
class WalletMenu { class WalletMenu {
WalletMenu(this.context, this.reconnect); WalletMenu(this.context, this.reconnect);
final List<String> items = [ final List<WalletMenuItem> items = [
S.current.reconnect, WalletMenuItem(
S.current.rescan, title: S.current.reconnect,
S.current.wallets, image: Image.asset('assets/images/reconnect_menu.png',
S.current.nodes, height: 16, width: 16)),
S.current.show_seed, WalletMenuItem(
S.current.show_keys, title: S.current.rescan,
S.current.address_book_menu, image: Image.asset('assets/images/filter_icon.png',
S.current.settings_title height: 16, width: 16)),
]; WalletMenuItem(
title: S.current.wallets,
final List<Image> images = [ image: Image.asset('assets/images/wallet_menu.png',
Image.asset('assets/images/reconnect_menu.png', height: 16, width: 16), height: 16, width: 16)),
Image.asset('assets/images/filter_icon.png', height: 16, width: 16), WalletMenuItem(
Image.asset('assets/images/wallet_menu.png', height: 16, width: 16), title: S.current.nodes,
Image.asset('assets/images/nodes_menu.png', height: 16, width: 16), image: Image.asset('assets/images/nodes_menu.png',
Image.asset('assets/images/eye_menu.png', height: 16, width: 16), height: 16, width: 16)),
Image.asset('assets/images/key_menu.png', height: 16, width: 16), WalletMenuItem(
Image.asset('assets/images/open_book_menu.png', height: 16, width: 16), title: S.current.show_keys,
Image.asset('assets/images/settings_menu.png', height: 16, width: 16), image: Image.asset('assets/images/key_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.address_book_menu,
image: Image.asset('assets/images/open_book_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.settings_title,
image: Image.asset('assets/images/settings_menu.png',
height: 16, width: 16)),
]; ];
final BuildContext context; final BuildContext context;
@ -51,14 +60,6 @@ class WalletMenu {
Navigator.of(context).pushNamed(Routes.nodeList); Navigator.of(context).pushNamed(Routes.nodeList);
break; break;
case 4: case 4:
Navigator.of(context).pushNamed(Routes.auth,
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) =>
isAuthenticatedSuccessfully
? Navigator.of(auth.context).popAndPushNamed(Routes.seed, arguments: false)
: null);
break;
case 5:
Navigator.of(context).pushNamed(Routes.auth, Navigator.of(context).pushNamed(Routes.auth,
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) => arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) =>
isAuthenticatedSuccessfully isAuthenticatedSuccessfully
@ -66,10 +67,10 @@ class WalletMenu {
.popAndPushNamed(Routes.showKeys) .popAndPushNamed(Routes.showKeys)
: null); : null);
break; break;
case 6: case 5:
Navigator.of(context).pushNamed(Routes.addressBook); Navigator.of(context).pushNamed(Routes.addressBook);
break; break;
case 7: case 6:
Navigator.of(context).pushNamed(Routes.settings); Navigator.of(context).pushNamed(Routes.settings);
break; break;
default: default:

View file

@ -0,0 +1,10 @@
import 'package:flutter/material.dart';
class WalletMenuItem {
WalletMenuItem({
@required this.title,
@required this.image});
final String title;
final Image image;
}

View file

@ -168,7 +168,8 @@ class MenuWidgetState extends State<MenuWidget> {
index--; index--;
final item = walletMenu.items[index]; final item = walletMenu.items[index];
final image = walletMenu.images[index] ?? Offstage(); final title = item.title;
final image = item.image ?? Offstage();
final isLastTile = index == itemCount - 1; final isLastTile = index == itemCount - 1;
return GestureDetector( return GestureDetector(
@ -199,7 +200,7 @@ class MenuWidgetState extends State<MenuWidget> {
SizedBox(width: 16), SizedBox(width: 16),
Expanded( Expanded(
child: Text( child: Text(
item, title,
style: TextStyle( style: TextStyle(
color: Theme.of(context) color: Theme.of(context)
.textTheme .textTheme

View file

@ -13,7 +13,7 @@ class WalletKeysPage extends BasePage {
WalletKeysPage(this.walletKeysViewModel); WalletKeysPage(this.walletKeysViewModel);
@override @override
String get title => S.current.wallet_keys; String get title => 'Wallet seed/keys';
final WalletKeysViewModel walletKeysViewModel; final WalletKeysViewModel walletKeysViewModel;

View file

@ -24,6 +24,8 @@ abstract class WalletKeysViewModelBase with Store {
title: S.current.view_key_public, value: keys.publicViewKey), title: S.current.view_key_public, value: keys.publicViewKey),
StandartListItem( StandartListItem(
title: S.current.view_key_private, value: keys.privateViewKey), title: S.current.view_key_private, value: keys.privateViewKey),
StandartListItem(
title: 'Wallet seed', value: wallet.seed),
]); ]);
} }