CWA-205 | applied new design to restore_from_keys_page, restore_wallet_from_seed_page, restore_wallet_from_seed_details, seed_widget, blockchain_height_widget; created top_panel widget and restore_alert_dialog

wownero
Oleksandr Sobol 4 years ago
parent dbddc20af3
commit 3180ab65e1

@ -125,18 +125,20 @@ class S implements WidgetsLocalizations {
String get remove_node_message => "Are you sure that you want to remove selected node?";
String get rescan => "Rescan";
String get reset => "Reset";
String get restore_active_seed => "Active seed";
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_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_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_new_seed => "New seed";
String get restore_next => "Next";
String get restore_recover => "Restore";
String get restore_restore_wallet => "Restore Wallet";
String get restore_seed_keys_restore => "Seed/Keys Restore";
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_seed => "Restore from seed";
String get restore_title_from_seed_keys => "Restore from seed/keys";
@ -460,6 +462,8 @@ class $de extends S {
@override
String get transaction_priority_slow => "Schleppend";
@override
String get restore_new_seed => "Neuer Seed";
@override
String get add => "Hinzufügen";
@override
String get remove_node => "Knoten entfernen";
@ -670,6 +674,8 @@ class $de extends S {
@override
String get settings_fee_priority => "Gebührenpriorität";
@override
String get restore_active_seed => "Aktives Seed";
@override
String get settings_personal => "persönlich";
@override
String get seed_title => "Seed";
@ -1032,6 +1038,8 @@ class $hi extends S {
@override
String get transaction_priority_slow => "धीरे";
@override
String get restore_new_seed => "नया बीज";
@override
String get add => "जोड़ना";
@override
String get remove_node => "नोड निकालें";
@ -1242,6 +1250,8 @@ class $hi extends S {
@override
String get settings_fee_priority => "शुल्क प्राथमिकता";
@override
String get restore_active_seed => "सक्रिय बीज";
@override
String get settings_personal => "निजी";
@override
String get seed_title => "बीज";
@ -1604,6 +1614,8 @@ class $ru extends S {
@override
String get transaction_priority_slow => "Медленный";
@override
String get restore_new_seed => "Новая мнемоническая фраза";
@override
String get add => "Добавить";
@override
String get remove_node => "Удалить ноду";
@ -1814,6 +1826,8 @@ class $ru extends S {
@override
String get settings_fee_priority => "Приоритет транзакции";
@override
String get restore_active_seed => "Активная мнемоническая фраза";
@override
String get settings_personal => "Персональные";
@override
String get seed_title => "Мнемоническая фраза";
@ -2176,6 +2190,8 @@ class $ko extends S {
@override
String get transaction_priority_slow => "느린";
@override
String get restore_new_seed => "새로운 씨앗";
@override
String get add => "더하다";
@override
String get remove_node => "노드 제거";
@ -2386,6 +2402,8 @@ class $ko extends S {
@override
String get settings_fee_priority => "수수료 우선";
@override
String get restore_active_seed => "활성 종자";
@override
String get settings_personal => "개인적인";
@override
String get seed_title => "";
@ -2748,6 +2766,8 @@ class $pt extends S {
@override
String get transaction_priority_slow => "Lenta";
@override
String get restore_new_seed => "Nova semente";
@override
String get add => "Adicionar";
@override
String get remove_node => "Remover nó";
@ -2958,6 +2978,8 @@ class $pt extends S {
@override
String get settings_fee_priority => "Prioridade da taxa";
@override
String get restore_active_seed => "Semente ativa";
@override
String get settings_personal => "Pessoal";
@override
String get seed_title => "Semente";
@ -3320,6 +3342,8 @@ class $uk extends S {
@override
String get transaction_priority_slow => "Повільний";
@override
String get restore_new_seed => "Нова мнемонічна фраза";
@override
String get add => "Добавити";
@override
String get remove_node => "Видалити вузол";
@ -3530,6 +3554,8 @@ class $uk extends S {
@override
String get settings_fee_priority => "Пріоритет транзакції";
@override
String get restore_active_seed => "Активна мнемонічна фраза";
@override
String get settings_personal => "Персональні";
@override
String get seed_title => "Мнемонічна фраза";
@ -3892,6 +3918,8 @@ class $ja extends S {
@override
String get transaction_priority_slow => "スロー";
@override
String get restore_new_seed => "新しい種";
@override
String get add => "加える";
@override
String get remove_node => "ノードを削除";
@ -4102,6 +4130,8 @@ class $ja extends S {
@override
String get settings_fee_priority => "料金優先";
@override
String get restore_active_seed => "アクティブシード";
@override
String get settings_personal => "パーソナル";
@override
String get seed_title => "シード";
@ -4468,6 +4498,8 @@ class $pl extends S {
@override
String get transaction_priority_slow => "Powolny";
@override
String get restore_new_seed => "Nowe nasienie";
@override
String get add => "Dodaj";
@override
String get remove_node => "Usuń węzeł";
@ -4678,6 +4710,8 @@ class $pl extends S {
@override
String get settings_fee_priority => "Priorytet opłaty";
@override
String get restore_active_seed => "Aktywne nasiona";
@override
String get settings_personal => "Osobisty";
@override
String get seed_title => "Ziarno";
@ -5040,6 +5074,8 @@ class $es extends S {
@override
String get transaction_priority_slow => "Lento";
@override
String get restore_new_seed => "Nueva semilla";
@override
String get add => "Añadir";
@override
String get remove_node => "Eliminar nodo";
@ -5250,6 +5286,8 @@ class $es extends S {
@override
String get settings_fee_priority => "Prioridad de tasa";
@override
String get restore_active_seed => "Semilla activa";
@override
String get settings_personal => "Personal";
@override
String get seed_title => "Semilla";
@ -5612,6 +5650,8 @@ class $nl extends S {
@override
String get transaction_priority_slow => "Langzaam";
@override
String get restore_new_seed => "Nieuw zaad";
@override
String get add => "Toevoegen";
@override
String get remove_node => "Knoop verwijderen";
@ -5822,6 +5862,8 @@ class $nl extends S {
@override
String get settings_fee_priority => "Tariefprioriteit";
@override
String get restore_active_seed => "Actief zaad";
@override
String get settings_personal => "Persoonlijk";
@override
String get seed_title => "Zaad";
@ -6184,6 +6226,8 @@ class $zh extends S {
@override
String get transaction_priority_slow => "";
@override
String get restore_new_seed => "新種子";
@override
String get add => "";
@override
String get remove_node => "删除节点";
@ -6394,6 +6438,8 @@ class $zh extends S {
@override
String get settings_fee_priority => "费用优先";
@override
String get restore_active_seed => "活性種子";
@override
String get settings_personal => "个人";
@override
String get seed_title => "种子";

@ -98,10 +98,7 @@ class AccountFormState extends State<AccountForm> {
.primaryTextTheme
.button
.backgroundColor,
borderColor: Theme.of(context)
.primaryTextTheme
.button
.decorationColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading: accountListStore.isAccountCreating,
))
],

@ -255,10 +255,7 @@ class ExchangeFormState extends State<ExchangeForm> {
.primaryTextTheme
.button
.backgroundColor,
borderColor: Theme.of(context)
.primaryTextTheme
.button
.decorationColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading: exchangeStore.tradeState is TradeIsCreating,
)),
Observer(builder: (_) {

@ -315,10 +315,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
.primaryTextTheme
.button
.backgroundColor,
borderColor: Theme.of(context)
.primaryTextTheme
.button
.decorationColor),
textColor: Theme.of(context).primaryTextTheme.button.color),
)
: Offstage()),
);

@ -126,8 +126,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
},
text: S.of(context).continue_text,
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
borderColor:
Theme.of(context).primaryTextTheme.button.decorationColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading: walletCreationStore.state is WalletIsCreating,
);
},

@ -33,8 +33,7 @@ class RescanPage extends BasePage {
},
color:
Theme.of(context).primaryTextTheme.button.backgroundColor,
borderColor:
Theme.of(context).primaryTextTheme.button.decorationColor))
textColor: Theme.of(context).primaryTextTheme.button.color))
]),
);
}

@ -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/palette.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 {
RestoreWalletFromKeysPage(
@ -30,6 +31,9 @@ class RestoreWalletFromKeysPage extends BasePage {
@override
String get title => S.current.restore_title_from_keys;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget body(BuildContext context) => RestoreFromKeysFrom();
}
@ -47,11 +51,36 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
final _viewKeyController = 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
Widget build(BuildContext context) {
final walletRestorationStore = Provider.of<WalletRestorationStore>(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) {
if (state is WalletRestoredSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst);
@ -62,48 +91,49 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: Text(state.error),
actions: <Widget>[
FlatButton(
child: Text(S.of(context).ok),
onPressed: () => Navigator.of(context).pop(),
),
],
return RestoreAlertDialog(
restoreTitle: S.current.restore_title_from_keys,
restoreContent: state.error,
restoreButtonText: S.of(context).ok,
restoreButtonAction: () => Navigator.of(context).pop(),
);
});
});
}
});
return ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 20.0),
content: Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 13, right: 13),
child: Column(children: <Widget>[
Row(
children: <Widget>[
Flexible(
child: Container(
return Container(
color: PaletteDark.historyPanel,
padding: EdgeInsets.only(left: 24, right: 24),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 24.0),
content: Form(
key: _formKey,
child: Column(children: <Widget>[
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: TextFormField(
style: TextStyle(fontSize: 14.0),
style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _nameController,
decoration: InputDecoration(
hintStyle:
TextStyle(color: Theme.of(context).hintColor),
hintStyle: TextStyle(
color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)),
color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor,
color: PaletteDark.menuList,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateWalletName(value);
@ -111,28 +141,34 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
},
),
))
],
),
Row(
children: <Widget>[
Flexible(
child: Container(
],
),
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: TextFormField(
style: TextStyle(fontSize: 14.0),
style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _addressController,
keyboardType: TextInputType.multiline,
maxLines: null,
decoration: InputDecoration(
hintStyle:
TextStyle(color: Theme.of(context).hintColor),
hintStyle: TextStyle(
color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_address,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)),
color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor,
color: PaletteDark.menuList,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateAddress(value);
@ -140,26 +176,32 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
},
),
))
],
),
Row(
children: <Widget>[
Flexible(
child: Container(
],
),
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: TextFormField(
style: TextStyle(fontSize: 14.0),
style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _viewKeyController,
decoration: InputDecoration(
hintStyle:
TextStyle(color: Theme.of(context).hintColor),
hintStyle: TextStyle(
color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_view_key_private,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)),
color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor,
color: PaletteDark.menuList,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateKeys(value);
@ -167,26 +209,32 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
},
),
))
],
),
Row(
children: <Widget>[
Flexible(
child: Container(
],
),
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: TextFormField(
style: TextStyle(fontSize: 14.0),
style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
controller: _spendKeyController,
decoration: InputDecoration(
hintStyle:
TextStyle(color: Theme.of(context).hintColor),
hintStyle: TextStyle(
color: PaletteDark.walletCardText,
fontSize: 16
),
hintText: S.of(context).restore_spend_key_private,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Palette.cakeGreen, width: 2.0)),
color: PaletteDark.menuList,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor,
color: PaletteDark.menuList,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateKeys(value);
@ -194,16 +242,14 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
},
),
))
],
),
BlockchainHeightWidget(key: _blockchainHeightKey),
]),
)
],
],
),
BlockchainHeightWidget(key: _blockchainHeightKey),
]),
),
),
bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton(
bottomSectionPadding: EdgeInsets.only(bottom: 24),
bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
walletRestorationStore.restoreFromKeys(
@ -216,10 +262,12 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}
},
text: S.of(context).restore_recover,
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
borderColor:
Theme.of(context).primaryTextTheme.button.decorationColor);
}),
color: Colors.green,
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/primary_button.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/restore/widgets/restore_alert_dialog.dart';
class RestoreWalletFromSeedDetailsPage extends BasePage {
@override
String get title => S.current.restore_wallet_restore_description;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget body(BuildContext context) => RestoreFromSeedDetailsForm();
}
@ -32,10 +36,24 @@ class _RestoreFromSeedDetailsFormState
final _blockchainHeightKey = GlobalKey<BlockchainHeightState>();
final _nameController = TextEditingController();
@override
void dispose() {
_nameController.dispose();
super.dispose();
}
@override
Widget build(BuildContext 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) {
if (state is WalletRestoredSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst);
@ -46,68 +64,66 @@ class _RestoreFromSeedDetailsFormState
showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: Text(state.error),
actions: <Widget>[
FlatButton(
child: Text(S.of(context).ok),
onPressed: () => Navigator.of(context).pop(),
),
],
return RestoreAlertDialog(
restoreTitle: S.current.restore_wallet_restore_description,
restoreContent: state.error,
restoreButtonText: S.of(context).ok,
restoreButtonAction: () => Navigator.of(context).pop(),
);
});
});
}
});
return ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 20.0),
content: Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 13, right: 13),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: TextFormField(
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;
},
return Container(
color: PaletteDark.historyPanel,
padding: EdgeInsets.only(left: 24, right: 24),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 24.0),
content: Form(
key: _formKey,
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: TextFormField(
style: TextStyle(
fontSize: 16.0,
color: Colors.white
),
))
],
),
BlockchainHeightWidget(key: _blockchainHeightKey),
]))
],
controller: _nameController,
decoration: InputDecoration(
hintStyle: TextStyle(
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),
]),
),
),
bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton(
bottomSectionPadding: EdgeInsets.only(bottom: 24),
bottomSection: Observer(builder: (_) {
return LoadingPrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
walletRestorationStore.restoreFromSeed(
@ -117,10 +133,12 @@ class _RestoreFromSeedDetailsFormState
},
isLoading: walletRestorationStore.state is WalletIsRestoring,
text: S.of(context).restore_recover,
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
borderColor:
Theme.of(context).primaryTextTheme.button.decorationColor);
}),
color: Colors.green,
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/widgets/seed_widget.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:cake_wallet/palette.dart';
class RestoreWalletFromSeedPage extends BasePage {
RestoreWalletFromSeedPage(
@ -27,13 +28,7 @@ class RestoreWalletFromSeedPage extends BasePage {
String get title => S.current.restore_title_from_seed;
@override
Widget trailing(BuildContext context) => SizedBox(
width: 80,
height: 20,
child: FlatButton(
child: Text(S.of(context).clear),
padding: EdgeInsets.all(0),
onPressed: () => formKey?.currentState?.clear()));
Color get backgroundColor => PaletteDark.menuList;
@override
Widget body(BuildContext context) => RestoreFromSeedForm(key: formKey);
@ -59,7 +54,7 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
onTap: () =>
SystemChannels.textInput.invokeMethod<void>('TextInput.hide'),
child: Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
color: PaletteDark.historyPanel,
child: SeedWidget(
key: _seedKey,
onMnemoticChange: (seed) => walletRestorationStore.setSeed(seed),

@ -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,
),
)),
),
);
}
}

@ -20,7 +20,7 @@ class RestoreButton extends StatelessWidget {
onTap: onPressed,
child: Container(
width: double.infinity,
height: 140,
height: 150,
padding: EdgeInsets.all(24),
alignment: Alignment.topLeft,
decoration: BoxDecoration(
@ -52,7 +52,7 @@ class RestoreButton extends StatelessWidget {
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
title,
description,
style: TextStyle(
fontSize: 14,
color: PaletteDark.walletCardText

@ -436,8 +436,7 @@ class SendFormState extends State<SendForm> {
: null,
text: S.of(context).send,
color: Theme.of(context).accentTextTheme.button.backgroundColor,
borderColor:
Theme.of(context).accentTextTheme.button.decorationColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading: sendStore.state is CreatingTransaction ||
sendStore.state is TransactionCommiting);
}));

@ -89,10 +89,7 @@ class NewSubaddressFormState extends State<NewSubaddressForm> {
.accentTextTheme
.button
.backgroundColor,
borderColor: Theme.of(context)
.accentTextTheme
.button
.decorationColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading:
subaddressCreationStore.state is SubaddressIsCreating),
))

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

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

@ -27,15 +27,17 @@ class PrimaryButton extends StatelessWidget {
onPressed: isDisabled
? (onDisabledPressed != null ? onDisabledPressed : null)
: onPressed,
color: isDisabled ? Colors.transparent : color,
color: isDisabled ? color.withOpacity(0.5) : color,
disabledColor: color.withOpacity(0.5),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(26.0)),
child: Text(text,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w600,
color: isDisabled
? Palette.darkGrey
? Colors.grey.withOpacity(0.5)
: textColor)),
));
}
@ -44,15 +46,15 @@ class PrimaryButton extends StatelessWidget {
class LoadingPrimaryButton extends StatelessWidget {
const LoadingPrimaryButton(
{@required this.onPressed,
@required this.text,
@required this.color,
@required this.borderColor,
this.isDisabled = false,
this.isLoading = false});
@required this.text,
@required this.color,
@required this.textColor,
this.isDisabled = false,
this.isLoading = false});
final VoidCallback onPressed;
final Color color;
final Color borderColor;
final Color textColor;
final bool isLoading;
final bool isDisabled;
final String text;
@ -61,19 +63,23 @@ class LoadingPrimaryButton extends StatelessWidget {
Widget build(BuildContext context) {
return ButtonTheme(
minWidth: double.infinity,
height: 56.0,
height: 52.0,
child: FlatButton(
onPressed: (isLoading || isDisabled) ? null : onPressed,
color: color,
disabledColor: color.withOpacity(0.5),
shape: RoundedRectangleBorder(
side: BorderSide(color: borderColor),
borderRadius: BorderRadius.circular(10.0)),
borderRadius: BorderRadius.circular(26.0)),
child: isLoading
? CupertinoActivityIndicator(animating: true)
: Text(text,
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.button.color)),
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w600,
color: isDisabled
? Colors.grey.withOpacity(0.5)
: textColor
)),
));
}
}

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

@ -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,
);
}
}

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

@ -137,7 +137,7 @@
"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_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_seed_keys_restore" : "Seed/Keys Restore",
"restore_title_from_seed" : "Restore from seed",
@ -150,6 +150,8 @@
"restore_spend_key_private" : "Spend key (private)",
"restore_recover" : "Restore",
"restore_wallet_restore_description" : "Wallet restore description",
"restore_new_seed" : "New seed",
"restore_active_seed" : "Active seed",
"seed_title" : "Seed",

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save