CAKE-40 | added text to restore wallet from keys page, restore wallet from seed details page, wallet seed page; applied wallet seed page call when new wallet was created

This commit is contained in:
Oleksandr Sobol
2020-09-11 18:52:55 +03:00
parent 2a7a4cad0a
commit f4b7ccf619
21 changed files with 180 additions and 61 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ class WalletMenu {
Navigator.of(context).pushNamed(Routes.auth,
arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) =>
isAuthenticatedSuccessfully
? Navigator.of(auth.context).popAndPushNamed(Routes.seed)
? Navigator.of(auth.context).popAndPushNamed(Routes.seed, arguments: false)
: null);
break;
@@ -1,4 +1,5 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:mobx/mobx.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@@ -53,7 +54,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
_stateReaction ??=
reaction((_) => _walletNewVM.state, (WalletCreationState state) {
if (state is WalletCreatedSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst);
Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true);
}
if (state is WalletCreationFailure) {
@@ -171,7 +171,19 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
onHeightChange: (height) {
widget.walletRestorationFromKeysVM.height = height;
print(height);
})],
}),
Padding(
padding: EdgeInsets.only(left: 40, right: 40, top: 24),
child: Text(
S.of(context).restore_from_date_or_blockheight,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Theme.of(context).hintColor
),
),
)],
]),
),
bottomSectionPadding: EdgeInsets.only(bottom: 24),
@@ -101,13 +101,26 @@ class _RestoreFromSeedDetailsFormState
))
],
),
if (widget.walletRestorationFromSeedVM.hasRestorationHeight)
if (widget.walletRestorationFromSeedVM.hasRestorationHeight) ... [
BlockchainHeightWidget(
key: _blockchainHeightKey,
onHeightChange: (height) {
widget.walletRestorationFromSeedVM.height = height;
print(height);
}),
Padding(
padding: EdgeInsets.only(left: 40, right: 40, top: 24),
child: Text(
S.of(context).restore_from_date_or_blockheight,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Theme.of(context).hintColor
),
),
)
]
]),
),
bottomSectionPadding: EdgeInsets.only(bottom: 24),
+75 -52
View File
@@ -1,17 +1,18 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:esys_flutter_share/esys_flutter_share.dart';
import 'package:flutter_mobx/flutter_mobx.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/themes.dart';
import 'package:cake_wallet/theme_changer.dart';
import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
class WalletSeedPage extends BasePage {
WalletSeedPage(this.walletSeedViewModel, {this.onCloseCallback});
WalletSeedPage(this.walletSeedViewModel, {@required this.isNewWalletCreated});
static final imageLight = Image.asset('assets/images/crypto_lock_light.png');
static final imageDark = Image.asset('assets/images/crypto_lock.png');
@@ -19,36 +20,38 @@ class WalletSeedPage extends BasePage {
@override
String get title => S.current.seed_title;
final VoidCallback onCloseCallback;
final bool isNewWalletCreated;
final WalletSeedViewModel walletSeedViewModel;
@override
void onClose(BuildContext context) =>
onCloseCallback != null ? onCloseCallback() : Navigator.of(context).pop();
isNewWalletCreated
? Navigator.of(context).popUntil((route) => route.isFirst)
: Navigator.of(context).pop();
@override
Widget leading(BuildContext context) =>
onCloseCallback != null ? Offstage() : super.leading(context);
isNewWalletCreated ? Offstage() : super.leading(context);
@override
Widget trailing(BuildContext context) {
return onCloseCallback != null
return isNewWalletCreated
? GestureDetector(
onTap: () => onClose(context),
child: Container(
width: 100,
height: 42,
height: 32,
alignment: Alignment.center,
margin: EdgeInsets.only(left: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16)),
color: Theme.of(context).accentTextTheme.title.color),
color: Theme.of(context).accentTextTheme.caption.color),
child: Text(
S.of(context).seed_language_next,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Colors.blue),
color: Palette.blueCraiola),
),
),
)
@@ -57,9 +60,7 @@ class WalletSeedPage extends BasePage {
@override
Widget body(BuildContext context) {
final _themeChanger = Provider.of<ThemeChanger>(context);
final image =
_themeChanger.getTheme() == Themes.darkTheme ? imageDark : imageLight;
final image = getIt.get<SettingsStore>().isDarkTheme ? imageDark : imageLight;
return Container(
padding: EdgeInsets.all(24),
@@ -85,22 +86,23 @@ class WalletSeedPage extends BasePage {
walletSeedViewModel.name,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
),
Padding(
padding: EdgeInsets.only(top: 20),
padding: EdgeInsets.only(top: 20, left: 16, right: 16),
child: Text(
walletSeedViewModel.seed,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.primaryTextTheme
.caption
.overline
.color),
),
)
@@ -108,42 +110,63 @@ class WalletSeedPage extends BasePage {
);
}),
),
Row(
mainAxisSize: MainAxisSize.max,
Column(
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton(
onPressed: () => Share.text(
S.of(context).seed_share,
walletSeedViewModel.seed,
'text/plain'),
text: S.of(context).save,
color: Colors.green,
textColor: Colors.white),
)),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
onPressed: () {
Clipboard.setData(ClipboardData(
text: walletSeedViewModel.seed));
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
S.of(context).copied_to_clipboard),
backgroundColor: Colors.green,
duration: Duration(milliseconds: 1500),
),
);
},
text: S.of(context).copy,
color: Colors.blue,
textColor: Colors.white)),
))
isNewWalletCreated
? Padding(
padding: EdgeInsets.only(bottom: 52, left: 43, right: 43),
child: Text(
S.of(context).seed_reminder,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.primaryTextTheme
.overline
.color
),
),
)
: Offstage(),
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton(
onPressed: () => Share.text(
S.of(context).seed_share,
walletSeedViewModel.seed,
'text/plain'),
text: S.of(context).save,
color: Colors.green,
textColor: Colors.white),
)),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
onPressed: () {
Clipboard.setData(ClipboardData(
text: walletSeedViewModel.seed));
Scaffold.of(context).showSnackBar(
SnackBar(
content: Text(
S.of(context).copied_to_clipboard),
backgroundColor: Colors.green,
duration: Duration(milliseconds: 1500),
),
);
},
text: S.of(context).copy,
color: Palette.blueCraiola,
textColor: Colors.white)),
))
],
)
],
)
],
+1 -1
View File
@@ -116,7 +116,7 @@ class WalletMenu {
return;
}
auth.close();
await Navigator.of(context).pushNamed(Routes.seed);
await Navigator.of(context).pushNamed(Routes.seed, arguments: false);
});
break;
case 2: