CWA-152 | fixed bug

This commit is contained in:
Oleksandr Sobol
2020-01-09 17:56:09 +02:00
parent e46c653f3b
commit e1b0242492
3 changed files with 28 additions and 20 deletions
@@ -62,10 +62,16 @@ class _RestoreFromSeedFormState extends State<RestoreFromSeedForm> {
alignment: Alignment.bottomCenter,
child: PrimaryButton(
onPressed: () {
walletRestorationStore.validateSeed(_seedKey.currentState.items);
_seedKey.currentState.setErrorMessage(walletRestorationStore.errorMessage);
if (!walletRestorationStore.isValid) {
_seedKey.currentState.invalidate();
return;
}
_seedKey.currentState.validated();
Navigator.of(context).pushNamed(
Routes.restoreWalletFromSeedDetails,
arguments: _seedKey.currentState.items);
@@ -76,13 +76,12 @@ abstract class WalleRestorationStoreBase with Store {
@action
void setSeed(List<MnemoticItem> seed) {
this.seed = seed;
validateSeed(seed);
}
@action
void validateSeed(List<MnemoticItem> seed) {
final _seed = seed != null ? seed : this.seed;
bool isValid = _seed.length == 25;
bool isValid = _seed != null ? _seed.length == 25 : false;
if (!isValid) {
errorMessage = S.current.wallet_restoration_store_incorrect_seed_length;