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

Cwa 205 update restore wallet screens
This commit is contained in:
Oleksandr Sobol 2020-05-01 22:57:46 +03:00 committed by GitHub
commit a438fa878e
41 changed files with 771 additions and 540 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 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

BIN
assets/images/backup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -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 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";
@ -465,6 +467,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";
@ -679,6 +683,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";
@ -1043,6 +1049,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 => "नोड निकालें";
@ -1257,6 +1265,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 => "बीज";
@ -1621,6 +1631,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 => "Удалить ноду";
@ -1835,6 +1847,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 => "Мнемоническая фраза";
@ -2199,6 +2213,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 => "노드 제거";
@ -2413,6 +2429,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 => "";
@ -2777,6 +2795,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ó";
@ -2991,6 +3011,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";
@ -3355,6 +3377,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 => "Видалити вузол";
@ -3569,6 +3593,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 => "Мнемонічна фраза";
@ -3933,6 +3959,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 => "ノードを削除";
@ -4147,6 +4175,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 => "シード";
@ -4515,6 +4545,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ł";
@ -4729,6 +4761,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";
@ -5093,6 +5127,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";
@ -5307,6 +5343,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";
@ -5671,6 +5709,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";
@ -5885,6 +5925,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";
@ -6249,6 +6291,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 => "删除节点";
@ -6463,6 +6507,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 => "种子";

View file

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

View file

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

View file

@ -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,9 +262,12 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}
},
text: S.of(context).restore_recover,
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color,);
}),
color: Colors.green,
textColor: Colors.white,
isDisabled: walletRestorationStore.disabledState,
);
}),
),
);
}
}

View file

@ -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,9 +133,12 @@ class _RestoreFromSeedDetailsFormState
},
isLoading: walletRestorationStore.state is WalletIsRestoring,
text: S.of(context).restore_recover,
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color,);
}),
color: Colors.green,
textColor: Colors.white,
isDisabled: walletRestorationStore.disabledState,
);
}),
),
);
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,52 +1,99 @@
import 'package:provider/provider.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.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/seed_language/widgets/seed_language_picker.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/src/widgets/primary_button.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/new_wallet/widgets/select_button.dart';
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
class SeedLanguage extends BasePage {
final imageSeed = Image.asset('assets/images/seedIco.png');
@override
Color get backgroundColor => PaletteDark.historyPanel;
@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 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(
padding: EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
imageSeed,
Text(
color: PaletteDark.historyPanel,
padding: EdgeInsets.only(top: 24),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
content: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(left: 12, right: 12),
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,
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(),
],
),
),
),
PrimaryButton(
onPressed: () =>
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
text: S.of(context).seed_language_next,
color:
Theme.of(context).primaryTextTheme.button.backgroundColor,
textColor:
Theme.of(context).primaryTextTheme.button.color),
],
),
)
]),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: Observer(
builder: (context) {
return PrimaryButton(
onPressed: () =>
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
text: S.of(context).seed_language_next,
color: Colors.green,
textColor: Colors.white);
},
)),
);
}
}

View file

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

View file

@ -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) {

View file

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class PrimaryButton extends StatelessWidget {
const PrimaryButton(
@ -26,18 +27,18 @@ class PrimaryButton extends StatelessWidget {
onPressed: isDisabled
? (onDisabledPressed != null ? onDisabledPressed : null)
: onPressed,
color: 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
? Colors.grey.withOpacity(0.5)
: textColor
)),
: textColor)),
));
}
}
@ -45,11 +46,11 @@ class PrimaryButton extends StatelessWidget {
class LoadingPrimaryButton extends StatelessWidget {
const LoadingPrimaryButton(
{@required this.onPressed,
@required this.text,
@required this.color,
@required this.textColor,
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;

View file

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

View file

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

View file

@ -152,6 +152,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",

View file

@ -139,7 +139,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",
@ -152,6 +152,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",

View file

@ -152,6 +152,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",

View file

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

View file

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

View file

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

View file

@ -152,6 +152,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",

View file

@ -152,6 +152,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",

View file

@ -152,6 +152,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",

View file

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

View file

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

View file

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