Merge pull request #54 from cake-tech/CWA-205-update-restore-wallet-screens
Cwa 205 update restore wallet screenswownero
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 8.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
@ -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
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -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,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,101 +1,71 @@
|
|||||||
|
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:auto_size_text/auto_size_text.dart';
|
|
||||||
|
|
||||||
class RestoreButton extends StatelessWidget {
|
class RestoreButton extends StatelessWidget {
|
||||||
const RestoreButton(
|
const RestoreButton({
|
||||||
{@required this.onPressed,
|
@required this.onPressed,
|
||||||
@required this.imageWidget,
|
@required this.image,
|
||||||
@required this.color,
|
@required this.title,
|
||||||
@required this.titleColor,
|
@required this.description});
|
||||||
this.title = '',
|
|
||||||
this.description = '',
|
|
||||||
this.textButton = ''});
|
|
||||||
|
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
final Widget imageWidget;
|
final Image image;
|
||||||
final Color color;
|
|
||||||
final Color titleColor;
|
|
||||||
final String title;
|
final String title;
|
||||||
final String description;
|
final String description;
|
||||||
final String textButton;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return GestureDetector(
|
||||||
margin: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
onTap: onPressed,
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
color: Theme.of(context).accentTextTheme.headline.backgroundColor,
|
width: double.infinity,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.0)),
|
height: 150,
|
||||||
boxShadow: [
|
padding: EdgeInsets.all(24),
|
||||||
BoxShadow(
|
alignment: Alignment.topLeft,
|
||||||
color: Palette.buttonShadow,
|
decoration: BoxDecoration(
|
||||||
blurRadius: 10,
|
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||||
offset: Offset(
|
color: PaletteDark.menuList
|
||||||
0,
|
),
|
||||||
12,
|
child: Row(
|
||||||
),
|
mainAxisSize: MainAxisSize.max,
|
||||||
)
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
]),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: InkWell(
|
children: <Widget>[
|
||||||
onTap: onPressed,
|
image,
|
||||||
borderRadius: BorderRadius.all(Radius.circular(20.0)),
|
Expanded(
|
||||||
child: Column(
|
child: Padding(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
padding: EdgeInsets.only(left: 16),
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
imageWidget,
|
mainAxisSize: MainAxisSize.max,
|
||||||
Column(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: <Widget>[
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Padding(
|
children: <Widget>[
|
||||||
padding: EdgeInsets.only(left: 20, right: 20),
|
Text(
|
||||||
child: AutoSizeText(
|
|
||||||
title,
|
title,
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: titleColor,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.w600,
|
||||||
maxLines: 2,
|
color: Colors.white
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
Padding(
|
padding: EdgeInsets.only(top: 5),
|
||||||
padding: EdgeInsets.only(left: 20, right: 20, top: 10),
|
child: Text(
|
||||||
child: AutoSizeText(
|
description,
|
||||||
description,
|
style: TextStyle(
|
||||||
textAlign: TextAlign.center,
|
fontSize: 14,
|
||||||
style: TextStyle(
|
color: PaletteDark.walletCardText
|
||||||
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),
|
|
||||||
),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,52 +1,99 @@
|
|||||||
|
import 'package:provider/provider.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';
|
||||||
import 'package:cake_wallet/generated/i18n.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/base_page.dart';
|
||||||
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
import 'package:provider/provider.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/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 {
|
class SeedLanguage extends BasePage {
|
||||||
final imageSeed = Image.asset('assets/images/seedIco.png');
|
@override
|
||||||
|
Color get backgroundColor => PaletteDark.historyPanel;
|
||||||
|
|
||||||
@override
|
@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 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(
|
return Container(
|
||||||
padding: EdgeInsets.all(20.0),
|
color: PaletteDark.historyPanel,
|
||||||
child: Column(
|
padding: EdgeInsets.only(top: 24),
|
||||||
children: <Widget>[
|
child: ScrollableWithBottomSection(
|
||||||
Expanded(
|
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
child: Center(
|
content: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [
|
||||||
children: <Widget>[
|
Padding(
|
||||||
imageSeed,
|
padding: EdgeInsets.only(left: 12, right: 12),
|
||||||
Text(
|
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,
|
S.of(context).seed_language_choose,
|
||||||
textAlign: TextAlign.center,
|
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(),
|
)
|
||||||
],
|
]),
|
||||||
),
|
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
),
|
bottomSection: Observer(
|
||||||
),
|
builder: (context) {
|
||||||
PrimaryButton(
|
return PrimaryButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
|
Navigator.of(context).popAndPushNamed(seedLanguageStore.currentRoute),
|
||||||
text: S.of(context).seed_language_next,
|
text: S.of(context).seed_language_next,
|
||||||
color:
|
color: Colors.green,
|
||||||
Theme.of(context).primaryTextTheme.button.backgroundColor,
|
textColor: Colors.white);
|
||||||
textColor:
|
},
|
||||||
Theme.of(context).primaryTextTheme.button.color),
|
)),
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|