Merge pull request #54 from cake-tech/CWA-205-update-restore-wallet-screens

Cwa 205 update restore wallet screens
wownero
Oleksandr Sobol 4 years ago committed by GitHub
commit a438fa878e

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -127,18 +127,20 @@ class S implements WidgetsLocalizations {
String get remove_node_message => "Are you sure that you want to remove selected node?"; String get remove_node_message => "Are you sure that you want to remove selected node?";
String get rescan => "Rescan"; String get rescan => "Rescan";
String get reset => "Reset"; String get reset => "Reset";
String get restore_active_seed => "Active seed";
String get restore_address => "Address"; String get restore_address => "Address";
String get restore_description_from_backup => "You can restore the whole Cake Wallet app from your back-up file"; String get restore_description_from_backup => "You can restore the whole Cake Wallet app from your back-up file";
String get restore_description_from_keys => "Restore your wallet from generated keystrokes saved from your private keys"; String get restore_description_from_keys => "Restore your wallet from generated keystrokes saved from your private keys";
String get restore_description_from_seed => "Restore your wallet from either the 25 word or 13 word combination code"; String get restore_description_from_seed => "Restore your wallet from either the 25 word or 13 word combination code";
String get restore_description_from_seed_keys => "Get back your wallet from seed/keys that you've saved to secure place"; String get restore_description_from_seed_keys => "Get back your wallet from seed/keys that you've saved to secure place";
String get restore_from_seed_placeholder => "Please enter or paste your seed here"; String get restore_from_seed_placeholder => "Please enter or paste your seed here";
String get restore_new_seed => "New seed";
String get restore_next => "Next"; String get restore_next => "Next";
String get restore_recover => "Restore"; String get restore_recover => "Restore";
String get restore_restore_wallet => "Restore Wallet"; String get restore_restore_wallet => "Restore Wallet";
String get restore_seed_keys_restore => "Seed/Keys Restore"; String get restore_seed_keys_restore => "Seed/Keys Restore";
String get restore_spend_key_private => "Spend key (private)"; String get restore_spend_key_private => "Spend key (private)";
String get restore_title_from_backup => "Restore from a back-up file"; String get restore_title_from_backup => "Restore from back-up";
String get restore_title_from_keys => "Restore from keys"; String get restore_title_from_keys => "Restore from keys";
String get restore_title_from_seed => "Restore from seed"; String get restore_title_from_seed => "Restore from seed";
String get restore_title_from_seed_keys => "Restore from seed/keys"; String get restore_title_from_seed_keys => "Restore from seed/keys";
@ -465,6 +467,8 @@ class $de extends S {
@override @override
String get transaction_priority_slow => "Schleppend"; String get transaction_priority_slow => "Schleppend";
@override @override
String get restore_new_seed => "Neuer Seed";
@override
String get add => "Hinzufügen"; String get add => "Hinzufügen";
@override @override
String get remove_node => "Knoten entfernen"; String get remove_node => "Knoten entfernen";
@ -679,6 +683,8 @@ class $de extends S {
@override @override
String get settings_fee_priority => "Gebührenpriorität"; String get settings_fee_priority => "Gebührenpriorität";
@override @override
String get restore_active_seed => "Aktives Seed";
@override
String get settings_personal => "persönlich"; String get settings_personal => "persönlich";
@override @override
String get seed_title => "Seed"; String get seed_title => "Seed";
@ -1043,6 +1049,8 @@ class $hi extends S {
@override @override
String get transaction_priority_slow => "धीरे"; String get transaction_priority_slow => "धीरे";
@override @override
String get restore_new_seed => "नया बीज";
@override
String get add => "जोड़ना"; String get add => "जोड़ना";
@override @override
String get remove_node => "नोड निकालें"; String get remove_node => "नोड निकालें";
@ -1257,6 +1265,8 @@ class $hi extends S {
@override @override
String get settings_fee_priority => "शुल्क प्राथमिकता"; String get settings_fee_priority => "शुल्क प्राथमिकता";
@override @override
String get restore_active_seed => "सक्रिय बीज";
@override
String get settings_personal => "निजी"; String get settings_personal => "निजी";
@override @override
String get seed_title => "बीज"; String get seed_title => "बीज";
@ -1621,6 +1631,8 @@ class $ru extends S {
@override @override
String get transaction_priority_slow => "Медленный"; String get transaction_priority_slow => "Медленный";
@override @override
String get restore_new_seed => "Новая мнемоническая фраза";
@override
String get add => "Добавить"; String get add => "Добавить";
@override @override
String get remove_node => "Удалить ноду"; String get remove_node => "Удалить ноду";
@ -1835,6 +1847,8 @@ class $ru extends S {
@override @override
String get settings_fee_priority => "Приоритет транзакции"; String get settings_fee_priority => "Приоритет транзакции";
@override @override
String get restore_active_seed => "Активная мнемоническая фраза";
@override
String get settings_personal => "Персональные"; String get settings_personal => "Персональные";
@override @override
String get seed_title => "Мнемоническая фраза"; String get seed_title => "Мнемоническая фраза";
@ -2199,6 +2213,8 @@ class $ko extends S {
@override @override
String get transaction_priority_slow => "느린"; String get transaction_priority_slow => "느린";
@override @override
String get restore_new_seed => "새로운 씨앗";
@override
String get add => "더하다"; String get add => "더하다";
@override @override
String get remove_node => "노드 제거"; String get remove_node => "노드 제거";
@ -2413,6 +2429,8 @@ class $ko extends S {
@override @override
String get settings_fee_priority => "수수료 우선"; String get settings_fee_priority => "수수료 우선";
@override @override
String get restore_active_seed => "활성 종자";
@override
String get settings_personal => "개인적인"; String get settings_personal => "개인적인";
@override @override
String get seed_title => ""; String get seed_title => "";
@ -2777,6 +2795,8 @@ class $pt extends S {
@override @override
String get transaction_priority_slow => "Lenta"; String get transaction_priority_slow => "Lenta";
@override @override
String get restore_new_seed => "Nova semente";
@override
String get add => "Adicionar"; String get add => "Adicionar";
@override @override
String get remove_node => "Remover nó"; String get remove_node => "Remover nó";
@ -2991,6 +3011,8 @@ class $pt extends S {
@override @override
String get settings_fee_priority => "Prioridade da taxa"; String get settings_fee_priority => "Prioridade da taxa";
@override @override
String get restore_active_seed => "Semente ativa";
@override
String get settings_personal => "Pessoal"; String get settings_personal => "Pessoal";
@override @override
String get seed_title => "Semente"; String get seed_title => "Semente";
@ -3355,6 +3377,8 @@ class $uk extends S {
@override @override
String get transaction_priority_slow => "Повільний"; String get transaction_priority_slow => "Повільний";
@override @override
String get restore_new_seed => "Нова мнемонічна фраза";
@override
String get add => "Добавити"; String get add => "Добавити";
@override @override
String get remove_node => "Видалити вузол"; String get remove_node => "Видалити вузол";
@ -3569,6 +3593,8 @@ class $uk extends S {
@override @override
String get settings_fee_priority => "Пріоритет транзакції"; String get settings_fee_priority => "Пріоритет транзакції";
@override @override
String get restore_active_seed => "Активна мнемонічна фраза";
@override
String get settings_personal => "Персональні"; String get settings_personal => "Персональні";
@override @override
String get seed_title => "Мнемонічна фраза"; String get seed_title => "Мнемонічна фраза";
@ -3933,6 +3959,8 @@ class $ja extends S {
@override @override
String get transaction_priority_slow => "スロー"; String get transaction_priority_slow => "スロー";
@override @override
String get restore_new_seed => "新しい種";
@override
String get add => "加える"; String get add => "加える";
@override @override
String get remove_node => "ノードを削除"; String get remove_node => "ノードを削除";
@ -4147,6 +4175,8 @@ class $ja extends S {
@override @override
String get settings_fee_priority => "料金優先"; String get settings_fee_priority => "料金優先";
@override @override
String get restore_active_seed => "アクティブシード";
@override
String get settings_personal => "パーソナル"; String get settings_personal => "パーソナル";
@override @override
String get seed_title => "シード"; String get seed_title => "シード";
@ -4515,6 +4545,8 @@ class $pl extends S {
@override @override
String get transaction_priority_slow => "Powolny"; String get transaction_priority_slow => "Powolny";
@override @override
String get restore_new_seed => "Nowe nasienie";
@override
String get add => "Dodaj"; String get add => "Dodaj";
@override @override
String get remove_node => "Usuń węzeł"; String get remove_node => "Usuń węzeł";
@ -4729,6 +4761,8 @@ class $pl extends S {
@override @override
String get settings_fee_priority => "Priorytet opłaty"; String get settings_fee_priority => "Priorytet opłaty";
@override @override
String get restore_active_seed => "Aktywne nasiona";
@override
String get settings_personal => "Osobisty"; String get settings_personal => "Osobisty";
@override @override
String get seed_title => "Ziarno"; String get seed_title => "Ziarno";
@ -5093,6 +5127,8 @@ class $es extends S {
@override @override
String get transaction_priority_slow => "Lento"; String get transaction_priority_slow => "Lento";
@override @override
String get restore_new_seed => "Nueva semilla";
@override
String get add => "Añadir"; String get add => "Añadir";
@override @override
String get remove_node => "Eliminar nodo"; String get remove_node => "Eliminar nodo";
@ -5307,6 +5343,8 @@ class $es extends S {
@override @override
String get settings_fee_priority => "Prioridad de tasa"; String get settings_fee_priority => "Prioridad de tasa";
@override @override
String get restore_active_seed => "Semilla activa";
@override
String get settings_personal => "Personal"; String get settings_personal => "Personal";
@override @override
String get seed_title => "Semilla"; String get seed_title => "Semilla";
@ -5671,6 +5709,8 @@ class $nl extends S {
@override @override
String get transaction_priority_slow => "Langzaam"; String get transaction_priority_slow => "Langzaam";
@override @override
String get restore_new_seed => "Nieuw zaad";
@override
String get add => "Toevoegen"; String get add => "Toevoegen";
@override @override
String get remove_node => "Knoop verwijderen"; String get remove_node => "Knoop verwijderen";
@ -5885,6 +5925,8 @@ class $nl extends S {
@override @override
String get settings_fee_priority => "Tariefprioriteit"; String get settings_fee_priority => "Tariefprioriteit";
@override @override
String get restore_active_seed => "Actief zaad";
@override
String get settings_personal => "Persoonlijk"; String get settings_personal => "Persoonlijk";
@override @override
String get seed_title => "Zaad"; String get seed_title => "Zaad";
@ -6249,6 +6291,8 @@ class $zh extends S {
@override @override
String get transaction_priority_slow => ""; String get transaction_priority_slow => "";
@override @override
String get restore_new_seed => "新種子";
@override
String get add => ""; String get add => "";
@override @override
String get remove_node => "删除节点"; String get remove_node => "删除节点";
@ -6463,6 +6507,8 @@ class $zh extends S {
@override @override
String get settings_fee_priority => "费用优先"; String get settings_fee_priority => "费用优先";
@override @override
String get restore_active_seed => "活性種子";
@override
String get settings_personal => "个人"; String get settings_personal => "个人";
@override @override
String get seed_title => "种子"; String get seed_title => "种子";

@ -63,7 +63,7 @@ abstract class BasePage extends StatelessWidget {
: Text( : Text(
title, title,
style: TextStyle( style: TextStyle(
fontSize: 22.0, fontSize: 18.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white), color: Colors.white),
//color: Theme.of(context).primaryTextTheme.title.color), //color: Theme.of(context).primaryTextTheme.title.color),

@ -3,57 +3,50 @@ import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/src/screens/restore/widgets/restore_button.dart'; import 'package:cake_wallet/src/screens/restore/widgets/restore_button.dart';
import 'package:cake_wallet/src/screens/restore/widgets/image_widget.dart';
import 'package:cake_wallet/src/screens/restore/widgets/base_restore_widget.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
class RestoreOptionsPage extends BasePage { class RestoreOptionsPage extends BasePage {
static const _aspectRatioImage = 2.086;
@override @override
String get title => S.current.restore_restore_wallet; String get title => S.current.restore_restore_wallet;
@override @override
Color get backgroundColor => Palette.creamyGrey; Color get backgroundColor => PaletteDark.historyPanel;
final _imageSeedKeys = Image.asset('assets/images/seedKeys.png'); final imageSeedKeys = Image.asset('assets/images/restore_wallet_image.png');
final _imageRestoreSeed = Image.asset('assets/images/restoreSeed.png'); final imageBackup = Image.asset('assets/images/backup.png');
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final isLargeScreen = MediaQuery.of(context).size.height > largeHeight; return Container(
width: double.infinity,
return BaseRestoreWidget( height: double.infinity,
firstRestoreButton: RestoreButton( padding: EdgeInsets.all(24),
onPressed: () => color: PaletteDark.historyPanel,
Navigator.pushNamed( child: SingleChildScrollView(
context, Routes.restoreWalletOptionsFromWelcome), child: Column(
imageWidget: ImageWidget( children: <Widget>[
image: _imageSeedKeys, RestoreButton(
aspectRatioImage: _aspectRatioImage, onPressed: () =>
isLargeScreen: isLargeScreen, Navigator.pushNamed(
), context, Routes.restoreWalletOptionsFromWelcome),
titleColor: Palette.lightViolet, image: imageSeedKeys,
color: Palette.lightViolet, title: S.of(context).restore_title_from_seed_keys,
title: S.of(context).restore_title_from_seed_keys, description: S.of(context).restore_description_from_seed_keys
description: S.of(context).restore_description_from_seed_keys, ),
textButton: S.of(context).restore_next, Padding(
), padding: EdgeInsets.only(top: 24),
secondRestoreButton: RestoreButton( child: RestoreButton(
onPressed: () {}, onPressed: () {},
imageWidget: ImageWidget( image: imageBackup,
image: _imageRestoreSeed, title: S.of(context).restore_title_from_backup,
aspectRatioImage: _aspectRatioImage, description: S.of(context).restore_description_from_backup
isLargeScreen: isLargeScreen, ),
)
],
), ),
titleColor: Palette.cakeGreen, )
color: Palette.cakeGreen,
title: S.of(context).restore_title_from_backup,
description: S.of(context).restore_description_from_backup,
textButton: S.of(context).restore_next,
),
isLargeScreen: isLargeScreen,
); );
} }
} }

@ -16,6 +16,7 @@ import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart'; import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:cake_wallet/src/screens/restore/widgets/restore_alert_dialog.dart';
class RestoreWalletFromKeysPage extends BasePage { class RestoreWalletFromKeysPage extends BasePage {
RestoreWalletFromKeysPage( RestoreWalletFromKeysPage(
@ -30,6 +31,9 @@ class RestoreWalletFromKeysPage extends BasePage {
@override @override
String get title => S.current.restore_title_from_keys; String get title => S.current.restore_title_from_keys;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override @override
Widget body(BuildContext context) => RestoreFromKeysFrom(); Widget body(BuildContext context) => RestoreFromKeysFrom();
} }
@ -47,11 +51,36 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
final _viewKeyController = TextEditingController(); final _viewKeyController = TextEditingController();
final _spendKeyController = TextEditingController(); final _spendKeyController = TextEditingController();
@override
void dispose() {
_nameController.dispose();
_addressController.dispose();
_viewKeyController.dispose();
_spendKeyController.dispose();
super.dispose();
}
void onHandleControllers(WalletRestorationStore walletRestorationStore) {
if (_nameController.text.isNotEmpty &&
_addressController.text.isNotEmpty &&
_viewKeyController.text.isNotEmpty &&
_spendKeyController.text.isNotEmpty) {
walletRestorationStore.setDisabledState(false);
} else {
walletRestorationStore.setDisabledState(true);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletRestorationStore = Provider.of<WalletRestorationStore>(context); final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
final seedLanguageStore = Provider.of<SeedLanguageStore>(context); final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
_nameController.addListener(() {onHandleControllers(walletRestorationStore);});
_addressController.addListener(() {onHandleControllers(walletRestorationStore);});
_viewKeyController.addListener(() {onHandleControllers(walletRestorationStore);});
_spendKeyController.addListener(() {onHandleControllers(walletRestorationStore);});
reaction((_) => walletRestorationStore.state, (WalletRestorationState state) { reaction((_) => walletRestorationStore.state, (WalletRestorationState state) {
if (state is WalletRestoredSuccessfully) { if (state is WalletRestoredSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);
@ -62,48 +91,49 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
showDialog<void>( showDialog<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return RestoreAlertDialog(
content: Text(state.error), restoreTitle: S.current.restore_title_from_keys,
actions: <Widget>[ restoreContent: state.error,
FlatButton( restoreButtonText: S.of(context).ok,
child: Text(S.of(context).ok), restoreButtonAction: () => Navigator.of(context).pop(),
onPressed: () => Navigator.of(context).pop(),
),
],
); );
}); });
}); });
} }
}); });
return ScrollableWithBottomSection( return Container(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 20.0), color: PaletteDark.historyPanel,
content: Form( padding: EdgeInsets.only(left: 24, right: 24),
key: _formKey, child: ScrollableWithBottomSection(
child: Column( contentPadding: EdgeInsets.only(bottom: 24.0),
crossAxisAlignment: CrossAxisAlignment.start, content: Form(
children: <Widget>[ key: _formKey,
Padding( child: Column(children: <Widget>[
padding: EdgeInsets.only(left: 13, right: 13), Row(
child: Column(children: <Widget>[ children: <Widget>[
Row( Flexible(
children: <Widget>[ child: Container(
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 14.0), style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _nameController, controller: _nameController,
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle: TextStyle(
TextStyle(color: Theme.of(context).hintColor), color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_wallet_name, hintText: S.of(context).restore_wallet_name,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)), color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).focusColor, color: PaletteDark.menuList,
width: 1.0))), width: 1.0))),
validator: (value) { validator: (value) {
walletRestorationStore.validateWalletName(value); walletRestorationStore.validateWalletName(value);
@ -111,28 +141,34 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}, },
), ),
)) ))
], ],
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 14.0), style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _addressController, controller: _addressController,
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
maxLines: null, maxLines: null,
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle: TextStyle(
TextStyle(color: Theme.of(context).hintColor), color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_address, hintText: S.of(context).restore_address,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)), color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).focusColor, color: PaletteDark.menuList,
width: 1.0))), width: 1.0))),
validator: (value) { validator: (value) {
walletRestorationStore.validateAddress(value); walletRestorationStore.validateAddress(value);
@ -140,26 +176,32 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}, },
), ),
)) ))
], ],
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 14.0), style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _viewKeyController, controller: _viewKeyController,
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle: TextStyle(
TextStyle(color: Theme.of(context).hintColor), color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_view_key_private, hintText: S.of(context).restore_view_key_private,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)), color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).focusColor, color: PaletteDark.menuList,
width: 1.0))), width: 1.0))),
validator: (value) { validator: (value) {
walletRestorationStore.validateKeys(value); walletRestorationStore.validateKeys(value);
@ -167,26 +209,32 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}, },
), ),
)) ))
], ],
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 14.0), style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _spendKeyController, controller: _spendKeyController,
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle: TextStyle(
TextStyle(color: Theme.of(context).hintColor), color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_spend_key_private, hintText: S.of(context).restore_spend_key_private,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)), color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).focusColor, color: PaletteDark.menuList,
width: 1.0))), width: 1.0))),
validator: (value) { validator: (value) {
walletRestorationStore.validateKeys(value); walletRestorationStore.validateKeys(value);
@ -194,16 +242,14 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}, },
), ),
)) ))
], ],
), ),
BlockchainHeightWidget(key: _blockchainHeightKey), BlockchainHeightWidget(key: _blockchainHeightKey),
]), ]),
)
],
), ),
), bottomSectionPadding: EdgeInsets.only(bottom: 24),
bottomSection: Observer(builder: (_) { bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton( return LoadingPrimaryButton(
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
walletRestorationStore.restoreFromKeys( walletRestorationStore.restoreFromKeys(
@ -216,9 +262,12 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
} }
}, },
text: S.of(context).restore_recover, text: S.of(context).restore_recover,
color: Theme.of(context).primaryTextTheme.button.backgroundColor, color: Colors.green,
textColor: Theme.of(context).primaryTextTheme.button.color,); textColor: Colors.white,
}), isDisabled: walletRestorationStore.disabledState,
);
}),
),
); );
} }
} }

@ -11,11 +11,15 @@ import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/restore/widgets/restore_alert_dialog.dart';
class RestoreWalletFromSeedDetailsPage extends BasePage { class RestoreWalletFromSeedDetailsPage extends BasePage {
@override @override
String get title => S.current.restore_wallet_restore_description; String get title => S.current.restore_wallet_restore_description;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override @override
Widget body(BuildContext context) => RestoreFromSeedDetailsForm(); Widget body(BuildContext context) => RestoreFromSeedDetailsForm();
} }
@ -32,10 +36,24 @@ class _RestoreFromSeedDetailsFormState
final _blockchainHeightKey = GlobalKey<BlockchainHeightState>(); final _blockchainHeightKey = GlobalKey<BlockchainHeightState>();
final _nameController = TextEditingController(); final _nameController = TextEditingController();
@override
void dispose() {
_nameController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletRestorationStore = Provider.of<WalletRestorationStore>(context); final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
_nameController.addListener(() {
if (_nameController.text.isNotEmpty) {
walletRestorationStore.setDisabledState(false);
} else {
walletRestorationStore.setDisabledState(true);
}
});
reaction((_) => walletRestorationStore.state, (WalletRestorationState state) { reaction((_) => walletRestorationStore.state, (WalletRestorationState state) {
if (state is WalletRestoredSuccessfully) { if (state is WalletRestoredSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);
@ -46,68 +64,66 @@ class _RestoreFromSeedDetailsFormState
showDialog<void>( showDialog<void>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return RestoreAlertDialog(
content: Text(state.error), restoreTitle: S.current.restore_wallet_restore_description,
actions: <Widget>[ restoreContent: state.error,
FlatButton( restoreButtonText: S.of(context).ok,
child: Text(S.of(context).ok), restoreButtonAction: () => Navigator.of(context).pop(),
onPressed: () => Navigator.of(context).pop(),
),
],
); );
}); });
}); });
} }
}); });
return ScrollableWithBottomSection( return Container(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 20.0), color: PaletteDark.historyPanel,
content: Form( padding: EdgeInsets.only(left: 24, right: 24),
key: _formKey, child: ScrollableWithBottomSection(
child: Column( contentPadding: EdgeInsets.only(bottom: 24.0),
crossAxisAlignment: CrossAxisAlignment.start, content: Form(
children: <Widget>[ key: _formKey,
Padding( child: Column(
padding: EdgeInsets.only(left: 13, right: 13), children: <Widget>[
child: Column( Row(
mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
children: <Widget>[ Flexible(
Row( child: Container(
children: <Widget>[ padding: EdgeInsets.only(top: 20.0),
Flexible( child: TextFormField(
child: Container( style: TextStyle(
padding: EdgeInsets.only(top: 20.0), fontSize: 16.0,
child: TextFormField( color: Colors.white
style: TextStyle(fontSize: 14.0),
controller: _nameController,
decoration: InputDecoration(
hintStyle: TextStyle(
color: Theme.of(context).hintColor),
hintText: S.of(context).restore_wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Palette.cakeGreen,
width: 2.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor,
width: 1.0))),
validator: (value) {
walletRestorationStore
.validateWalletName(value);
return walletRestorationStore.errorMessage;
},
), ),
)) controller: _nameController,
], decoration: InputDecoration(
), hintStyle: TextStyle(
BlockchainHeightWidget(key: _blockchainHeightKey), color: PaletteDark.walletCardText,
])) fontSize: 16
], ),
hintText: S.of(context).restore_wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteDark.menuList,
width: 1.0))),
validator: (value) {
walletRestorationStore
.validateWalletName(value);
return walletRestorationStore.errorMessage;
},
),
))
],
),
BlockchainHeightWidget(key: _blockchainHeightKey),
]),
), ),
), bottomSectionPadding: EdgeInsets.only(bottom: 24),
bottomSection: Observer(builder: (_) { bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton( return LoadingPrimaryButton(
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
walletRestorationStore.restoreFromSeed( walletRestorationStore.restoreFromSeed(
@ -117,9 +133,12 @@ class _RestoreFromSeedDetailsFormState
}, },
isLoading: walletRestorationStore.state is WalletIsRestoring, isLoading: walletRestorationStore.state is WalletIsRestoring,
text: S.of(context).restore_recover, text: S.of(context).restore_recover,
color: Theme.of(context).primaryTextTheme.button.backgroundColor, color: Colors.green,
textColor: Theme.of(context).primaryTextTheme.button.color,); textColor: Colors.white,
}), isDisabled: walletRestorationStore.disabledState,
);
}),
),
); );
} }
} }

@ -11,6 +11,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_store.dart'; import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_store.dart';
import 'package:cake_wallet/src/widgets/seed_widget.dart'; import 'package:cake_wallet/src/widgets/seed_widget.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart'; import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:cake_wallet/palette.dart';
class RestoreWalletFromSeedPage extends BasePage { class RestoreWalletFromSeedPage extends BasePage {
RestoreWalletFromSeedPage( RestoreWalletFromSeedPage(
@ -27,13 +28,7 @@ class RestoreWalletFromSeedPage extends BasePage {
String get title => S.current.restore_title_from_seed; String get title => S.current.restore_title_from_seed;
@override @override
Widget trailing(BuildContext context) => SizedBox( Color get backgroundColor => PaletteDark.menuList;
width: 80,
height: 20,
child: FlatButton(
child: Text(S.of(context).clear),
padding: EdgeInsets.all(0),
onPressed: () => formKey?.currentState?.clear()));
@override @override
Widget body(BuildContext context) => RestoreFromSeedForm(key: formKey); Widget body(BuildContext context) => RestoreFromSeedForm(key: formKey);
@ -59,7 +54,7 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
onTap: () => onTap: () =>
SystemChannels.textInput.invokeMethod<void>('TextInput.hide'), SystemChannels.textInput.invokeMethod<void>('TextInput.hide'),
child: Container( child: Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0), color: PaletteDark.historyPanel,
child: SeedWidget( child: SeedWidget(
key: _seedKey, key: _seedKey,
onMnemoticChange: (seed) => walletRestorationStore.setSeed(seed), onMnemoticChange: (seed) => walletRestorationStore.setSeed(seed),

@ -3,62 +3,58 @@ import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/restore/widgets/restore_button.dart'; import 'package:cake_wallet/src/screens/restore/widgets/restore_button.dart';
import 'package:cake_wallet/src/screens/restore/widgets/image_widget.dart';
import 'package:cake_wallet/src/screens/restore/widgets/base_restore_widget.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart'; import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class RestoreWalletOptionsPage extends BasePage { class RestoreWalletOptionsPage extends BasePage {
static const _aspectRatioImage = 2.086;
@override @override
String get title => S.current.restore_seed_keys_restore; String get title => S.current.restore_seed_keys_restore;
@override @override
Color get backgroundColor => Palette.creamyGrey; Color get backgroundColor => PaletteDark.historyPanel;
final _imageSeed = Image.asset('assets/images/seedIco.png'); final imageSeed = Image.asset('assets/images/restore_seed.png');
final _imageKeys = Image.asset('assets/images/keysIco.png'); final imageKeys = Image.asset('assets/images/restore_keys.png');
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final seedLanguageStore = Provider.of<SeedLanguageStore>(context); final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
final isLargeScreen = MediaQuery.of(context).size.height > largeHeight;
return BaseRestoreWidget( return Container(
firstRestoreButton: RestoreButton( width: double.infinity,
onPressed: () { height: double.infinity,
seedLanguageStore.setCurrentRoute(Routes.restoreWalletFromSeed); padding: EdgeInsets.all(24),
Navigator.pushNamed(context, Routes.seedLanguage); color: PaletteDark.historyPanel,
}, child: SingleChildScrollView(
imageWidget: ImageWidget( child: Column(
image: _imageSeed, children: <Widget>[
aspectRatioImage: _aspectRatioImage, RestoreButton(
isLargeScreen: isLargeScreen), onPressed: () {
titleColor: Palette.lightViolet, seedLanguageStore.setCurrentRoute(Routes.restoreWalletFromSeed);
color: Palette.lightViolet, Navigator.pushNamed(context, Routes.seedLanguage);
title: S.of(context).restore_title_from_seed, },
description: S.of(context).restore_description_from_seed, image: imageSeed,
textButton: S.of(context).restore_next, title: S.of(context).restore_title_from_seed,
), description: S.of(context).restore_description_from_seed
secondRestoreButton: RestoreButton( ),
onPressed: () { Padding(
seedLanguageStore.setCurrentRoute(Routes.restoreWalletFromKeys); padding: EdgeInsets.only(top: 24),
Navigator.pushNamed(context, Routes.seedLanguage); child: RestoreButton(
}, onPressed: () {
imageWidget: ImageWidget( seedLanguageStore.setCurrentRoute(Routes.restoreWalletFromKeys);
image: _imageKeys, Navigator.pushNamed(context, Routes.seedLanguage);
aspectRatioImage: _aspectRatioImage, },
isLargeScreen: isLargeScreen), image: imageKeys,
titleColor: Palette.cakeGreen, title: S.of(context).restore_title_from_keys,
color: Palette.cakeGreen, description: S.of(context).restore_description_from_keys
title: S.of(context).restore_title_from_keys, ),
description: S.of(context).restore_description_from_keys, )
textButton: S.of(context).restore_next, ],
), ),
isLargeScreen: isLargeScreen, )
); );
} }
} }

@ -1,44 +0,0 @@
import 'package:flutter/material.dart';
const largeHeight = 700;
class BaseRestoreWidget extends StatelessWidget {
BaseRestoreWidget({
@required this.firstRestoreButton,
@required this.secondRestoreButton,
this.isLargeScreen = false
});
final Widget firstRestoreButton;
final Widget secondRestoreButton;
final bool isLargeScreen;
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(
left: 20.0,
right: 20.0,
),
child: isLargeScreen
? Column(
children: <Widget>[
Flexible(
child: firstRestoreButton
),
Flexible(
child: secondRestoreButton
)
],
)
: SingleChildScrollView(
child: Column(
children: <Widget>[
firstRestoreButton,
secondRestoreButton
],
),
)
);
}
}

@ -1,29 +0,0 @@
import 'package:flutter/material.dart';
class ImageWidget extends StatelessWidget {
ImageWidget({
@required this.image,
@required this.aspectRatioImage,
this.isLargeScreen = false});
final Image image;
final double aspectRatioImage;
final bool isLargeScreen;
@override
Widget build(BuildContext context) {
return isLargeScreen
? Flexible(
child: Container(
child: AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(
fit: BoxFit.contain,
child: image,
),
),
),
)
: image;
}
}

@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
class RestoreAlertDialog extends BaseAlertDialog {
RestoreAlertDialog({
@required this.restoreTitle,
@required this.restoreContent,
@required this.restoreButtonText,
@required this.restoreButtonAction,
});
final String restoreTitle;
final String restoreContent;
final String restoreButtonText;
final VoidCallback restoreButtonAction;
@override
String get titleText => restoreTitle;
@override
String get contentText => restoreContent;
@override
Widget actionButtons(BuildContext context) {
return Container(
width: 300,
height: 52,
padding: EdgeInsets.only(left: 12, right: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24),
bottomRight: Radius.circular(24)
),
color: Colors.white
),
child: ButtonTheme(
minWidth: double.infinity,
child: FlatButton(
onPressed: restoreButtonAction,
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
child: Text(
restoreButtonText,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: Colors.blue,
decoration: TextDecoration.none,
),
)),
),
);
}
}

@ -1,101 +1,71 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:auto_size_text/auto_size_text.dart';
class RestoreButton extends StatelessWidget { class RestoreButton extends StatelessWidget {
const RestoreButton( const RestoreButton({
{@required this.onPressed, @required this.onPressed,
@required this.imageWidget, @required this.image,
@required this.color, @required this.title,
@required this.titleColor, @required this.description});
this.title = '',
this.description = '',
this.textButton = ''});
final VoidCallback onPressed; final VoidCallback onPressed;
final Widget imageWidget; final Image image;
final Color color;
final Color titleColor;
final String title; final String title;
final String description; final String description;
final String textButton;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return GestureDetector(
margin: EdgeInsets.only(top: 20.0, bottom: 20.0), onTap: onPressed,
decoration: BoxDecoration( child: Container(
color: Theme.of(context).accentTextTheme.headline.backgroundColor, width: double.infinity,
borderRadius: BorderRadius.all(Radius.circular(20.0)), height: 150,
boxShadow: [ padding: EdgeInsets.all(24),
BoxShadow( alignment: Alignment.topLeft,
color: Palette.buttonShadow, decoration: BoxDecoration(
blurRadius: 10, borderRadius: BorderRadius.all(Radius.circular(12)),
offset: Offset( color: PaletteDark.menuList
0, ),
12, child: Row(
), mainAxisSize: MainAxisSize.max,
) mainAxisAlignment: MainAxisAlignment.start,
]), crossAxisAlignment: CrossAxisAlignment.start,
child: InkWell( children: <Widget>[
onTap: onPressed, image,
borderRadius: BorderRadius.all(Radius.circular(20.0)), Expanded(
child: Column( child: Padding(
mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: EdgeInsets.only(left: 16),
children: <Widget>[ child: Column(
imageWidget, mainAxisSize: MainAxisSize.max,
Column( mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
Padding( children: <Widget>[
padding: EdgeInsets.only(left: 20, right: 20), Text(
child: AutoSizeText(
title, title,
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: titleColor, fontSize: 16,
fontWeight: FontWeight.bold), fontWeight: FontWeight.w600,
maxLines: 2, color: Colors.white
),
), ),
), Padding(
Padding( padding: EdgeInsets.only(top: 5),
padding: EdgeInsets.only(left: 20, right: 20, top: 10), child: Text(
child: AutoSizeText( description,
description, style: TextStyle(
textAlign: TextAlign.center, fontSize: 14,
style: TextStyle( color: PaletteDark.walletCardText
color: Theme.of(context).accentTextTheme.subhead.color, ),
), ),
maxLines: 2,
) )
) ],
], ),
), ),
SizedBox( )
height: 20, ],
), ),
Container( ),
height: 56.0,
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: Theme.of(context)
.accentTextTheme
.headline
.decorationColor,
width: 1.15)),
color: Colors.transparent,
),
child: Center(
child: Text(
textButton,
style: TextStyle(
color: color,
fontSize: 16.0,
fontWeight: FontWeight.bold),
),
))
],
)),
); );
} }
} }

@ -1,52 +1,99 @@
import 'package:provider/provider.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:provider/provider.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart'; import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
class SeedLanguage extends BasePage { class SeedLanguage extends BasePage {
final imageSeed = Image.asset('assets/images/seedIco.png'); @override
Color get backgroundColor => PaletteDark.historyPanel;
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) => SeedLanguageForm();
}
class SeedLanguageForm extends StatefulWidget {
@override
SeedLanguageFormState createState() => SeedLanguageFormState();
}
class SeedLanguageFormState extends State<SeedLanguageForm> {
static const aspectRatioImage = 1.22;
final walletNameImage = Image.asset('assets/images/wallet_name.png');
@override
Widget build(BuildContext context) {
final seedLanguageStore = Provider.of<SeedLanguageStore>(context); final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
final List<String> seedLocales = [
S.current.seed_language_english,
S.current.seed_language_chinese,
S.current.seed_language_dutch,
S.current.seed_language_german,
S.current.seed_language_japanese,
S.current.seed_language_portuguese,
S.current.seed_language_russian,
S.current.seed_language_spanish
];
return Container( return Container(
padding: EdgeInsets.all(20.0), color: PaletteDark.historyPanel,
child: Column( padding: EdgeInsets.only(top: 24),
children: <Widget>[ child: ScrollableWithBottomSection(
Expanded( contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
child: Center( content: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, children: [
children: <Widget>[ Padding(
imageSeed, padding: EdgeInsets.only(left: 12, right: 12),
Text( child: AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(child: walletNameImage, fit: BoxFit.fill)),
),
Padding(padding: EdgeInsets.only(top: 40),
child: Text(
S.of(context).seed_language_choose, S.of(context).seed_language_choose,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 16.0), style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: Colors.white
),
), ),
SizedBox( ),
height: 20.0, Padding(padding: EdgeInsets.only(top: 24),
child: Observer(
builder: (_) => SelectButton(
image: null,
text: seedLocales[seedLanguages.indexOf(seedLanguageStore.selectedSeedLanguage)],
color: PaletteDark.menuList,
textColor: Colors.white,
onTap: () async => await showDialog(
context: context,
builder: (BuildContext context) => SeedLanguagePicker()
)
)
), ),
SeedLanguagePicker(), )
], ]),
), bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
), bottomSection: Observer(
), builder: (context) {
PrimaryButton( return PrimaryButton(
onPressed: () => onPressed: () =>
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute), Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
text: S.of(context).seed_language_next, text: S.of(context).seed_language_next,
color: color: Colors.green,
Theme.of(context).primaryTextTheme.button.backgroundColor, textColor: Colors.white);
textColor: },
Theme.of(context).primaryTextTheme.button.color), )),
],
),
); );
} }
} }

@ -20,6 +20,7 @@ abstract class WalleRestorationStoreBase with Store {
@required this.walletListService, @required this.walletListService,
@required this.sharedPreferences}) { @required this.sharedPreferences}) {
state = WalletRestorationStateInitial(); state = WalletRestorationStateInitial();
disabledState = true;
} }
final AuthenticationStore authStore; final AuthenticationStore authStore;
@ -38,6 +39,9 @@ abstract class WalleRestorationStoreBase with Store {
@observable @observable
List<MnemoticItem> seed; List<MnemoticItem> seed;
@observable
bool disabledState;
@action @action
Future restoreFromSeed({String name, String seed, int restoreHeight}) async { Future restoreFromSeed({String name, String seed, int restoreHeight}) async {
state = WalletRestorationStateInitial(); state = WalletRestorationStateInitial();
@ -109,6 +113,11 @@ abstract class WalleRestorationStoreBase with Store {
return seed.fold('', (acc, item) => acc + ' ' + item.toString()); return seed.fold('', (acc, item) => acc + ' ' + item.toString());
} }
@action
void setDisabledState(bool isDisable) {
disabledState = isDisable;
}
void validateWalletName(String value) { void validateWalletName(String value) {
const pattern = '^[a-zA-Z0-9_]{1,15}\$'; const pattern = '^[a-zA-Z0-9_]{1,15}\$';
final regExp = RegExp(pattern); final regExp = RegExp(pattern);

@ -37,19 +37,27 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0, bottom: 10.0), padding: EdgeInsets.only(top: 20.0, bottom: 10.0),
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 14.0), style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: restoreHeightController, controller: restoreHeightController,
keyboardType: TextInputType.numberWithOptions( keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: false), signed: false, decimal: false),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle(color: Theme.of(context).hintColor), hintStyle: TextStyle(
color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).widgets_restore_from_blockheight, hintText: S.of(context).widgets_restore_from_blockheight,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)), color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).focusColor, width: 1.0))), color: PaletteDark.menuList,
width: 1.0))),
), ),
)) ))
], ],
@ -61,7 +69,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color), color: Colors.white),
), ),
), ),
Row( Row(
@ -72,18 +80,23 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
onTap: () => _selectDate(context), onTap: () => _selectDate(context),
child: IgnorePointer( child: IgnorePointer(
child: TextFormField( child: TextFormField(
style: TextStyle(fontSize: 14.0), style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle: TextStyle(
TextStyle(color: Theme.of(context).hintColor), color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).widgets_restore_from_date, hintText: S.of(context).widgets_restore_from_date,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Palette.cakeGreen, color: PaletteDark.menuList,
width: 2.0)), width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).focusColor, color: PaletteDark.menuList,
width: 1.0))), width: 1.0))),
controller: dateController, controller: dateController,
validator: (value) { validator: (value) {

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class PrimaryButton extends StatelessWidget { class PrimaryButton extends StatelessWidget {
const PrimaryButton( const PrimaryButton(
@ -26,18 +27,18 @@ class PrimaryButton extends StatelessWidget {
onPressed: isDisabled onPressed: isDisabled
? (onDisabledPressed != null ? onDisabledPressed : null) ? (onDisabledPressed != null ? onDisabledPressed : null)
: onPressed, : onPressed,
color: color, color: isDisabled ? color.withOpacity(0.5) : color,
disabledColor: color.withOpacity(0.5), disabledColor: color.withOpacity(0.5),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(26.0)), borderRadius: BorderRadius.circular(26.0)),
child: Text(text, child: Text(text,
textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: isDisabled color: isDisabled
? Colors.grey.withOpacity(0.5) ? Colors.grey.withOpacity(0.5)
: textColor : textColor)),
)),
)); ));
} }
} }
@ -45,11 +46,11 @@ class PrimaryButton extends StatelessWidget {
class LoadingPrimaryButton extends StatelessWidget { class LoadingPrimaryButton extends StatelessWidget {
const LoadingPrimaryButton( const LoadingPrimaryButton(
{@required this.onPressed, {@required this.onPressed,
@required this.text, @required this.text,
@required this.color, @required this.color,
@required this.textColor, @required this.textColor,
this.isDisabled = false, this.isDisabled = false,
this.isLoading = false}); this.isLoading = false});
final VoidCallback onPressed; final VoidCallback onPressed;
final Color color; final Color color;

@ -13,6 +13,7 @@ import 'package:cake_wallet/src/domain/monero/mnemonics/russian.dart';
import 'package:cake_wallet/src/domain/monero/mnemonics/spanish.dart'; import 'package:cake_wallet/src/domain/monero/mnemonics/spanish.dart';
import 'package:cake_wallet/src/domain/common/mnemotic_item.dart'; import 'package:cake_wallet/src/domain/common/mnemotic_item.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/top_panel.dart';
class SeedWidget extends StatefulWidget { class SeedWidget extends StatefulWidget {
SeedWidget({Key key, this.onMnemoticChange, this.onFinish, this.seedLanguage}) : super(key: key) { SeedWidget({Key key, this.onMnemoticChange, this.onFinish, this.seedLanguage}) : super(key: key) {
@ -235,127 +236,186 @@ class SeedWidgetState extends State<SeedWidget> {
child: Column(children: [ child: Column(children: [
Flexible( Flexible(
fit: FlexFit.tight, fit: FlexFit.tight,
flex: 6, flex: 1,
child: SingleChildScrollView( child: TopPanel(
child: Wrap( height: null,
children: items.map((item) { color: PaletteDark.menuList,
final isValid = item.isCorrect(); widget: SingleChildScrollView(
final isSelected = selectedItem == item; child: Column(
mainAxisAlignment: MainAxisAlignment.start,
return InkWell( crossAxisAlignment: CrossAxisAlignment.start,
onTap: () => onMnemoticTap(item), children: <Widget>[
child: Container( Text(
decoration: BoxDecoration( S.of(context).restore_active_seed,
color: isValid ? Colors.transparent : Palette.red),
margin: EdgeInsets.only(right: 7, bottom: 8),
child: Text(
item.toString(),
style: TextStyle( style: TextStyle(
color: fontSize: 14,
isValid ? Palette.blueGrey : Palette.lightGrey, color: PaletteDark.walletCardText
fontSize: 18, ),
fontWeight: ),
isSelected ? FontWeight.w900 : FontWeight.w400, Padding(
decoration: isSelected padding: EdgeInsets.only(top: 5),
? TextDecoration.underline child: Wrap(
: TextDecoration.none), children: items.map((item) {
)), final isValid = item.isCorrect();
); final isSelected = selectedItem == item;
}).toList()),
)), return InkWell(
onTap: () => onMnemoticTap(item),
child: Container(
decoration: BoxDecoration(
color: isValid ? Colors.transparent : Palette.red),
margin: EdgeInsets.only(right: 7, bottom: 8),
child: Text(
item.toString(),
style: TextStyle(
color:
isValid ? Colors.white : Palette.lightGrey,
fontSize: 16,
fontWeight:
isSelected ? FontWeight.w900 : FontWeight.w400,
decoration: isSelected
? TextDecoration.underline
: TextDecoration.none),
)),
);
}).toList(),)
)
],
),
)
)
),
Flexible( Flexible(
fit: FlexFit.tight, fit: FlexFit.tight,
flex: 8, flex: 2,
child: Column( child: Padding(
mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: EdgeInsets.only(left: 24, top: 48, right: 24, bottom: 24),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Column(children: <Widget>[ Text(
TextFormField( S.of(context).restore_new_seed,
key: _seedTextFieldKey, style: TextStyle(
onFieldSubmitted: (text) => isCurrentMnemoticValid fontSize: 18,
? saveCurrentMnemoticToItems() fontWeight: FontWeight.bold,
: null, color: Colors.white
style: TextStyle(fontSize: 14.0), ),
controller: _seedController, ),
textInputAction: TextInputAction.done, Padding(
decoration: InputDecoration( padding: EdgeInsets.only(top: 24),
suffixIcon: GestureDetector( child: TextFormField(
behavior: HitTestBehavior.opaque, key: _seedTextFieldKey,
child: ConstrainedBox( onFieldSubmitted: (text) => isCurrentMnemoticValid
constraints: BoxConstraints(maxWidth: 145), ? saveCurrentMnemoticToItems()
child: Row( : null,
mainAxisAlignment: MainAxisAlignment.end, style: TextStyle(
children: <Widget>[ fontSize: 16.0,
Text( color: Colors.white
'${items.length}/${SeedWidgetState.maxLength}', ),
style: TextStyle( controller: _seedController,
color: Colors.grey, fontSize: 12)), textInputAction: TextInputAction.done,
SizedBox(width: 10), decoration: InputDecoration(
InkWell( suffixIcon: GestureDetector(
onTap: () async => behavior: HitTestBehavior.opaque,
Clipboard.getData('text/plain').then( child: ConstrainedBox(
(clipboard) => constraints: BoxConstraints(maxWidth: 145),
replaceText(clipboard.text)), child: Row(
child: Container( mainAxisAlignment: MainAxisAlignment.end,
height: 35, children: <Widget>[
padding: EdgeInsets.all(7), Text(
decoration: BoxDecoration( '${items.length}/${SeedWidgetState.maxLength}',
color: style: TextStyle(
Palette.wildDarkBlueWithOpacity, color: PaletteDark.walletCardText,
borderRadius: fontSize: 14)),
BorderRadius.circular(10.0)), SizedBox(width: 10),
child: Text(S.of(context).paste)), InkWell(
) onTap: () async =>
], Clipboard.getData('text/plain').then(
), (clipboard) =>
replaceText(clipboard.text)),
child: Container(
height: 35,
padding: EdgeInsets.all(7),
decoration: BoxDecoration(
color:
PaletteDark.menuList,
borderRadius:
BorderRadius.circular(10.0)),
child: Text(
S.of(context).paste,
style: TextStyle(
color: Colors.white
),
)),
)
],
), ),
), ),
hintStyle: ),
TextStyle(color: Theme.of(context).hintColor), hintStyle:
hintText: S.of(context).restore_from_seed_placeholder, TextStyle(
errorText: _errorMessage, color: PaletteDark.walletCardText,
focusedBorder: UnderlineInputBorder( fontSize: 16
borderSide: BorderSide( ),
color: Palette.cakeGreen, width: 2.0)), hintText: S.of(context).restore_from_seed_placeholder,
enabledBorder: UnderlineInputBorder( errorText: _errorMessage,
borderSide: BorderSide( focusedBorder: UnderlineInputBorder(
color: Theme.of(context).focusColor, borderSide: BorderSide(
width: 1.0))), color: PaletteDark.menuList, width: 1.0)),
enableInteractiveSelection: false, enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteDark.menuList,
width: 1.0))),
enableInteractiveSelection: false,
),
)
]),
)
),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
child: Row(
children: <Widget>[
Flexible(
child: Padding(
padding: EdgeInsets.only(right: 8),
child: PrimaryButton(
onPressed: clear,
text: S.of(context).clear,
color: Colors.red,
textColor: Colors.white,
isDisabled: items.isEmpty,
), ),
]), )
Padding( ),
padding: EdgeInsets.only(bottom: 20), Flexible(
child: (selectedItem == null && items.length == maxLength) child: Padding(
? PrimaryButton( padding: EdgeInsets.only(left: 8),
text: S.of(context).restore_next, child: (selectedItem == null && items.length == maxLength)
isDisabled: !isSeedValid(), ? PrimaryButton(
onPressed: () => widget.onFinish != null text: S.of(context).restore_next,
? widget.onFinish() isDisabled: !isSeedValid(),
: null, onPressed: () => widget.onFinish != null
color: Theme.of(context) ? widget.onFinish()
.primaryTextTheme : null,
.button color: Colors.green,
.backgroundColor, textColor: Colors.white)
textColor: Theme.of(context) : PrimaryButton(
.primaryTextTheme text: selectedItem != null
.button ? S.of(context).save
.color) : S.of(context).add_new_word,
: PrimaryButton( onPressed: () => isCurrentMnemoticValid
text: selectedItem != null ? saveCurrentMnemoticToItems()
? S.of(context).save : null,
: S.of(context).add_new_word, onDisabledPressed: () => showErrorIfExist(),
onPressed: () => isCurrentMnemoticValid isDisabled: !isCurrentMnemoticValid,
? saveCurrentMnemoticToItems() color: Colors.green,
: null, textColor: Colors.white),
onDisabledPressed: () => showErrorIfExist(), ),
isDisabled: !isCurrentMnemoticValid, )
color: PaletteDark.darkThemeBlueButton, ],
textColor: Theme.of(context) ))
.primaryTextTheme
.button
.color))
]))
]), ]),
); );
} }

@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
class TopPanel extends StatelessWidget {
TopPanel({@required this.height, @required this.color, @required this.widget});
final double height;
final Color color;
final Widget widget;
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: height ?? double.infinity,
padding: EdgeInsets.all(24),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(24),
bottomRight: Radius.circular(24)
),
color: color
),
child: widget,
);
}
}

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Schlüssel ausgeben (geheim)", "restore_spend_key_private" : "Schlüssel ausgeben (geheim)",
"restore_recover" : "Genesen", "restore_recover" : "Genesen",
"restore_wallet_restore_description" : "Beschreibung zur Wiederherstellung der Brieftasche", "restore_wallet_restore_description" : "Beschreibung zur Wiederherstellung der Brieftasche",
"restore_new_seed" : "Neuer Seed",
"restore_active_seed" : "Aktives Seed",
"seed_title" : "Seed", "seed_title" : "Seed",

@ -139,7 +139,7 @@
"restore_title_from_seed_keys" : "Restore from seed/keys", "restore_title_from_seed_keys" : "Restore from seed/keys",
"restore_description_from_seed_keys" : "Get back your wallet from seed/keys that you've saved to secure place", "restore_description_from_seed_keys" : "Get back your wallet from seed/keys that you've saved to secure place",
"restore_next" : "Next", "restore_next" : "Next",
"restore_title_from_backup" : "Restore from a back-up file", "restore_title_from_backup" : "Restore from back-up",
"restore_description_from_backup" : "You can restore the whole Cake Wallet app from your back-up file", "restore_description_from_backup" : "You can restore the whole Cake Wallet app from your back-up file",
"restore_seed_keys_restore" : "Seed/Keys Restore", "restore_seed_keys_restore" : "Seed/Keys Restore",
"restore_title_from_seed" : "Restore from seed", "restore_title_from_seed" : "Restore from seed",
@ -152,6 +152,8 @@
"restore_spend_key_private" : "Spend key (private)", "restore_spend_key_private" : "Spend key (private)",
"restore_recover" : "Restore", "restore_recover" : "Restore",
"restore_wallet_restore_description" : "Wallet restore description", "restore_wallet_restore_description" : "Wallet restore description",
"restore_new_seed" : "New seed",
"restore_active_seed" : "Active seed",
"seed_title" : "Seed", "seed_title" : "Seed",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Spend clave (privado)", "restore_spend_key_private" : "Spend clave (privado)",
"restore_recover" : "Recuperar", "restore_recover" : "Recuperar",
"restore_wallet_restore_description" : "Restaurar billetera", "restore_wallet_restore_description" : "Restaurar billetera",
"restore_new_seed" : "Nueva semilla",
"restore_active_seed" : "Semilla activa",
"seed_title" : "Semilla", "seed_title" : "Semilla",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "कुंजी खर्च करें (निजीe)", "restore_spend_key_private" : "कुंजी खर्च करें (निजीe)",
"restore_recover" : "वसूली", "restore_recover" : "वसूली",
"restore_wallet_restore_description" : "बटुआ विवरण पुनर्स्थापित करें", "restore_wallet_restore_description" : "बटुआ विवरण पुनर्स्थापित करें",
"restore_new_seed" : "नया बीज",
"restore_active_seed" : "सक्रिय बीज",
"seed_title" : "बीज", "seed_title" : "बीज",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "キーを使う (プライベート)", "restore_spend_key_private" : "キーを使う (プライベート)",
"restore_recover" : "回復します", "restore_recover" : "回復します",
"restore_wallet_restore_description" : "ウォレットの復元", "restore_wallet_restore_description" : "ウォレットの復元",
"restore_new_seed" : "新しい種",
"restore_active_seed" : "アクティブシード",
"seed_title" : "シード", "seed_title" : "シード",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "지출 키 (은밀한)", "restore_spend_key_private" : "지출 키 (은밀한)",
"restore_recover" : "다시 덮다", "restore_recover" : "다시 덮다",
"restore_wallet_restore_description" : "월렛 복원 설명", "restore_wallet_restore_description" : "월렛 복원 설명",
"restore_new_seed" : "새로운 씨앗",
"restore_active_seed" : "활성 종자",
"seed_title" : "씨", "seed_title" : "씨",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Sleutel uitgeven (privaat)", "restore_spend_key_private" : "Sleutel uitgeven (privaat)",
"restore_recover" : "Herstellen", "restore_recover" : "Herstellen",
"restore_wallet_restore_description" : "Portemonnee-herstelbeschrijving", "restore_wallet_restore_description" : "Portemonnee-herstelbeschrijving",
"restore_new_seed" : "Nieuw zaad",
"restore_active_seed" : "Actief zaad",
"seed_title" : "Zaad", "seed_title" : "Zaad",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Wydaj klucz (prywatny)", "restore_spend_key_private" : "Wydaj klucz (prywatny)",
"restore_recover" : "Wyzdrowieć", "restore_recover" : "Wyzdrowieć",
"restore_wallet_restore_description" : "Opis przywracania portfela", "restore_wallet_restore_description" : "Opis przywracania portfela",
"restore_new_seed" : "Nowe nasienie",
"restore_active_seed" : "Aktywne nasiona",
"seed_title" : "Ziarno", "seed_title" : "Ziarno",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Chave de gastos (privada)", "restore_spend_key_private" : "Chave de gastos (privada)",
"restore_recover" : "Restaurar", "restore_recover" : "Restaurar",
"restore_wallet_restore_description" : "Restauração da carteira", "restore_wallet_restore_description" : "Restauração da carteira",
"restore_new_seed" : "Nova semente",
"restore_active_seed" : "Semente ativa",
"seed_title" : "Semente", "seed_title" : "Semente",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Приватный ключ траты", "restore_spend_key_private" : "Приватный ключ траты",
"restore_recover" : "Восстановить", "restore_recover" : "Восстановить",
"restore_wallet_restore_description" : "Описание восстановления кошелька", "restore_wallet_restore_description" : "Описание восстановления кошелька",
"restore_new_seed" : "Новая мнемоническая фраза",
"restore_active_seed" : "Активная мнемоническая фраза",
"seed_title" : "Мнемоническая фраза", "seed_title" : "Мнемоническая фраза",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "Приватний ключ витрати", "restore_spend_key_private" : "Приватний ключ витрати",
"restore_recover" : "Відновити", "restore_recover" : "Відновити",
"restore_wallet_restore_description" : "Опис відновлюваного гаманця", "restore_wallet_restore_description" : "Опис відновлюваного гаманця",
"restore_new_seed" : "Нова мнемонічна фраза",
"restore_active_seed" : "Активна мнемонічна фраза",
"seed_title" : "Мнемонічна фраза", "seed_title" : "Мнемонічна фраза",

@ -152,6 +152,8 @@
"restore_spend_key_private" : "支出金钥 (私人的)", "restore_spend_key_private" : "支出金钥 (私人的)",
"restore_recover" : "恢复", "restore_recover" : "恢复",
"restore_wallet_restore_description" : "钱包还原说明", "restore_wallet_restore_description" : "钱包还原说明",
"restore_new_seed" : "新種子",
"restore_active_seed" : "活性種子",
"seed_title" : "种子", "seed_title" : "种子",

Loading…
Cancel
Save