2021-01-18 20:52:12 +00:00
|
|
|
import 'package:cake_wallet/palette.dart';
|
2020-10-22 16:50:53 +00:00
|
|
|
import 'package:cake_wallet/src/screens/dashboard/wallet_menu_item.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:cake_wallet/routes.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
|
|
|
|
2020-08-27 16:54:34 +00:00
|
|
|
// FIXME: terrible design
|
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
class WalletMenu {
|
2020-12-16 19:16:47 +00:00
|
|
|
WalletMenu(this.context, this.reconnect, this.hasRescan) : items = [] {
|
|
|
|
items.addAll([
|
2022-11-16 07:29:14 +00:00
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.connection_sync,
|
|
|
|
image: Image.asset('assets/images/nodes_menu.png',
|
|
|
|
height: 16, width: 16),
|
|
|
|
handler: () => Navigator.of(context).pushNamed(Routes.connectionSync),
|
|
|
|
),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.wallets,
|
|
|
|
image: Image.asset('assets/images/wallet_menu.png',
|
|
|
|
height: 16, width: 16),
|
|
|
|
handler: () => Navigator.of(context).pushNamed(Routes.walletList),
|
|
|
|
),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.security_and_backup,
|
|
|
|
image:
|
|
|
|
Image.asset('assets/images/key_menu.png', height: 16, width: 16),
|
|
|
|
handler: () {
|
|
|
|
Navigator.of(context).pushNamed(Routes.securityBackupPage);
|
|
|
|
}),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.privacy,
|
|
|
|
image:
|
|
|
|
Image.asset('assets/images/eye_menu.png', height: 16, width: 16),
|
|
|
|
handler: () {
|
|
|
|
Navigator.of(context).pushNamed(Routes.privacyPage);
|
|
|
|
}),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.address_book_menu,
|
|
|
|
image: Image.asset('assets/images/open_book_menu.png',
|
|
|
|
height: 16, width: 16),
|
|
|
|
handler: () => Navigator.of(context).pushNamed(Routes.addressBook),
|
|
|
|
),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.display_settings,
|
|
|
|
image: Image.asset('assets/images/eye_menu.png',
|
|
|
|
height: 16, width: 16),
|
|
|
|
handler: () => Navigator.of(context).pushNamed(Routes.displaySettingsPage),
|
|
|
|
),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.other_settings,
|
|
|
|
image: Image.asset('assets/images/settings_menu.png',
|
|
|
|
height: 16, width: 16),
|
|
|
|
handler: () => Navigator.of(context).pushNamed(Routes.otherSettingsPage),
|
|
|
|
),
|
|
|
|
WalletMenuItem(
|
|
|
|
title: S.current.settings_support,
|
|
|
|
image: Image.asset('assets/images/question_mark.png',
|
|
|
|
height: 16, width: 16, color: Palette.darkBlue),
|
|
|
|
handler: () => Navigator.of(context).pushNamed(Routes.support),
|
|
|
|
),
|
2020-12-16 19:16:47 +00:00
|
|
|
]);
|
|
|
|
}
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-12-16 19:16:47 +00:00
|
|
|
final List<WalletMenuItem> items;
|
2020-01-08 12:26:34 +00:00
|
|
|
final BuildContext context;
|
2020-08-27 16:54:34 +00:00
|
|
|
final Future<void> Function() reconnect;
|
2020-12-16 19:16:47 +00:00
|
|
|
final bool hasRescan;
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
void action(int index) {
|
2021-12-30 19:14:48 +00:00
|
|
|
final item = items[index];
|
2022-11-16 07:29:14 +00:00
|
|
|
item.handler();
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
}
|