mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Fixes for wallet menu
This commit is contained in:
@@ -16,43 +16,71 @@ class WalletMenu {
|
|||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.reconnect,
|
title: S.current.reconnect,
|
||||||
image: Image.asset('assets/images/reconnect_menu.png',
|
image: Image.asset('assets/images/reconnect_menu.png',
|
||||||
height: 16, width: 16)),
|
height: 16, width: 16),
|
||||||
|
handler: () => _presentReconnectAlert(context)),
|
||||||
if (hasRescan)
|
if (hasRescan)
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.rescan,
|
title: S.current.rescan,
|
||||||
image: Image.asset('assets/images/filter_icon.png',
|
image: Image.asset('assets/images/filter_icon.png',
|
||||||
height: 16, width: 16, color: Palette.darkBlue)),
|
height: 16, width: 16, color: Palette.darkBlue),
|
||||||
|
handler: () => Navigator.of(context).pushNamed(Routes.rescan)),
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.wallets,
|
title: S.current.wallets,
|
||||||
image: Image.asset('assets/images/wallet_menu.png',
|
image: Image.asset('assets/images/wallet_menu.png',
|
||||||
height: 16, width: 16)),
|
height: 16, width: 16),
|
||||||
|
handler: () => Navigator.of(context).pushNamed(Routes.walletList)),
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.nodes,
|
title: S.current.nodes,
|
||||||
image: Image.asset('assets/images/nodes_menu.png',
|
image: Image.asset('assets/images/nodes_menu.png',
|
||||||
height: 16, width: 16)),
|
height: 16, width: 16),
|
||||||
|
handler: () => Navigator.of(context).pushNamed(Routes.nodeList)),
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.show_keys,
|
title: S.current.show_keys,
|
||||||
image:
|
image:
|
||||||
Image.asset('assets/images/key_menu.png', height: 16, width: 16)),
|
Image.asset('assets/images/key_menu.png', height: 16, width: 16),
|
||||||
|
handler: () {
|
||||||
|
Navigator.of(context).pushNamed(Routes.auth,
|
||||||
|
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||||
|
if (isAuthenticatedSuccessfully) {
|
||||||
|
auth.close();
|
||||||
|
Navigator.of(auth.context).pushNamed(Routes.showKeys);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}),
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.address_book_menu,
|
title: S.current.address_book_menu,
|
||||||
image: Image.asset('assets/images/open_book_menu.png',
|
image: Image.asset('assets/images/open_book_menu.png',
|
||||||
height: 16, width: 16)),
|
height: 16, width: 16),
|
||||||
|
handler: () => Navigator.of(context).pushNamed(Routes.addressBook)),
|
||||||
if(!isMoneroOnly)
|
if(!isMoneroOnly)
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.backup,
|
title: S.current.backup,
|
||||||
image: Image.asset('assets/images/restore_wallet.png',
|
image: Image.asset('assets/images/restore_wallet.png',
|
||||||
height: 16,
|
height: 16,
|
||||||
width: 16,
|
width: 16,
|
||||||
color: Palette.darkBlue)),
|
color: Palette.darkBlue),
|
||||||
|
handler: () {
|
||||||
|
Navigator
|
||||||
|
.of(context)
|
||||||
|
.pushNamed(
|
||||||
|
Routes.auth,
|
||||||
|
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
||||||
|
if (isAuthenticatedSuccessfully) {
|
||||||
|
auth.close();
|
||||||
|
Navigator.of(auth.context).pushNamed(Routes.backup);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}),
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.settings_title,
|
title: S.current.settings_title,
|
||||||
image: Image.asset('assets/images/settings_menu.png',
|
image: Image.asset('assets/images/settings_menu.png',
|
||||||
height: 16, width: 16)),
|
height: 16, width: 16),
|
||||||
|
handler: () => Navigator.of(context).pushNamed(Routes.settings)),
|
||||||
WalletMenuItem(
|
WalletMenuItem(
|
||||||
title: S.current.settings_support,
|
title: S.current.settings_support,
|
||||||
image: Image.asset('assets/images/question_mark.png',
|
image: Image.asset('assets/images/question_mark.png',
|
||||||
height: 16, width: 16, color: Palette.darkBlue)),
|
height: 16, width: 16, color: Palette.darkBlue),
|
||||||
|
handler: () => Navigator.of(context).pushNamed(Routes.support)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,55 +90,8 @@ class WalletMenu {
|
|||||||
final bool hasRescan;
|
final bool hasRescan;
|
||||||
|
|
||||||
void action(int index) {
|
void action(int index) {
|
||||||
var indx = index;
|
final item = items[index];
|
||||||
|
item?.handler();
|
||||||
if (index > 0 && !hasRescan) {
|
|
||||||
indx += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (indx) {
|
|
||||||
case 0:
|
|
||||||
_presentReconnectAlert(context);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
Navigator.of(context).pushNamed(Routes.rescan);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
Navigator.of(context).pushNamed(Routes.walletList);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
Navigator.of(context).pushNamed(Routes.nodeList);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Navigator.of(context).pushNamed(Routes.auth,
|
|
||||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
|
||||||
if (isAuthenticatedSuccessfully) {
|
|
||||||
auth.close();
|
|
||||||
Navigator.of(auth.context).pushNamed(Routes.showKeys);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
Navigator.of(context).pushNamed(Routes.addressBook);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
Navigator.of(context).pushNamed(Routes.auth,
|
|
||||||
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) {
|
|
||||||
if (isAuthenticatedSuccessfully) {
|
|
||||||
auth.close();
|
|
||||||
Navigator.of(auth.context).pushNamed(Routes.backup);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
Navigator.of(context).pushNamed(Routes.settings);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
Navigator.of(context).pushNamed(Routes.support);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _presentReconnectAlert(BuildContext context) async {
|
Future<void> _presentReconnectAlert(BuildContext context) async {
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import 'package:flutter/material.dart';
|
|||||||
class WalletMenuItem {
|
class WalletMenuItem {
|
||||||
WalletMenuItem({
|
WalletMenuItem({
|
||||||
@required this.title,
|
@required this.title,
|
||||||
@required this.image});
|
@required this.image,
|
||||||
|
@required this.handler});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final Image image;
|
final Image image;
|
||||||
|
final void Function() handler;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user