Merge branch 'newdesign' into CWA-205-update-restore-wallet-screens

# Conflicts:
#	lib/src/screens/exchange/exchange_page.dart
#	lib/src/screens/new_wallet/new_wallet_page.dart
#	lib/src/screens/new_wallet/widgets/select_button.dart
#	lib/src/screens/rescan/rescan_page.dart
#	lib/src/screens/restore/restore_wallet_from_keys_page.dart
#	lib/src/screens/restore/restore_wallet_from_seed_details.dart
#	lib/src/screens/seed_language/widgets/seed_language_picker.dart
#	lib/src/widgets/primary_button.dart
This commit is contained in:
Oleksandr Sobol
2020-05-01 22:51:27 +03:00
74 changed files with 864 additions and 465 deletions
+28 -33
View File
@@ -1,16 +1,40 @@
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/wallet_card.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/trade_history_panel.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/menu_widget.dart';
class DashboardPage extends BasePage {
final _bodyKey = GlobalKey();
@override
ObstructingPreferredSizeWidget appBar(BuildContext context) => null;
Color get backgroundColor => PaletteDark.mainBackgroundColor;
@override
Widget trailing(BuildContext context) {
final menuButton = Image.asset('assets/images/header.png');
return SizedBox(
height: 37,
width: 37,
child: ButtonTheme(
minWidth: double.minPositive,
child: FlatButton(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () async {
await showDialog<void>(
builder: (_) => MenuWidget(),
context: context
);
},
child: menuButton),
),
);
}
@override
Widget body(BuildContext context) => DashboardPageBody(key: _bodyKey);
@@ -24,46 +48,17 @@ class DashboardPageBody extends StatefulWidget {
}
class DashboardPageBodyState extends State<DashboardPageBody> {
final menuButton = Image.asset('assets/images/menu_button.png');
@override
Widget build(BuildContext context) {
final List<Color> colors = [PaletteDark.backgroundStart, PaletteDark.backgroundEnd];
return SafeArea(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: colors
)
),
color: PaletteDark.mainBackgroundColor,
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 14),
child: Container(
width: double.infinity,
alignment: Alignment.centerRight,
child: SizedBox(
height: 37,
width: 37,
child: ButtonTheme(
minWidth: double.minPositive,
child: FlatButton(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () => showDialog<void>(
builder: (_) => MenuWidget(),
context: context
),
child: menuButton),
),
),
)
),
Padding(
padding: EdgeInsets.only(left: 20, top: 23),
padding: EdgeInsets.only(left: 20, top: 10),
child: WalletCard(),
),
SizedBox(
@@ -86,25 +86,6 @@ class WalletMenu {
},
reconnectActionRight: () => Navigator.of(context).pop()
);
/*AlertDialog(
title: Text(
S.of(context).reconnection,
textAlign: TextAlign.center,
),
content: Text(S.of(context).reconnect_alert_text),
actions: <Widget>[
FlatButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(S.of(context).cancel)),
FlatButton(
onPressed: () {
walletStore.reconnect();
Navigator.of(context).pop();
},
child: Text(S.of(context).ok))
],
);*/
});
}
}
@@ -274,7 +274,7 @@ class ButtonHeader extends SliverPersistentHeaderDelegate {
width: 48,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.white,
color: PaletteDark.borderCardColor,
shape: BoxShape.circle
),
child: image,
@@ -24,7 +24,7 @@ class WalletCardState extends State<WalletCard> {
final _balanceObserverKey = GlobalKey();
final _addressObserverKey = GlobalKey();
final List<Color> colorsSync = [PaletteDark.walletCardTopEndSync, PaletteDark.walletCardBottomEndSync];
final List<Color> colorsSync = [PaletteDark.walletCardSubAddressField, PaletteDark.walletCardBottomEndSync];
double cardWidth;
double cardHeight;
double screenWidth;
@@ -45,12 +45,12 @@ class WalletCardState extends State<WalletCard> {
}
void afterLayout(dynamic _) {
screenWidth = MediaQuery.of(context).size.width;
screenWidth = MediaQuery.of(context).size.width - 20;
setState(() {
cardWidth = screenWidth;
opacity = 1;
});
Timer(Duration(milliseconds: 350), () =>
Timer(Duration(milliseconds: 500), () =>
setState(() => isDraw = true)
);
}
@@ -67,20 +67,34 @@ class WalletCardState extends State<WalletCard> {
height: cardHeight,
duration: Duration(milliseconds: 500),
curve: Curves.fastOutSlowIn,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
gradient: LinearGradient(
colors: [PaletteDark.walletCardTopStartSync.withOpacity(opacity),
PaletteDark.walletCardBottomStartSync.withOpacity(opacity)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter
)
padding: EdgeInsets.only(
top: 1,
left: 1,
bottom: 1
),
child: InkWell(
onTap: () => setState(() => isFrontSide = !isFrontSide),
child: isFrontSide
? frontSide()
: backSide()
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
color: PaletteDark.borderCardColor,
boxShadow: [
BoxShadow(
color: PaletteDark.historyPanel.withOpacity(0.5),
blurRadius: 8,
offset: Offset(5, 5))
]
),
child: Container(
width: cardWidth,
height: cardHeight,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
color: PaletteDark.historyPanel
),
child: InkWell(
onTap: () => setState(() => isFrontSide = !isFrontSide),
child: isFrontSide
? frontSide()
: backSide()
),
),
),
);
@@ -99,6 +113,7 @@ class WalletCardState extends State<WalletCard> {
final status = syncStore.status;
final statusText = status.title();
final progress = syncStore.status.progress();
final indicatorWidth = progress * cardWidth;
String shortAddress = walletStore.subaddress.address;
shortAddress = shortAddress.replaceRange(4, shortAddress.length - 4, '...');
@@ -125,7 +140,7 @@ class WalletCardState extends State<WalletCard> {
children: <Widget>[
Container(
height: cardHeight,
width: progress * cardWidth,
width: indicatorWidth,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
gradient: LinearGradient(
@@ -135,6 +150,18 @@ class WalletCardState extends State<WalletCard> {
)
),
),
progress != 1
? Positioned(
left: indicatorWidth,
top: 0,
bottom: 0,
child: Container(
width: 1,
height: cardHeight,
color: PaletteDark.borderCardColor,
)
)
: Offstage(),
isDraw ? Positioned(
left: 20,
right: 20,
@@ -303,7 +330,7 @@ class WalletCardState extends State<WalletCard> {
final walletStore = Provider.of<WalletStore>(context);
final rightArrow = Image.asset('assets/images/right_arrow.png');
double messageBoxHeight = 0;
double messageBoxWidth = cardWidth - 30;
double messageBoxWidth = cardWidth - 10;
return Observer(
key: _addressObserverKey,
@@ -358,7 +385,7 @@ class WalletCardState extends State<WalletCard> {
try {
_addressObserverKey.currentState.setState(() {
messageBoxHeight = 0;
messageBoxWidth = cardWidth - 30;
messageBoxWidth = cardWidth - 10;
});
} catch(e) {
print('${e.toString()}');
+1 -1
View File
@@ -255,7 +255,7 @@ class ExchangeFormState extends State<ExchangeForm> {
.primaryTextTheme
.button
.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading: exchangeStore.tradeState is TradeIsCreating,
)),
Observer(builder: (_) {
+128 -68
View File
@@ -14,7 +14,9 @@ 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';
import 'package:cake_wallet/src/screens/new_wallet/widgets/wallet_creation_dialog.dart';
class NewWalletPage extends BasePage {
NewWalletPage(
@@ -29,6 +31,9 @@ class NewWalletPage extends BasePage {
@override
String get title => S.current.new_wallet;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget body(BuildContext context) => WalletNameForm();
}
@@ -39,14 +44,42 @@ class WalletNameForm extends StatefulWidget {
}
class _WalletNameFormState extends State<WalletNameForm> {
static const aspectRatioImage = 1.22;
final _formKey = GlobalKey<FormState>();
final nameController = TextEditingController();
final walletNameImage = Image.asset('assets/images/wallet_name.png');
@override
void dispose() {
nameController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final walletCreationStore = Provider.of<WalletCreationStore>(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
];
nameController.addListener(() {
if (nameController.text.isNotEmpty) {
walletCreationStore.setDisabledStatus(false);
} else {
walletCreationStore.setDisabledStatus(true);
}
});
reaction((_) => walletCreationStore.state, (WalletCreationState state) {
if (state is WalletCreatedSuccessfully) {
Navigator.of(context).popUntil((route) => route.isFirst);
@@ -56,80 +89,107 @@ class _WalletNameFormState extends State<WalletNameForm> {
WidgetsBinding.instance.addPostFrameCallback((_) {
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(),
),
],
builder: (_) {
return WalletCreationDialog(
dialogTitle: S.current.new_wallet,
dialogContent: state.error,
dialogButtonText: S.of(context).ok,
dialogButtonAction: () => Navigator.of(context).pop()
);
});
});
}
});
return ScrollableWithBottomSection(
content: Column(children: [
Padding(
padding: EdgeInsets.only(bottom: 10),
child: Image.asset('assets/images/bitmap.png',
height: 224, width: 400),
),
Padding(
padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: Form(
key: _formKey,
child: TextFormField(
style: TextStyle(
fontSize: 24.0,
color: Theme.of(context).accentTextTheme.subtitle.color),
controller: nameController,
decoration: InputDecoration(
hintStyle: TextStyle(
fontSize: 24.0, color: Theme.of(context).hintColor),
hintText: S.of(context).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) {
walletCreationStore.validateWalletName(value);
return walletCreationStore.errorMessage;
},
)),
),
Padding(padding: EdgeInsets.only(bottom: 20),
child: Text(
S.of(context).seed_language_choose,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16.0),
return Container(
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: 24),
child: Form(
key: _formKey,
child: TextFormField(
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
color: Colors.white),
controller: nameController,
decoration: InputDecoration(
hintStyle: TextStyle(
fontSize: 16.0,
color: PaletteDark.walletCardText),
hintText: S.of(context).wallet_name,
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(
color: PaletteDark.walletCardSubAddressField,
width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteDark.walletCardSubAddressField,
width: 1.0))),
validator: (value) {
walletCreationStore.validateWalletName(value);
return walletCreationStore.errorMessage;
},
)),
),
),
Padding(padding: EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: SeedLanguagePicker(),
)
]),
bottomSection: Observer(
builder: (context) {
return LoadingPrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
walletCreationStore.create(name: nameController.text,
language: seedLanguageStore.selectedSeedLanguage);
}
},
text: S.of(context).continue_text,
color: Theme.of(context).primaryTextTheme.button.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
isLoading: walletCreationStore.state is WalletIsCreating,
);
},
));
Padding(padding: EdgeInsets.only(top: 40),
child: Text(
S.of(context).seed_language_choose,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
),
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()
)
)
),
)
]),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: Observer(
builder: (context) {
return LoadingPrimaryButton(
onPressed: () {
if (_formKey.currentState.validate()) {
walletCreationStore.create(name: nameController.text,
language: seedLanguageStore.selectedSeedLanguage);
}
},
text: S.of(context).continue_text,
color: Colors.green,
textColor: Colors.white,
isLoading: walletCreationStore.state is WalletIsCreating,
isDisabled: walletCreationStore.isDisabledStatus,
);
},
)),
);
}
}
@@ -0,0 +1,146 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.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/scollable_with_bottom_section.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
import 'package:cake_wallet/routes.dart';
class NewWalletTypePage extends BasePage {
@override
String get title => S.current.new_wallet;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget body(BuildContext context) => WalletTypeForm();
}
class WalletTypeForm extends StatefulWidget {
@override
WalletTypeFormState createState() => WalletTypeFormState();
}
class WalletTypeFormState extends State<WalletTypeForm> {
static const aspectRatioImage = 1.22;
final moneroIcon = Image.asset('assets/images/monero.png', height: 24, width: 24);
final bitcoinIcon = Image.asset('assets/images/bitcoin.png', height: 24, width: 24);
final walletTypeImage = Image.asset('assets/images/wallet_type.png');
bool isDisabledButton;
bool isMoneroSelected;
bool isBitcoinSelected;
Color moneroBackgroundColor;
Color moneroTextColor;
Color bitcoinBackgroundColor;
Color bitcoinTextColor;
@override
void initState() {
isDisabledButton = true;
isMoneroSelected = false;
isBitcoinSelected = false;
moneroBackgroundColor = PaletteDark.menuList;
moneroTextColor = Colors.white;
bitcoinBackgroundColor = PaletteDark.menuList;
bitcoinTextColor = Colors.white;
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
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: <Widget>[
Padding(
padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(child: walletTypeImage, fit: BoxFit.fill)),
),
Padding(
padding: EdgeInsets.only(top: 48),
child: Text(
S.of(context).choose_wallet_currency,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
),
Padding(
padding: EdgeInsets.only(top: 24),
child: SelectButton(
image: bitcoinIcon,
text: 'Bitcoin',
color: bitcoinBackgroundColor,
textColor: bitcoinTextColor,
onTap: () {}),
),
Padding(
padding: EdgeInsets.only(top: 20),
child: SelectButton(
image: moneroIcon,
text: 'Monero',
color: moneroBackgroundColor,
textColor: moneroTextColor,
onTap: () => onSelectMoneroButton()),
)
],
),
bottomSectionPadding: EdgeInsets.only(
left: 24,
right: 24,
bottom: 24
),
bottomSection: PrimaryButton(
onPressed: () => Navigator.of(context).pushNamed(Routes.newWallet),
text: S.of(context).seed_language_next,
color: Colors.green,
textColor: Colors.white,
isDisabled: isDisabledButton,
),
),
);
}
void onSelectMoneroButton() {
isMoneroSelected = true;
isBitcoinSelected = false;
isDisabledButton = false;
moneroBackgroundColor = Colors.white;
moneroTextColor = PaletteDark.selectButtonText;
bitcoinBackgroundColor = PaletteDark.menuList;
bitcoinTextColor = Colors.white;
setState(() {});
}
void onSelectBitcoinButton() {
isMoneroSelected = false;
isBitcoinSelected = true;
isDisabledButton = false;
moneroBackgroundColor = PaletteDark.menuList;
moneroTextColor = Colors.white;
bitcoinBackgroundColor = Colors.white;
bitcoinTextColor = PaletteDark.selectButtonText;
setState(() {});
}
}
@@ -27,8 +27,8 @@ class SelectButton extends StatelessWidget {
padding: EdgeInsets.only(left: 30, right: 30),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(30)),
color: color
borderRadius: BorderRadius.all(Radius.circular(30)),
color: color
),
child: Row(
mainAxisSize: MainAxisSize.max,
@@ -40,18 +40,18 @@ class SelectButton extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image != null
? image
: Offstage(),
? image
: Offstage(),
Padding(
padding: image != null
? EdgeInsets.only(left: 15)
: EdgeInsets.only(left: 0),
? EdgeInsets.only(left: 15)
: EdgeInsets.only(left: 0),
child: Text(
text,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: textColor
fontSize: 18,
fontWeight: FontWeight.w600,
color: textColor
),
),
)
@@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
class WalletCreationDialog extends BaseAlertDialog {
WalletCreationDialog({
@required this.dialogTitle,
@required this.dialogContent,
@required this.dialogButtonText,
@required this.dialogButtonAction,
});
final String dialogTitle;
final String dialogContent;
final String dialogButtonText;
final VoidCallback dialogButtonAction;
@override
String get titleText => dialogTitle;
@override
String get contentText => dialogContent;
@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: dialogButtonAction,
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
child: Text(
dialogButtonText,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: Colors.blue,
decoration: TextDecoration.none,
),
)),
),
);
}
}
+1 -1
View File
@@ -33,7 +33,7 @@ class RescanPage extends BasePage {
},
color:
Theme.of(context).primaryTextTheme.button.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color))
textColor: Theme.of(context).primaryTextTheme.button.color,))
]),
);
}
+2 -1
View File
@@ -41,6 +41,7 @@ class SeedPage extends BasePage {
child: Container(
width: 70,
height: 32,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16)),
color: PaletteDark.menuList
@@ -48,7 +49,7 @@ class SeedPage extends BasePage {
child: Text(
S.of(context).seed_language_next,
style: TextStyle(
fontSize: 14,
fontSize: 10,
fontWeight: FontWeight.w600,
color: Colors.blue
),
@@ -74,8 +74,8 @@ class SeedLanguagePickerState extends State<SeedLanguagePicker> {
height: 300,
width: 300,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(14)),
color: PaletteDark.walletCardSubAddressField
borderRadius: BorderRadius.all(Radius.circular(14)),
color: PaletteDark.walletCardSubAddressField
),
child: GridView.count(
shrinkWrap: true,
@@ -89,11 +89,11 @@ class SeedLanguagePickerState extends State<SeedLanguagePicker> {
if (index == 8) {
return gridTile(
isCurrent: false,
place: Places.bottomRight,
image: null,
text: '',
onTap: null);
isCurrent: false,
place: Places.bottomRight,
image: null,
text: '',
onTap: null);
} else {
@@ -103,52 +103,52 @@ class SeedLanguagePickerState extends State<SeedLanguagePicker> {
if (index == 0) {
return gridTile(
isCurrent: isCurrent,
place: Places.topLeft,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
if (index == 2) {
return gridTile(
isCurrent: isCurrent,
place: Places.topRight,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
if (index == 6) {
return gridTile(
isCurrent: isCurrent,
place: Places.bottomLeft,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
return gridTile(
isCurrent: isCurrent,
place: Places.inside,
place: Places.topLeft,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
if (index == 2) {
return gridTile(
isCurrent: isCurrent,
place: Places.topRight,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
if (index == 6) {
return gridTile(
isCurrent: isCurrent,
place: Places.bottomLeft,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
return gridTile(
isCurrent: isCurrent,
place: Places.inside,
image: flag,
text: code,
onTap: () {
seedLanguageStore.setSelectedSeedLanguage(seedLanguages[index]);
Navigator.of(context).pop();
}
);
}
}),
@@ -195,40 +195,40 @@ class SeedLanguagePickerState extends State<SeedLanguagePicker> {
}
return GestureDetector(
onTap: onTap,
child: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: borderRadius,
color: color
),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image != null
? image
: Offstage(),
Padding(
padding: image != null
? EdgeInsets.only(left: 10)
: EdgeInsets.only(left: 0),
child: Text(
text,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: textColor
),
onTap: onTap,
child: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: borderRadius,
color: color
),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
image != null
? image
: Offstage(),
Padding(
padding: image != null
? EdgeInsets.only(left: 10)
: EdgeInsets.only(left: 0),
child: Text(
text,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: textColor
),
)
],
),
),
)
],
),
)
),
)
);
}
}
@@ -9,13 +9,15 @@ import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_row.dart';
import 'package:cake_wallet/palette.dart';
class TradeDetailsPage extends BasePage {
@override
String get title => S.current.trade_details_title;
@override
bool get isModalBackButton => true;
Color get backgroundColor => PaletteDark.historyPanel;
@override
String get title => S.current.trade_details_title;
@override
Widget body(BuildContext context) {
@@ -26,7 +28,8 @@ class TradeDetailsPage extends BasePage {
formatDefault: "dd.MM.yyyy, HH:mm");
return Container(
padding: EdgeInsets.only(top: 10.0, bottom: 10.0, left: 20, right: 15),
color: PaletteDark.historyPanel,
padding: EdgeInsets.only(top: 20, bottom: 20),
child: Observer(builder: (_) {
final trade = exchangeStore.trade;
final items = [
@@ -58,15 +61,22 @@ class TradeDetailsPage extends BasePage {
}
return ListView.separated(
separatorBuilder: (_, __) => Divider(
color: Theme.of(context).dividerTheme.color,
height: 1.0,
),
padding:
EdgeInsets.only(left: 25, top: 10, right: 25, bottom: 15),
separatorBuilder: (_, __) => Container(
height: 1,
padding: EdgeInsets.only(left: 24),
color: PaletteDark.menuList,
child: Container(
height: 1,
color: PaletteDark.walletCardTopEndSync,
),
),
itemCount: items.length,
itemBuilder: (BuildContext context, int index) {
final item = items[index];
final isDrawTop = index == 0 ? true : false;
final isDrawBottom = index == items.length - 1 ? true : false;
return GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: '${item.value}'));
@@ -80,7 +90,11 @@ class TradeDetailsPage extends BasePage {
);
},
child: StandartListRow(
title: '${item.title}', value: '${item.value}'));
title: '${item.title}',
value: '${item.value}',
isDrawTop: isDrawTop,
isDrawBottom: isDrawBottom,
));
});
}));
}
@@ -2,29 +2,57 @@ import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class StandartListRow extends StatelessWidget {
StandartListRow({this.title, this.value});
StandartListRow({this.title, this.value, this.isDrawTop, this.isDrawBottom});
final String title;
final String value;
final bool isDrawTop;
final bool isDrawBottom;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 10, bottom: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(title,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryTextTheme.overline.color),
textAlign: TextAlign.left),
Padding(
padding: const EdgeInsets.only(top: 5),
child: Text(value,
style: TextStyle(fontSize: 14, color: Palette.wildDarkBlue)),
)
]),
return Column(
children: <Widget>[
isDrawTop
? Container(
width: double.infinity,
height: 1,
color: PaletteDark.walletCardTopEndSync,
)
: Offstage(),
Container(
width: double.infinity,
color: PaletteDark.menuList,
child: Padding(
padding: const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(title,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: PaletteDark.walletCardText),
textAlign: TextAlign.left),
Padding(
padding: const EdgeInsets.only(top: 12),
child: Text(value,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white)),
)
]),
),
),
isDrawBottom
? Container(
width: double.infinity,
height: 1,
color: PaletteDark.walletCardTopEndSync,
)
: Offstage(),
],
);
}
}
@@ -8,6 +8,7 @@ import 'package:cake_wallet/src/stores/settings/settings_store.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart';
import 'package:cake_wallet/src/screens/transaction_details/standart_list_row.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/palette.dart';
class TransactionDetailsPage extends BasePage {
TransactionDetailsPage({this.transactionInfo});
@@ -15,7 +16,7 @@ class TransactionDetailsPage extends BasePage {
final TransactionInfo transactionInfo;
@override
bool get isModalBackButton => true;
Color get backgroundColor => PaletteDark.historyPanel;
@override
String get title => S.current.transaction_details_title;
@@ -77,17 +78,25 @@ class TransactionDetailsFormState extends State<TransactionDetailsForm> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(left: 20, right: 15, top: 10, bottom: 10),
color: PaletteDark.historyPanel,
padding: EdgeInsets.only(top: 20, bottom: 20),
child: ListView.separated(
separatorBuilder: (context, index) => Container(
height: 1,
color: Theme.of(context).dividerTheme.color,
),
padding: EdgeInsets.only(left: 25, top: 10, right: 25, bottom: 15),
height: 1,
padding: EdgeInsets.only(left: 24),
color: PaletteDark.menuList,
child: Container(
height: 1,
color: PaletteDark.walletCardTopEndSync,
),
),
itemCount: _items.length,
itemBuilder: (context, index) {
final item = _items[index];
final isDrawTop = index == 0 ? true : false;
final isDrawBottom = index == _items.length - 1 ? true : false;
return GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: item.value));
@@ -101,7 +110,11 @@ class TransactionDetailsFormState extends State<TransactionDetailsForm> {
);
},
child:
StandartListRow(title: '${item.title}:', value: item.value),
StandartListRow(
title: '${item.title}:',
value: item.value,
isDrawTop: isDrawTop,
isDrawBottom: isDrawBottom),
);
}),
);
@@ -152,7 +152,7 @@ class WalletListBodyState extends State<WalletListBody> {
),
bottomSection: Column(children: <Widget>[
PrimaryImageButton(
onPressed: () => Navigator.of(context).pushNamed(Routes.newWallet),
onPressed: () => Navigator.of(context).pushNamed(Routes.newWalletType),
image: newWalletImage,
text: S.of(context).wallet_list_create_new_wallet,
color: Colors.white,
+90 -72
View File
@@ -4,12 +4,16 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
class WelcomePage extends BasePage {
static const _aspectRatioImage = 1.26;
static const _baseWidth = 411.43;
final _image = Image.asset('assets/images/welcomeImg.png');
final _cakeLogo = Image.asset('assets/images/cake_logo.png');
static const aspectRatioImage = 1.25;
final welcomeImage = Image.asset('assets/images/welcome.png');
final newWalletImage = Image.asset('assets/images/new_wallet.png', height: 12, width: 12, color: PaletteDark.historyPanel);
final restoreWalletImage = Image.asset('assets/images/restore_wallet.png', height: 12, width: 12, color: Colors.white);
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget build(BuildContext context) {
@@ -21,75 +25,89 @@ class WelcomePage extends BasePage {
@override
Widget body(BuildContext context) {
final _screenWidth = MediaQuery.of(context).size.width;
final textScaleFactor = _screenWidth < _baseWidth ? 0.76 : 1.0;
return Column(children: <Widget>[
Stack(
alignment: Alignment.center,
children: <Widget>[
AspectRatio(
aspectRatio: _aspectRatioImage,
child: FittedBox(child: _image, fit: BoxFit.fill)),
Positioned(bottom: 0.0, child: _cakeLogo)
],
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
S.of(context).welcome,
style: TextStyle(
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
return Container(
padding: EdgeInsets.only(top: 20),
color: PaletteDark.historyPanel,
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(bottom: 20),
content: Column(
children: <Widget>[
AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(child: welcomeImage, fit: BoxFit.fill)),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, top: 40),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
S.of(context).welcome,
style: TextStyle(
fontSize: 18,
color: PaletteDark.walletCardText,
),
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.only(top: 10),
child: Text(
S.of(context).cake_wallet,
style: TextStyle(
fontSize: 36,
fontWeight: FontWeight.bold,
color: Colors.white,
),
textAlign: TextAlign.center,
),
),
Padding(
padding: EdgeInsets.only(top: 14),
child: Text(
S.of(context).first_wallet_text,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: PaletteDark.walletCardText,
),
textAlign: TextAlign.center,
),
),
],
),
Text(
S.of(context).first_wallet_text,
style: TextStyle(
fontSize: 22.0,
color: Palette.lightBlue,
),
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
),
Text(
S.of(context).please_make_selection,
style: TextStyle(
fontSize: 16.0,
color: Palette.lightBlue,
),
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
)
]),
),
Container(
padding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 20.0),
child: Column(children: <Widget>[
PrimaryButton(
onPressed: () {
Navigator.pushNamed(context, Routes.newWalletFromWelcome);
},
text: S.of(context).create_new,
color:
Theme.of(context).primaryTextTheme.button.backgroundColor,
textColor:
Theme.of(context).primaryTextTheme.button.color),
SizedBox(height: 10),
PrimaryButton(
onPressed: () {
Navigator.pushNamed(context, Routes.restoreOptions);
},
color: Theme.of(context).accentTextTheme.caption.backgroundColor,
textColor:
Theme.of(context).primaryTextTheme.button.color,
text: S.of(context).restore_wallet,
)
]))
]);
],
),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 20),
bottomSection: Column(children: <Widget>[
Text(
S.of(context).please_make_selection,
style: TextStyle(
fontSize: 12,
color: PaletteDark.walletCardText,
),
textAlign: TextAlign.center,
),
Padding(
padding: EdgeInsets.only(top: 24),
child: PrimaryImageButton(
onPressed: () => Navigator.pushNamed(context, Routes.newWalletFromWelcome),
image: newWalletImage,
text: S.of(context).create_new,
color: Colors.white,
textColor: PaletteDark.historyPanel),
),
Padding(
padding: EdgeInsets.only(top: 10),
child: PrimaryImageButton(
onPressed: () => Navigator.pushNamed(context, Routes.restoreOptions),
image: restoreWalletImage,
text: S.of(context).restore_wallet,
color: PaletteDark.historyPanelButton,
textColor: Colors.white),
)
]),
),
);
}
}
@@ -16,6 +16,7 @@ abstract class WalletCreationStoreBase with Store {
@required this.walletListService,
@required this.sharedPreferences}) {
state = WalletCreationStateInitial();
isDisabledStatus = true;
}
final AuthenticationStore authStore;
@@ -31,6 +32,9 @@ abstract class WalletCreationStoreBase with Store {
@observable
bool isValid;
@observable
bool isDisabledStatus;
@action
Future create({String name, String language}) async {
state = WalletCreationStateInitial();
@@ -45,6 +49,11 @@ abstract class WalletCreationStoreBase with Store {
}
}
@action
void setDisabledStatus(bool isDisabled) {
isDisabledStatus = isDisabled;
}
void validateWalletName(String value) {
const pattern = '^[a-zA-Z0-9_]{1,15}\$';
final regExp = RegExp(pattern);
+3 -2
View File
@@ -42,9 +42,10 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
/*backgroundColor:
_isDarkTheme ? Theme.of(context).backgroundColor : backgroundColor,*/
decoration: BoxDecoration(
color: _isDarkTheme
color: backgroundColor,
/*_isDarkTheme
? Theme.of(context).backgroundColor
: backgroundColor,
: backgroundColor,*/
boxShadow: [
BoxShadow(
color: Color.fromRGBO(132, 141, 198, 0.11),
-28
View File
@@ -185,34 +185,6 @@ class PrimaryImageButton extends StatelessWidget {
],
),
)
/*Row(
children: <Widget>[
Container(
width: 28.0,
height: 56.0,
decoration: BoxDecoration(
shape: BoxShape.circle, color: Colors.transparent),
child: image,
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: 56.0,
child: Center(
child: Text(text,
style: TextStyle(
fontSize: 18.0,
color: Theme.of(context)
.primaryTextTheme
.button
.color)),
),
)
]))
],
),*/
));
}
}