CAKE-31 | created wallet_restoration_from_keys_vm; applied new design to restore_wallet_from_keys_page, restore_wallet_from_seed_details, new_wallet_page, new_wallet_type_page, seed_language_page; reworked seed_language_selector, seed_language_picker, select_button

This commit is contained in:
OleksandrSobol 2020-09-04 13:40:28 +03:00
parent 9c2d3d339f
commit f1ec962b61
13 changed files with 323 additions and 394 deletions

View file

@ -57,6 +57,7 @@ import 'package:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart'; import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_keys_vm.dart';
import 'package:cake_wallet/core/wallet_creation_service.dart'; import 'package:cake_wallet/core/wallet_creation_service.dart';
import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart'; import 'package:cake_wallet/src/domain/common/wallet_type.dart';
@ -156,6 +157,16 @@ Future setup(
type: type, language: language, seed: mnemonic); type: type, language: language, seed: mnemonic);
}); });
getIt
.registerFactoryParam<WalletRestorationFromKeysVM, List, void>((args, _) {
final type = args.first as WalletType;
final language = args[1] as String;
return WalletRestorationFromKeysVM(
getIt.get<WalletCreationService>(param1: type), walletInfoSource,
type: type, language: language);
});
getIt.registerFactory<WalletAddressListViewModel>( getIt.registerFactory<WalletAddressListViewModel>(
() => WalletAddressListViewModel(wallet: getIt.get<AppStore>().wallet)); () => WalletAddressListViewModel(wallet: getIt.get<AppStore>().wallet));

View file

@ -2,6 +2,7 @@ import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart';
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart'; import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
import 'package:cake_wallet/view_model/wallet_new_vm.dart'; import 'package:cake_wallet/view_model/wallet_new_vm.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart'; import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_keys_vm.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart';
@ -165,6 +166,7 @@ class Router {
builder: (_) => NewWalletTypePage( builder: (_) => NewWalletTypePage(
onTypeSelected: (context, type) => Navigator.of(context) onTypeSelected: (context, type) => Navigator.of(context)
.pushNamed(Routes.restoreWalletOptions, arguments: type), .pushNamed(Routes.restoreWalletOptions, arguments: type),
isNewWallet: false,
)); ));
case Routes.restoreOptions: case Routes.restoreOptions:
@ -236,17 +238,12 @@ class Router {
? args[1] as String ? args[1] as String
: 'English'; // FIXME: Unnamed constant; English default and only one language for bitcoin. : 'English'; // FIXME: Unnamed constant; English default and only one language for bitcoin.
final walletRestorationFromKeysVM =
getIt.get<WalletRestorationFromKeysVM>(param1: [type, language]);
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(
builder: (_) => builder: (_) => RestoreWalletFromKeysPage(
ProxyProvider<AuthenticationStore, WalletRestorationStore>( walletRestorationFromKeysVM: walletRestorationFromKeysVM));
update: (_, authStore, __) => WalletRestorationStore(
authStore: authStore,
sharedPreferences: sharedPreferences,
walletListService: walletListService),
child: RestoreWalletFromKeysPage(
walletsService: walletListService,
walletService: walletService,
sharedPreferences: sharedPreferences)));
case Routes.dashboard: case Routes.dashboard:
return CupertinoPageRoute<void>( return CupertinoPageRoute<void>(

View file

@ -1,3 +1,5 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -40,6 +42,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
static const aspectRatioImage = 1.22; static const aspectRatioImage = 1.22;
final walletNameImage = Image.asset('assets/images/wallet_name.png'); final walletNameImage = Image.asset('assets/images/wallet_name.png');
final walletNameLightImage = Image.asset('assets/images/wallet_name_light.png');
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>(); final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>();
ReactionDisposer _stateReaction; ReactionDisposer _stateReaction;
@ -72,6 +75,9 @@ class _WalletNameFormState extends State<WalletNameForm> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletImage = getIt.get<SettingsStore>().isDarkTheme
? walletNameImage : walletNameLightImage;
return Container( return Container(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: ScrollableWithBottomSection( child: ScrollableWithBottomSection(
@ -82,7 +88,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
padding: EdgeInsets.only(left: 12, right: 12), padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio( child: AspectRatio(
aspectRatio: aspectRatioImage, aspectRatio: aspectRatioImage,
child: FittedBox(child: walletNameImage, fit: BoxFit.fill)), child: FittedBox(child: walletImage, fit: BoxFit.fill)),
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
@ -98,19 +104,26 @@ class _WalletNameFormState extends State<WalletNameForm> {
Theme.of(context).primaryTextTheme.title.color), Theme.of(context).primaryTextTheme.title.color),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 16.0, fontSize: 18.0,
fontWeight: FontWeight.w500,
color: Theme.of(context) color: Theme.of(context)
.primaryTextTheme .accentTextTheme
.caption .display3
.color), .color),
hintText: S.of(context).wallet_name, hintText: S.of(context).wallet_name,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).dividerColor, color: Theme.of(context)
.accentTextTheme
.display3
.decorationColor,
width: 1.0)), width: 1.0)),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: Theme.of(context).dividerColor, color: Theme.of(context)
.accentTextTheme
.display3
.decorationColor,
width: 1.0))), width: 1.0))),
validator: WalletNameValidator())), validator: WalletNameValidator())),
), ),
@ -122,7 +135,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color), color: Theme.of(context).primaryTextTheme.title.color),
), ),
), ),

View file

@ -1,4 +1,6 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart'; import 'package:cake_wallet/src/domain/common/wallet_type.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -6,15 +8,17 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/primary_button.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/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart'; import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
import 'package:cake_wallet/routes.dart';
class NewWalletTypePage extends BasePage { class NewWalletTypePage extends BasePage {
NewWalletTypePage({this.onTypeSelected}); NewWalletTypePage({this.onTypeSelected, this.isNewWallet = true});
final void Function(BuildContext, WalletType) onTypeSelected; final void Function(BuildContext, WalletType) onTypeSelected;
final bool isNewWallet;
@override @override
String get title => S.current.new_wallet; String get title => isNewWallet
? S.current.new_wallet
: S.current.wallet_list_restore_wallet;
@override @override
Widget body(BuildContext context) => Widget body(BuildContext context) =>
@ -38,6 +42,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
final bitcoinIcon = final bitcoinIcon =
Image.asset('assets/images/bitcoin.png', height: 24, width: 24); Image.asset('assets/images/bitcoin.png', height: 24, width: 24);
final walletTypeImage = Image.asset('assets/images/wallet_type.png'); final walletTypeImage = Image.asset('assets/images/wallet_type.png');
final walletTypeLightImage = Image.asset('assets/images/wallet_type_light.png');
WalletType selected; WalletType selected;
List<WalletType> types; List<WalletType> types;
@ -50,6 +55,9 @@ class WalletTypeFormState extends State<WalletTypeForm> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletImage = getIt.get<SettingsStore>().isDarkTheme
? walletTypeImage : walletTypeLightImage;
return Container( return Container(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: ScrollableWithBottomSection( child: ScrollableWithBottomSection(
@ -61,7 +69,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
padding: EdgeInsets.only(left: 12, right: 12), padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio( child: AspectRatio(
aspectRatio: aspectRatioImage, aspectRatio: aspectRatioImage,
child: FittedBox(child: walletTypeImage, fit: BoxFit.fill)), child: FittedBox(child: walletImage, fit: BoxFit.fill)),
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 48), padding: EdgeInsets.only(top: 48),
@ -70,7 +78,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color), color: Theme.of(context).primaryTextTheme.title.color),
), ),
), ),
@ -79,8 +87,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
child: SelectButton( child: SelectButton(
image: _iconFor(type), image: _iconFor(type),
text: walletTypeToString(type), text: walletTypeToString(type),
color: _backgroundColorFor(selected == type), isSelected: selected == type,
textColor: _textColorFor(selected == type),
onTap: () => setState(() => selected = type)), onTap: () => setState(() => selected = type)),
)) ))
], ],
@ -97,16 +104,6 @@ class WalletTypeFormState extends State<WalletTypeForm> {
); );
} }
// FIXME: Move color selection inside ui element; add isSelected to buttons.
Color _backgroundColorFor(bool isSelected) => isSelected
? Theme.of(context).accentTextTheme.title.decorationColor
: Theme.of(context).accentTextTheme.title.backgroundColor;
Color _textColorFor(bool isSelected) => isSelected
? Theme.of(context).primaryTextTheme.title.backgroundColor
: Theme.of(context).primaryTextTheme.title.color;
Image _iconFor(WalletType type) { Image _iconFor(WalletType type) {
switch (type) { switch (type) {
case WalletType.monero: case WalletType.monero:

View file

@ -4,21 +4,30 @@ class SelectButton extends StatelessWidget {
SelectButton({ SelectButton({
@required this.image, @required this.image,
@required this.text, @required this.text,
@required this.color,
@required this.textColor,
@required this.onTap, @required this.onTap,
this.isSelected = false,
}); });
final Image image; final Image image;
final String text; final String text;
final Color color; final bool isSelected;
final Color textColor;
final VoidCallback onTap; final VoidCallback onTap;
final selectArrowImage = Image.asset('assets/images/select_arrow.png');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final color = isSelected
? Theme.of(context).accentTextTheme.subtitle.decorationColor
: Theme.of(context).accentTextTheme.caption.color;
final textColor = isSelected
? Theme.of(context).accentTextTheme.headline.decorationColor
: Theme.of(context).primaryTextTheme.title.color;
final arrowColor = isSelected
? Theme.of(context).accentTextTheme.headline.decorationColor
: Theme.of(context).accentTextTheme.subhead.color;
final selectArrowImage = Image.asset('assets/images/select_arrow.png',
color: arrowColor);
return GestureDetector( return GestureDetector(
onTap: onTap, onTap: onTap,
child: Container( child: Container(
@ -39,9 +48,7 @@ class SelectButton extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
image != null image ?? Offstage(),
? image
: Offstage(),
Padding( Padding(
padding: image != null padding: image != null
? EdgeInsets.only(left: 15) ? EdgeInsets.only(left: 15)
@ -50,7 +57,7 @@ class SelectButton extends StatelessWidget {
text, text,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
color: textColor color: textColor
), ),
), ),

View file

@ -1,40 +1,36 @@
import 'package:mobx/mobx.dart'; import 'package:cake_wallet/core/validator.dart';
import 'package:provider/provider.dart'; import 'package:cake_wallet/palette.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/services/wallet_list_service.dart';
import 'package:cake_wallet/src/domain/services/wallet_service.dart';
import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_store.dart';
import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_state.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart'; import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_keys_vm.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
class RestoreWalletFromKeysPage extends BasePage { class RestoreWalletFromKeysPage extends BasePage {
RestoreWalletFromKeysPage( RestoreWalletFromKeysPage(
{@required this.walletsService, {@required this.walletRestorationFromKeysVM});
@required this.sharedPreferences,
@required this.walletService});
final WalletListService walletsService; final WalletRestorationFromKeysVM walletRestorationFromKeysVM;
final WalletService walletService;
final SharedPreferences sharedPreferences;
@override @override
String get title => S.current.restore_title_from_keys; String get title => S.current.restore_title_from_keys;
@override @override
Widget body(BuildContext context) => RestoreFromKeysFrom(); Widget body(BuildContext context) => RestoreFromKeysFrom(walletRestorationFromKeysVM);
} }
class RestoreFromKeysFrom extends StatefulWidget { class RestoreFromKeysFrom extends StatefulWidget {
RestoreFromKeysFrom(this.walletRestorationFromKeysVM);
final WalletRestorationFromKeysVM walletRestorationFromKeysVM;
@override @override
_RestoreFromKeysFromState createState() => _RestoreFromKeysFromState(); _RestoreFromKeysFromState createState() => _RestoreFromKeysFromState();
} }
@ -46,6 +42,23 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
final _addressController = TextEditingController(); final _addressController = TextEditingController();
final _viewKeyController = TextEditingController(); final _viewKeyController = TextEditingController();
final _spendKeyController = TextEditingController(); final _spendKeyController = TextEditingController();
final _wifController = TextEditingController();
@override
void initState() {
_nameController.addListener(() =>
widget.walletRestorationFromKeysVM.name = _nameController.text);
_addressController.addListener(() =>
widget.walletRestorationFromKeysVM.address = _addressController.text);
_viewKeyController.addListener(() =>
widget.walletRestorationFromKeysVM.viewKey = _viewKeyController.text);
_spendKeyController.addListener(() =>
widget.walletRestorationFromKeysVM.spendKey = _spendKeyController.text);
_wifController.addListener(() =>
widget.walletRestorationFromKeysVM.wif = _wifController.text);
super.initState();
}
@override @override
void dispose() { void dispose() {
@ -53,31 +66,14 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
_addressController.dispose(); _addressController.dispose();
_viewKeyController.dispose(); _viewKeyController.dispose();
_spendKeyController.dispose(); _spendKeyController.dispose();
_wifController.dispose();
super.dispose(); super.dispose();
} }
void onHandleControllers(WalletRestorationStore walletRestorationStore) {
if (_nameController.text.isNotEmpty &&
_addressController.text.isNotEmpty &&
_viewKeyController.text.isNotEmpty &&
_spendKeyController.text.isNotEmpty) {
walletRestorationStore.setDisabledState(false);
} else {
walletRestorationStore.setDisabledState(true);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletRestorationStore = Provider.of<WalletRestorationStore>(context);
final seedLanguageStore = Provider.of<SeedLanguageStore>(context);
_nameController.addListener(() {onHandleControllers(walletRestorationStore);}); /*reaction((_) => walletRestorationStore.state, (WalletRestorationState state) {
_addressController.addListener(() {onHandleControllers(walletRestorationStore);});
_viewKeyController.addListener(() {onHandleControllers(walletRestorationStore);});
_spendKeyController.addListener(() {onHandleControllers(walletRestorationStore);});
reaction((_) => walletRestorationStore.state, (WalletRestorationState state) {
if (state is WalletRestoredSuccessfully) { if (state is WalletRestoredSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst); Navigator.of(context).popUntil((route) => route.isFirst);
} }
@ -96,7 +92,7 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
}); });
}); });
} }
}); });*/
return Container( return Container(
padding: EdgeInsets.only(left: 24, right: 24), padding: EdgeInsets.only(left: 24, right: 24),
@ -110,66 +106,39 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color
),
controller: _nameController, controller: _nameController,
decoration: InputDecoration( hintText: S.of(context).restore_wallet_name,
hintStyle: TextStyle( validator: WalletNameValidator(),
color: Theme.of(context).primaryTextTheme.caption.color, )
fontSize: 16
),
hintText: S.of(context).restore_wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateWalletName(value);
return walletRestorationStore.errorMessage;
},
),
)) ))
], ],
), ),
if (!widget.walletRestorationFromKeysVM.hasRestorationHeight)
Row(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(top: 20.0),
child: BaseTextFormField(
controller: _wifController,
hintText: 'WIF',
)
))
],
),
if (widget.walletRestorationFromKeysVM.hasRestorationHeight) ... [
Row( Row(
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color
),
controller: _addressController, controller: _addressController,
keyboardType: TextInputType.multiline, keyboardType: TextInputType.multiline,
maxLines: null, maxLines: null,
decoration: InputDecoration( hintText: S.of(context).restore_address,
hintStyle: TextStyle( )
color: Theme.of(context).primaryTextTheme.caption.color,
fontSize: 16
),
hintText: S.of(context).restore_address,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateAddress(value);
return walletRestorationStore.errorMessage;
},
),
)) ))
], ],
), ),
@ -178,31 +147,10 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color
),
controller: _viewKeyController, controller: _viewKeyController,
decoration: InputDecoration( hintText: S.of(context).restore_view_key_private,
hintStyle: TextStyle( )
color: Theme.of(context).primaryTextTheme.caption.color,
fontSize: 16
),
hintText: S.of(context).restore_view_key_private,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateKeys(value);
return walletRestorationStore.errorMessage;
},
),
)) ))
], ],
), ),
@ -211,35 +159,19 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color
),
controller: _spendKeyController, controller: _spendKeyController,
decoration: InputDecoration( hintText: S.of(context).restore_spend_key_private,
hintStyle: TextStyle( )
color: Theme.of(context).primaryTextTheme.caption.color,
fontSize: 16
),
hintText: S.of(context).restore_spend_key_private,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: (value) {
walletRestorationStore.validateKeys(value);
return walletRestorationStore.errorMessage;
},
),
)) ))
], ],
), ),
BlockchainHeightWidget(key: _blockchainHeightKey), BlockchainHeightWidget(
key: _blockchainHeightKey,
onHeightChange: (height) {
widget.walletRestorationFromKeysVM.height = height;
print(height);
})],
]), ]),
), ),
bottomSectionPadding: EdgeInsets.only(bottom: 24), bottomSectionPadding: EdgeInsets.only(bottom: 24),
@ -247,19 +179,19 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
return LoadingPrimaryButton( return LoadingPrimaryButton(
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
walletRestorationStore.restoreFromKeys( /*walletRestorationStore.restoreFromKeys(
name: _nameController.text, name: _nameController.text,
language: seedLanguageStore.selectedSeedLanguage, language: seedLanguageStore.selectedSeedLanguage,
address: _addressController.text, address: _addressController.text,
viewKey: _viewKeyController.text, viewKey: _viewKeyController.text,
spendKey: _spendKeyController.text, spendKey: _spendKeyController.text,
restoreHeight: _blockchainHeightKey.currentState.height); restoreHeight: _blockchainHeightKey.currentState.height);*/
} }
}, },
text: S.of(context).restore_recover, text: S.of(context).restore_recover,
color: Colors.green, color: Palette.blueCraiola,
textColor: Colors.white, textColor: Colors.white,
isDisabled: walletRestorationStore.disabledState, //isDisabled: walletRestorationStore.disabledState,
); );
}), }),
), ),

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/palette.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
@ -9,6 +10,7 @@ import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart'; import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
class RestoreWalletFromSeedDetailsPage extends BasePage { class RestoreWalletFromSeedDetailsPage extends BasePage {
@ -91,27 +93,9 @@ class _RestoreFromSeedDetailsFormState
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0), padding: EdgeInsets.only(top: 20.0),
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color),
controller: _nameController, controller: _nameController,
decoration: InputDecoration( hintText: S.of(context).restore_wallet_name,
hintStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.caption
.color,
fontSize: 16),
hintText: S.of(context).restore_wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
validator: WalletNameValidator(), validator: WalletNameValidator(),
), ),
)) ))
@ -137,7 +121,7 @@ class _RestoreFromSeedDetailsFormState
isLoading: isLoading:
widget.walletRestorationFromSeedVM.state is WalletCreating, widget.walletRestorationFromSeedVM.state is WalletCreating,
text: S.of(context).restore_recover, text: S.of(context).restore_recover,
color: Colors.green, color: Palette.blueCraiola,
textColor: Colors.white, textColor: Colors.white,
isDisabled: _nameController.text.isNotEmpty, isDisabled: _nameController.text.isNotEmpty,
); );

View file

@ -1,5 +1,6 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/widgets/seed_language_selector.dart'; import 'package:cake_wallet/src/widgets/seed_language_selector.dart';
import 'package:provider/provider.dart'; import 'package:cake_wallet/store/settings_store.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -7,8 +8,6 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/primary_button.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/src/widgets/scollable_with_bottom_section.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'; import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
class SeedLanguage extends BasePage { class SeedLanguage extends BasePage {
@ -16,6 +15,9 @@ class SeedLanguage extends BasePage {
final Function(BuildContext, String) onConfirm; final Function(BuildContext, String) onConfirm;
@override
String get title => S.current.wallet_list_restore_wallet;
@override @override
Widget body(BuildContext context) => SeedLanguageForm(onConfirm: onConfirm); Widget body(BuildContext context) => SeedLanguageForm(onConfirm: onConfirm);
} }
@ -33,10 +35,14 @@ class SeedLanguageFormState extends State<SeedLanguageForm> {
static const aspectRatioImage = 1.22; static const aspectRatioImage = 1.22;
final walletNameImage = Image.asset('assets/images/wallet_name.png'); final walletNameImage = Image.asset('assets/images/wallet_name.png');
final walletNameLightImage = Image.asset('assets/images/wallet_name_light.png');
final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>(); final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final walletImage = getIt.get<SettingsStore>().isDarkTheme
? walletNameImage : walletNameLightImage;
return Container( return Container(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: ScrollableWithBottomSection( child: ScrollableWithBottomSection(
@ -47,7 +53,7 @@ class SeedLanguageFormState extends State<SeedLanguageForm> {
padding: EdgeInsets.only(left: 12, right: 12), padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio( child: AspectRatio(
aspectRatio: aspectRatioImage, aspectRatio: aspectRatioImage,
child: FittedBox(child: walletNameImage, fit: BoxFit.fill)), child: FittedBox(child: walletImage, fit: BoxFit.fill)),
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 40), padding: EdgeInsets.only(top: 40),
@ -56,7 +62,7 @@ class SeedLanguageFormState extends State<SeedLanguageForm> {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color), color: Theme.of(context).primaryTextTheme.title.color),
), ),
), ),

View file

@ -1,9 +1,9 @@
import 'dart:ui'; import 'dart:ui';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:provider/provider.dart';
import 'package:cake_wallet/src/stores/seed_language/seed_language_store.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
List<Image> flagImages = [ List<Image> flagImages = [
@ -57,170 +57,111 @@ class SeedLanguagePicker extends StatefulWidget {
class SeedLanguagePickerState extends State<SeedLanguagePicker> { class SeedLanguagePickerState extends State<SeedLanguagePicker> {
SeedLanguagePickerState({this.selected}); SeedLanguagePickerState({this.selected});
final closeButton = Image.asset('assets/images/close.png');
String selected; String selected;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return AlertBackground(
onTap: () => Navigator.of(context).pop(), child: Stack(
child: Container( alignment: Alignment.center,
color: Colors.transparent, children: <Widget>[
child: BackdropFilter( Column(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0), mainAxisSize: MainAxisSize.min,
child: Container( children: <Widget>[
decoration: BoxDecoration( Container(
color: PaletteDark.darkNightBlue.withOpacity(0.75)), padding: EdgeInsets.only(left: 24, right: 24),
child: Center( child: Text(
child: Column( S.of(context).seed_choose,
mainAxisSize: MainAxisSize.min, textAlign: TextAlign.center,
children: <Widget>[ style: TextStyle(
Container( fontSize: 18,
padding: EdgeInsets.only(left: 24, right: 24), fontWeight: FontWeight.bold,
child: Text( fontFamily: 'Poppins',
S.of(context).seed_choose, decoration: TextDecoration.none,
textAlign: TextAlign.center, color: Colors.white
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.white),
), ),
), ),
Padding( ),
padding: EdgeInsets.only(top: 24), Padding(
child: GestureDetector( padding: EdgeInsets.only(top: 24),
onTap: () => null, child: ClipRRect(
child: Container( borderRadius: BorderRadius.all(Radius.circular(14)),
height: 300, child: Container(
width: 300, height: 300,
decoration: BoxDecoration( width: 300,
borderRadius: BorderRadius.all(Radius.circular(14)), color: Theme.of(context).accentTextTheme.title.backgroundColor,
color: Theme.of(context).dividerColor), child: GridView.count(
child: GridView.count( shrinkWrap: true,
shrinkWrap: true, crossAxisCount: 3,
crossAxisCount: 3, childAspectRatio: 1,
childAspectRatio: 1, physics: const NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(), crossAxisSpacing: 1,
crossAxisSpacing: 1, mainAxisSpacing: 1,
mainAxisSpacing: 1, children: List.generate(9, (index) {
children: List.generate(9, (index) {
if (index == 8) {
return gridTile(
isCurrent: false,
place: Places.bottomRight,
image: null,
text: '',
onTap: null);
} else {
final code = languageCodes[index];
final flag = flagImages[index];
final isCurrent =
index == seedLanguages.indexOf(selected);
if (index == 0) { if (index == 8) {
return gridTile(
isCurrent: isCurrent, return gridTile(
place: Places.topLeft, isCurrent: false,
image: flag, image: null,
text: code, text: '',
onTap: () { onTap: null);
selected = seedLanguages[index];
Navigator.of(context).pop(selected); }
});
final code = languageCodes[index];
final flag = flagImages[index];
final isCurrent =
index == seedLanguages.indexOf(selected);
return gridTile(
isCurrent: isCurrent,
image: flag,
text: code,
onTap: () {
selected = seedLanguages[index];
Navigator.of(context).pop(selected);
} }
);
if (index == 2) { }),
return gridTile(
isCurrent: isCurrent,
place: Places.topRight,
image: flag,
text: code,
onTap: () {
selected = seedLanguages[index];
Navigator.of(context).pop(selected);
});
}
if (index == 6) {
return gridTile(
isCurrent: isCurrent,
place: Places.bottomLeft,
image: flag,
text: code,
onTap: () {
selected = seedLanguages[index];
Navigator.of(context).pop(selected);
});
}
return gridTile(
isCurrent: isCurrent,
place: Places.inside,
image: flag,
text: code,
onTap: () {
selected = seedLanguages[index];
Navigator.of(context).pop(selected);
});
}
}),
),
), ),
), ),
) ),
], )
), ],
), ),
), AlertCloseButton(image: closeButton)
), ],
), )
); );
} }
Widget gridTile( Widget gridTile({
{@required bool isCurrent, @required bool isCurrent,
@required Places place, @required Image image,
@required Image image, @required String text,
@required String text, @required VoidCallback onTap}) {
@required VoidCallback onTap}) {
BorderRadius borderRadius;
final color = isCurrent
? Theme.of(context).accentTextTheme.subtitle.decorationColor
: Theme.of(context).primaryTextTheme.display1.color;
final textColor = isCurrent
? Colors.blue
: Theme.of(context).primaryTextTheme.title.color;
switch (place) { final color = isCurrent
case Places.topLeft: ? Theme.of(context).textTheme.body2.color
borderRadius = BorderRadius.only(topLeft: Radius.circular(14)); : Theme.of(context).accentTextTheme.title.color;
break; final textColor = isCurrent
case Places.topRight: ? Palette.blueCraiola
borderRadius = BorderRadius.only(topRight: Radius.circular(14)); : Theme.of(context).primaryTextTheme.title.color;
break;
case Places.bottomLeft:
borderRadius = BorderRadius.only(bottomLeft: Radius.circular(14));
break;
case Places.bottomRight:
borderRadius = BorderRadius.only(bottomRight: Radius.circular(14));
break;
case Places.inside:
borderRadius = BorderRadius.all(Radius.circular(0));
break;
}
return GestureDetector( return GestureDetector(
onTap: onTap, onTap: onTap,
child: Container( child: Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
decoration: BoxDecoration(borderRadius: borderRadius, color: color), color: color,
child: Center( child: Center(
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
image != null ? image : Offstage(), image ?? Offstage(),
Padding( Padding(
padding: image != null padding: image != null
? EdgeInsets.only(left: 10) ? EdgeInsets.only(left: 10)
@ -229,14 +170,17 @@ class SeedLanguagePickerState extends State<SeedLanguagePicker> {
text, text,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w600,
fontFamily: 'Poppins',
decoration: TextDecoration.none, decoration: TextDecoration.none,
color: textColor), color: textColor
),
), ),
) )
], ],
), ),
), ),
)); )
);
} }
} }

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/domain/monero/get_height_by_date.dart'; import 'package:cake_wallet/src/domain/monero/get_height_by_date.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
class BlockchainHeightWidget extends StatefulWidget { class BlockchainHeightWidget extends StatefulWidget {
BlockchainHeightWidget({GlobalKey key, this.onHeightChange}) BlockchainHeightWidget({GlobalKey key, this.onHeightChange})
@ -46,26 +47,12 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
Flexible( Flexible(
child: Container( child: Container(
padding: EdgeInsets.only(top: 20.0, bottom: 10.0), padding: EdgeInsets.only(top: 20.0, bottom: 10.0),
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color),
controller: restoreHeightController, controller: restoreHeightController,
keyboardType: TextInputType.numberWithOptions( keyboardType: TextInputType.numberWithOptions(
signed: false, decimal: false), signed: false, decimal: false),
decoration: InputDecoration( hintText: S.of(context).widgets_restore_from_blockheight,
hintStyle: TextStyle( )
color: Theme.of(context).primaryTextTheme.caption.color,
fontSize: 16),
hintText: S.of(context).widgets_restore_from_blockheight,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor, width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
),
)) ))
], ],
), ),
@ -75,7 +62,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
S.of(context).widgets_or, S.of(context).widgets_or,
style: TextStyle( style: TextStyle(
fontSize: 16.0, fontSize: 16.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color), color: Theme.of(context).primaryTextTheme.title.color),
), ),
), ),
@ -86,31 +73,10 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
child: InkWell( child: InkWell(
onTap: () => _selectDate(context), onTap: () => _selectDate(context),
child: IgnorePointer( child: IgnorePointer(
child: TextFormField( child: BaseTextFormField(
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context).primaryTextTheme.title.color),
decoration: InputDecoration(
hintStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.caption
.color,
fontSize: 16),
hintText: S.of(context).widgets_restore_from_date,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0))),
controller: dateController, controller: dateController,
validator: (value) { hintText: S.of(context).widgets_restore_from_date,
return null; )
},
),
), ),
), ),
)) ))

View file

@ -34,14 +34,14 @@ class SeedLanguageSelectorState extends State<SeedLanguageSelector> {
return SelectButton( return SelectButton(
image: null, image: null,
text: seedLocales[seedLanguages.indexOf(selected)], text: seedLocales[seedLanguages.indexOf(selected)],
color: Theme.of(context).accentTextTheme.title.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.title.color,
onTap: () async { onTap: () async {
final selected = await showDialog<String>( final selected = await showDialog<String>(
context: context, context: context,
builder: (BuildContext context) => builder: (BuildContext context) =>
SeedLanguagePicker(key: _pickerKey, selected: this.selected)); SeedLanguagePicker(key: _pickerKey, selected: this.selected));
setState(() => this.selected = selected); if (selected != null) {
setState(() => this.selected = selected);
}
}); });
} }
} }

View file

@ -156,6 +156,10 @@ class Themes {
color: Palette.shadowWhite, // action button color (address text field) color: Palette.shadowWhite, // action button color (address text field)
decorationColor: Palette.darkGray // hint text (seed widget) decorationColor: Palette.darkGray // hint text (seed widget)
), ),
display3: TextStyle(
color: Palette.darkGray, // hint text (new wallet page)
decorationColor: Palette.periwinkleCraiola // underline (new wallet page)
),
), ),
@ -323,6 +327,10 @@ class Themes {
color: PaletteDark.nightBlue, // action button color (address text field) color: PaletteDark.nightBlue, // action button color (address text field)
decorationColor: PaletteDark.darkCyanBlue // hint text (seed widget) decorationColor: PaletteDark.darkCyanBlue // hint text (seed widget)
), ),
display3: TextStyle(
color: PaletteDark.cyanBlue, // hint text (new wallet page)
decorationColor: PaletteDark.darkGrey // underline (new wallet page)
),
), ),

View file

@ -0,0 +1,64 @@
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/monero/monero_wallet_service.dart';
import 'package:cake_wallet/bitcoin/bitcoin_wallet_creation_credentials.dart';
import 'package:cake_wallet/core/generate_wallet_password.dart';
import 'package:cake_wallet/core/wallet_creation_service.dart';
import 'package:cake_wallet/core/wallet_credentials.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
import 'package:cake_wallet/view_model/wallet_creation_vm.dart';
import 'package:cake_wallet/src/domain/common/wallet_info.dart';
part 'wallet_restoration_from_keys_vm.g.dart';
class WalletRestorationFromKeysVM = WalletRestorationFromKeysVMBase
with _$WalletRestorationFromKeysVM;
abstract class WalletRestorationFromKeysVMBase extends WalletCreationVM
with Store {
WalletRestorationFromKeysVMBase(this._walletCreationService, Box<WalletInfo> walletInfoSource,
{@required WalletType type, @required this.language})
: super(walletInfoSource, type: type, isRecovery: true);
@observable
int height;
@observable
String viewKey;
@observable
String spendKey;
@observable
String wif;
@observable
String address;
bool get hasRestorationHeight => type == WalletType.monero;
final String language;
final WalletCreationService _walletCreationService;
@override
WalletCredentials getCredentials(dynamic options) {
final password = generateWalletPassword(type);
switch (type) {
case WalletType.monero:
return MoneroRestoreWalletFromKeysCredentials(
name: name, password: password, language: language, address: address,
viewKey: viewKey, spendKey: spendKey, height: height);
case WalletType.bitcoin:
return BitcoinRestoreWalletFromWIFCredentials(
name: name, password: password, wif: wif);
default:
return null;
}
}
@override
Future<void> process(WalletCredentials credentials) async =>
_walletCreationService.restoreFromKeys(credentials);
}