Merged with 4.1.0

This commit is contained in:
Tanner Silva
2020-12-24 18:15:03 -06:00
132 changed files with 5479 additions and 1402 deletions
+16 -13
View File
@@ -1,3 +1,4 @@
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
@@ -9,13 +10,13 @@ enum AppBarStyle { regular, withShadow, transparent }
abstract class BasePage extends StatelessWidget {
BasePage()
: _scaffoldKey = GlobalKey<ScaffoldState>(),
_closeButtonImage = Image.asset('assets/images/close_button.png'),
_closeButtonImageDarkTheme =
Image.asset('assets/images/close_button_dark_theme.png');
: _scaffoldKey = GlobalKey<ScaffoldState>();
final GlobalKey<ScaffoldState> _scaffoldKey;
final Image _closeButtonImage;
final Image _closeButtonImageDarkTheme;
final Image closeButtonImage =
Image.asset('assets/images/close_button.png');
final Image closeButtonImageDarkTheme =
Image.asset('assets/images/close_button_dark_theme.png');
String get title => null;
@@ -37,7 +38,7 @@ abstract class BasePage extends StatelessWidget {
Widget Function(BuildContext, Widget) get rootWrapper => null;
bool get isDarkTheme => getIt.get<SettingsStore>().isDarkTheme;
ThemeBase get currentTheme => getIt.get<SettingsStore>().currentTheme;
void onOpenEndDrawer() => _scaffoldKey.currentState.openEndDrawer();
@@ -51,8 +52,8 @@ abstract class BasePage extends StatelessWidget {
final _backButton = Icon(Icons.arrow_back_ios,
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color,
size: 16,);
final _closeButton =
isDarkTheme ? _closeButtonImageDarkTheme : _closeButtonImage;
final _closeButton = currentTheme.type == ThemeType.dark
? closeButtonImageDarkTheme : closeButtonImage;
return SizedBox(
height: 37,
@@ -88,8 +89,8 @@ abstract class BasePage extends StatelessWidget {
Widget floatingActionButton(BuildContext context) => null;
ObstructingPreferredSizeWidget appBar(BuildContext context) {
final appBarColor =
isDarkTheme ? backgroundDarkColor : backgroundLightColor;
final appBarColor = currentTheme.type == ThemeType.dark
? backgroundDarkColor : backgroundLightColor;
switch (appBarStyle) {
case AppBarStyle.regular:
@@ -131,10 +132,12 @@ abstract class BasePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final _backgroundColor = currentTheme.type == ThemeType.dark
? backgroundDarkColor : backgroundLightColor;
final root = Scaffold(
key: _scaffoldKey,
backgroundColor:
isDarkTheme ? backgroundDarkColor : backgroundLightColor,
backgroundColor: _backgroundColor,
resizeToAvoidBottomPadding: resizeToAvoidBottomPadding,
extendBodyBehindAppBar: extendBodyBehindAppBar,
endDrawer: endDrawer,
+16 -9
View File
@@ -1,5 +1,6 @@
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
@@ -20,7 +21,8 @@ class DashboardPage extends BasePage {
});
@override
Color get backgroundLightColor => Colors.transparent;
Color get backgroundLightColor => currentTheme.type == ThemeType.bright
? Colors.transparent : Colors.white;
@override
Color get backgroundDarkColor => Colors.transparent;
@@ -50,7 +52,8 @@ class DashboardPage extends BasePage {
@override
Widget trailing(BuildContext context) {
final menuButton =
Image.asset('assets/images/menu.png', color: Colors.white);
Image.asset('assets/images/menu.png',
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
return Container(
alignment: Alignment.centerRight,
@@ -65,12 +68,6 @@ class DashboardPage extends BasePage {
final DashboardViewModel walletViewModel;
final WalletAddressListViewModel addressListViewModel;
final sendImage = Image.asset('assets/images/upload.png',
height: 22.24, width: 24, color: Colors.white);
final exchangeImage = Image.asset('assets/images/transfer.png',
height: 24.27, width: 22.25, color: Colors.white);
final receiveImage = Image.asset('assets/images/download.png',
height: 22.24, width: 24, color: Colors.white);
final controller = PageController(initialPage: 1);
var pages = <Widget>[];
@@ -78,6 +75,15 @@ class DashboardPage extends BasePage {
@override
Widget body(BuildContext context) {
final sendImage = Image.asset('assets/images/upload.png',
height: 22.24, width: 24,
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
final exchangeImage = Image.asset('assets/images/transfer.png',
height: 24.27, width: 22.25,
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
final receiveImage = Image.asset('assets/images/download.png',
height: 22.24, width: 24,
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
_setEffects();
return SafeArea(
@@ -100,7 +106,8 @@ class DashboardPage extends BasePage {
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context).indicatorColor,
activeDotColor: Colors.white),
activeDotColor: Theme.of(context).accentTextTheme.display1
.backgroundColor),
)),
Container(
padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
+42 -33
View File
@@ -9,44 +9,53 @@ import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
// FIXME: terrible design
class WalletMenu {
WalletMenu(this.context, this.reconnect);
final List<WalletMenuItem> items = [
WalletMenuItem(
title: S.current.reconnect,
image: Image.asset('assets/images/reconnect_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.rescan,
image: Image.asset('assets/images/filter_icon.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.wallets,
image: Image.asset('assets/images/wallet_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.nodes,
image:
Image.asset('assets/images/nodes_menu.png', height: 16, width: 16)),
WalletMenuItem(
title: S.current.show_keys,
image:
Image.asset('assets/images/key_menu.png', height: 16, width: 16)),
WalletMenuItem(
title: S.current.address_book_menu,
image: Image.asset('assets/images/open_book_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.settings_title,
image: Image.asset('assets/images/settings_menu.png',
height: 16, width: 16)),
];
WalletMenu(this.context, this.reconnect, this.hasRescan) : items = [] {
items.addAll([
WalletMenuItem(
title: S.current.reconnect,
image: Image.asset('assets/images/reconnect_menu.png',
height: 16, width: 16)),
if (hasRescan)
WalletMenuItem(
title: S.current.rescan,
image: Image.asset('assets/images/filter_icon.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.wallets,
image: Image.asset('assets/images/wallet_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.nodes,
image: Image.asset('assets/images/nodes_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.show_keys,
image:
Image.asset('assets/images/key_menu.png', height: 16, width: 16)),
WalletMenuItem(
title: S.current.address_book_menu,
image: Image.asset('assets/images/open_book_menu.png',
height: 16, width: 16)),
WalletMenuItem(
title: S.current.settings_title,
image: Image.asset('assets/images/settings_menu.png',
height: 16, width: 16)),
]);
}
final List<WalletMenuItem> items;
final BuildContext context;
final Future<void> Function() reconnect;
final bool hasRescan;
void action(int index) {
switch (index) {
var indx = index;
if (index > 0 && !hasRescan) {
indx += 1;
}
switch (indx) {
case 0:
_presentReconnectAlert(context);
break;
@@ -39,7 +39,10 @@ class ActionButton extends StatelessWidget {
SizedBox(height: 15),
Text(
title,
style: TextStyle(fontSize: 14, color: Colors.white),
style: TextStyle(
fontSize: 14,
color: Theme.of(context).accentTextTheme.display3
.backgroundColor),
)
],
),
@@ -3,6 +3,7 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_v
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
class AddressPage extends StatelessWidget {
AddressPage({@required this.addressListViewModel});
@@ -16,10 +17,9 @@ class AddressPage extends StatelessWidget {
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: QRWidget(addressListViewModel: addressListViewModel),
)
),
child: Center(
child: QRWidget(addressListViewModel: addressListViewModel),
)),
GestureDetector(
onTap: () => Navigator.of(context).pushNamed(Routes.receive),
child: Container(
@@ -27,29 +27,35 @@ class AddressPage extends StatelessWidget {
padding: EdgeInsets.only(left: 24, right: 12),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(25)),
border: Border.all(
color: Theme.of(context).textTheme.subhead.color,
width: 1
),
color: Theme.of(context).buttonColor
),
borderRadius: BorderRadius.all(Radius.circular(25)),
border: Border.all(
color: Theme.of(context).textTheme.subhead.color,
width: 1),
color: Theme.of(context).buttonColor),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
S.of(context).addresses,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.white
),
),
Observer(
builder: (_) => Text(
addressListViewModel.hasAccounts
? S.of(context).accounts_subaddresses
: S.of(context).addresses,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.accentTextTheme
.display3
.backgroundColor),
)),
Icon(
Icons.arrow_forward_ios,
size: 14,
color: Colors.white,
color: Theme.of(context)
.accentTextTheme
.display3
.backgroundColor,
)
],
),
@@ -59,4 +65,4 @@ class AddressPage extends StatelessWidget {
),
);
}
}
}
@@ -10,59 +10,77 @@ class BalancePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(24),
child: GestureDetector(
onTapUp: (_) => dashboardViewModel.balanceViewModel.isReversing = false,
onTapDown: (_) => dashboardViewModel.balanceViewModel.isReversing = true,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Observer(builder: (_) {
return Text(
dashboardViewModel.balanceViewModel.currency.toString(),
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Theme.of(context).indicatorColor,
height: 1),
);
}),
Observer(builder: (_) {
return Text(
dashboardViewModel.balanceViewModel.displayMode.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context).indicatorColor,
height: 1),
);
}),
SizedBox(height: 10),
Observer(builder: (_) {
return AutoSizeText(dashboardViewModel.balanceViewModel.cryptoBalance,
return GestureDetector(
onTapUp: (_) {
if (dashboardViewModel.balanceViewModel.canReverse) {
dashboardViewModel.balanceViewModel.isReversing = false;
}
},
onTapDown: (_) {
if (dashboardViewModel.balanceViewModel.canReverse) {
dashboardViewModel.balanceViewModel.isReversing = true;
}
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.all(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Observer(builder: (_) {
return Text(
dashboardViewModel.balanceViewModel.currency.toString(),
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.bold,
color: Theme.of(context)
.accentTextTheme
.display2
.backgroundColor,
height: 1),
);
}),
Observer(builder: (_) {
return Text(
dashboardViewModel.balanceViewModel.displayMode.toString(),
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.accentTextTheme
.display2
.backgroundColor,
height: 1),
);
}),
SizedBox(height: 10),
Observer(builder: (_) {
return AutoSizeText(
dashboardViewModel.balanceViewModel.cryptoBalance,
style: TextStyle(
fontSize: 54,
fontWeight: FontWeight.bold,
color: Colors.white,
color: Theme.of(context)
.accentTextTheme
.display3
.backgroundColor,
height: 1),
maxLines: 1,
textAlign: TextAlign.center);
}),
SizedBox(height: 10),
Observer(builder: (_) {
return Text(dashboardViewModel.balanceViewModel.fiatBalance,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).indicatorColor,
height: 1),
textAlign: TextAlign.center);
}),
],
),
)
);
maxLines: 1,
textAlign: TextAlign.center);
}),
SizedBox(height: 10),
Observer(builder: (_) {
return Text(dashboardViewModel.balanceViewModel.fiatBalance,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).indicatorColor,
height: 1),
textAlign: TextAlign.center);
}),
],
),
));
}
}
@@ -27,14 +27,15 @@ class HeaderRow extends StatelessWidget {
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
color: Colors.white
color: Theme.of(context).accentTextTheme.display3.backgroundColor
),
),
GestureDetector(
onTap: () {
showPopUp<void>(
context: context,
builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel)
builder: (context) =>
FilterWidget(dashboardViewModel: dashboardViewModel)
);
},
child: Container(
@@ -5,6 +5,7 @@ import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/src/screens/dashboard/wallet_menu.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
// FIXME: terrible design.
@@ -65,8 +66,10 @@ class MenuWidgetState extends State<MenuWidget> {
@override
Widget build(BuildContext context) {
final walletMenu =
WalletMenu(context, () async => widget.dashboardViewModel.reconnect());
final walletMenu = WalletMenu(
context,
() async => widget.dashboardViewModel.reconnect(),
widget.dashboardViewModel.hasRescan);
final itemCount = walletMenu.items.length;
moneroIcon = Image.asset('assets/images/monero_menu.png',
@@ -147,16 +150,19 @@ class MenuWidgetState extends State<MenuWidget> {
),
if (widget.dashboardViewModel.subname !=
null)
Text(
widget.dashboardViewModel.subname,
style: TextStyle(
color: Theme.of(context)
.accentTextTheme
.overline
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 12),
)
Observer(
builder: (_) => Text(
widget.dashboardViewModel
.subname,
style: TextStyle(
color: Theme.of(context)
.accentTextTheme
.overline
.decorationColor,
fontWeight:
FontWeight.w500,
fontSize: 12),
))
],
),
))
@@ -25,54 +25,53 @@ class TradeRow extends StatelessWidget {
return InkWell(
onTap: onTap,
child: Container(
height: 52,
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
color: Colors.transparent,
padding: EdgeInsets.only(left: 24, right: 24),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
_getPoweredImage(provider),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 12),
child: Container(
height: 46,
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_getPoweredImage(provider),
SizedBox(width: 12),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('${from.toString()} → ${to.toString()}',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white
)),
formattedAmount != null
? Text(formattedAmount + ' ' + amountCrypto,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white
))
: Container()
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(createdAtFormattedDate,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme
.overline.backgroundColor))
]),
],
),
),
))
]),
Text('${from.toString()} → ${to.toString()}',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.
display3.backgroundColor
)),
formattedAmount != null
? Text(formattedAmount + ' ' + amountCrypto,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.
display3.backgroundColor
))
: Container()
]),
SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(createdAtFormattedDate,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).textTheme
.overline.backgroundColor))
])
],
)
)
],
),
));
}
@@ -23,73 +23,73 @@ class TransactionRow extends StatelessWidget {
return InkWell(
onTap: onTap,
child: Container(
height: 62,
padding: EdgeInsets.fromLTRB(24, 8, 24, 8),
color: Colors.transparent,
padding: EdgeInsets.only(left: 24, right: 24),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).textTheme.overline.decorationColor
),
child: Image.asset(
direction == TransactionDirection.incoming
? 'assets/images/down_arrow.png'
: 'assets/images/up_arrow.png'),
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 36,
width: 36,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).textTheme.overline.decorationColor
),
Expanded(
child: Container(
padding: const EdgeInsets.only(left: 12),
height: 56,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
(direction == TransactionDirection.incoming
? S.of(context).received
: S.of(context).sent) +
(isPending ? S.of(context).pending : ''),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white)),
Text(formattedAmount,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white))
]),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(formattedDate,
style: TextStyle(
fontSize: 14,
color: Theme.of(context)
.textTheme
.overline
.backgroundColor)),
Text(formattedFiatAmount,
style: TextStyle(
fontSize: 14,
color: Theme.of(context)
.textTheme
.overline
.backgroundColor))
]),
],
),
),
)
]),
child: Image.asset(
direction == TransactionDirection.incoming
? 'assets/images/down_arrow.png'
: 'assets/images/up_arrow.png'),
),
SizedBox(width: 12),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
(direction == TransactionDirection.incoming
? S.of(context).received
: S.of(context).sent) +
(isPending ? S.of(context).pending : ''),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.
display3.backgroundColor)),
Text(formattedAmount,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.
display3.backgroundColor))
]),
SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(formattedDate,
style: TextStyle(
fontSize: 14,
color: Theme.of(context)
.textTheme
.overline
.backgroundColor)),
Text(formattedFiatAmount,
style: TextStyle(
fontSize: 14,
color: Theme.of(context)
.textTheme
.overline
.backgroundColor))
])
],
)
)
],
),
));
}
}
@@ -46,7 +46,8 @@ class TransactionsPage extends StatelessWidget {
if (item is TransactionListItem) {
final transaction = item.transaction;
return TransactionRow(
return Observer(
builder: (_) => TransactionRow(
onTap: () => Navigator.of(context).pushNamed(
Routes.transactionDetails,
arguments: transaction),
@@ -55,7 +56,7 @@ class TransactionsPage extends StatelessWidget {
.format(transaction.date),
formattedAmount: item.formattedCryptoAmount,
formattedFiatAmount: item.formattedFiatAmount,
isPending: transaction.isPending);
isPending: transaction.isPending));
}
if (item is TradeListItem) {
+4 -4
View File
@@ -95,9 +95,8 @@ class ExchangePage extends BasePage {
return KeyboardActions(
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: isDarkTheme
? Color.fromRGBO(48, 51, 60, 1.0)
: Color.fromRGBO(98, 98, 98, 1.0),
keyboardBarColor: Theme.of(context).accentTextTheme.body2
.backgroundColor,
nextFocus: false,
actions: [
KeyboardActionsItem(
@@ -547,7 +546,7 @@ class ExchangePage extends BasePage {
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: S.of(context).error,
alertTitle: S.of(context).provider_error(state.title),
alertContent: state.error,
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop());
@@ -555,6 +554,7 @@ class ExchangePage extends BasePage {
});
}
if (state is TradeIsCreatedSuccessfully) {
exchangeViewModel.reset();
Navigator.of(context).pushNamed(Routes.exchangeConfirm);
}
});
@@ -166,8 +166,8 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 16,
fontWeight: FontWeight.w600,
color: Theme.of(context)
.textTheme
.subhead
.accentTextTheme
.display4
.decorationColor),
validator: _isAmountEditable
? widget.currencyValueValidator
@@ -211,8 +211,8 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 10,
height: 1.2,
color: Theme.of(context)
.textTheme
.subhead
.accentTextTheme
.display4
.decorationColor),
)
: Offstage(),
@@ -224,8 +224,8 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 10,
height: 1.2,
color: Theme.of(context)
.textTheme
.subhead
.accentTextTheme
.display4
.decorationColor))
: Offstage(),
]),
@@ -239,7 +239,10 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 14,
fontWeight: FontWeight.w500,
color:
Theme.of(context).textTheme.subhead.decorationColor),
Theme.of(context)
.accentTextTheme
.display4
.decorationColor),
))
: Offstage(),
_isAddressEditable
@@ -263,7 +266,10 @@ class ExchangeCardState extends State<ExchangeCard> {
fontSize: 16,
fontWeight: FontWeight.w600,
color:
Theme.of(context).textTheme.subhead.decorationColor),
Theme.of(context)
.accentTextTheme
.display4
.decorationColor),
buttonColor: widget.addressButtonsColor,
validator: widget.addressTextFieldValidator,
),
@@ -227,16 +227,15 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
final sendingState =
widget.exchangeTradeViewModel.sendViewModel.state;
return trade.from == CryptoCurrency.xmr && !(sendingState is TransactionCommitted)
return widget.exchangeTradeViewModel.isSendable &&
!(sendingState is TransactionCommitted)
? LoadingPrimaryButton(
isDisabled: trade.inputAddress == null ||
trade.inputAddress.isEmpty,
isLoading: sendingState is IsExecutingState,
onPressed: () =>
widget.exchangeTradeViewModel.confirmSending(),
text: trade.provider == ExchangeProviderDescription.xmrto
? S.of(context).confirm
: S.of(context).send_xmr,
text: S.of(context).confirm,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white)
: Offstage();
@@ -306,7 +305,11 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
padding: EdgeInsets.only(
top: 220, left: 24, right: 24),
child: Text(
S.of(context).send_success,
S.of(context).send_success(widget
.exchangeTradeViewModel
.wallet
.currency
.toString()),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
@@ -103,7 +103,12 @@ class MoneroAccountListPage extends StatelessWidget {
accountListViewModel
.select(account);
Navigator.of(context).pop();
});
},
onEdit: () async =>
await Navigator.of(context)
.pushNamed(
Routes.accountCreation,
arguments: account));
},
),
isAlwaysShowScrollThumb
@@ -1,15 +1,19 @@
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:cake_wallet/generated/i18n.dart';
class AccountTile extends StatelessWidget {
AccountTile({
@required this.isCurrent,
@required this.accountName,
@required this.onTap
@required this.onTap,
@required this.onEdit
});
final bool isCurrent;
final String accountName;
final VoidCallback onTap;
final Function() onTap;
final Function() onEdit;
@override
Widget build(BuildContext context) {
@@ -20,7 +24,7 @@ class AccountTile extends StatelessWidget {
? Theme.of(context).textTheme.subtitle.color
: Theme.of(context).textTheme.display4.color;
return GestureDetector(
final Widget cell = GestureDetector(
onTap: onTap,
child: Container(
height: 77,
@@ -39,5 +43,17 @@ class AccountTile extends StatelessWidget {
),
),
);
return isCurrent ? cell : Slidable(
key: Key(accountName),
child: cell,
actionPane: SlidableDrawerActionPane(),
secondaryActions: <Widget>[
IconSlideAction(
caption: S.of(context).edit,
color: Colors.blue,
icon: Icons.edit,
onTap: () => onEdit?.call())
]);
}
}
+11 -12
View File
@@ -1,6 +1,5 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:mobx/mobx.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@@ -22,17 +21,24 @@ class NewWalletPage extends BasePage {
final WalletNewVM _walletNewVM;
final walletNameImage = Image.asset('assets/images/wallet_name.png');
final walletNameLightImage =
Image.asset('assets/images/wallet_name_light.png');
@override
String get title => S.current.new_wallet;
@override
Widget body(BuildContext context) => WalletNameForm(_walletNewVM);
Widget body(BuildContext context) => WalletNameForm(_walletNewVM,
currentTheme.type == ThemeType.dark
? walletNameImage : walletNameLightImage);
}
class WalletNameForm extends StatefulWidget {
WalletNameForm(this._walletNewVM);
WalletNameForm(this._walletNewVM, this.walletImage);
final WalletNewVM _walletNewVM;
final Image walletImage;
@override
_WalletNameFormState createState() => _WalletNameFormState(_walletNewVM);
@@ -43,9 +49,6 @@ class _WalletNameFormState extends State<WalletNameForm> {
static const aspectRatioImage = 1.22;
final walletNameImage = Image.asset('assets/images/wallet_name.png');
final walletNameLightImage =
Image.asset('assets/images/wallet_name_light.png');
final _formKey = GlobalKey<FormState>();
final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>();
ReactionDisposer _stateReaction;
@@ -78,10 +81,6 @@ class _WalletNameFormState extends State<WalletNameForm> {
@override
Widget build(BuildContext context) {
final walletImage = getIt.get<SettingsStore>().isDarkTheme
? walletNameImage
: walletNameLightImage;
return Container(
padding: EdgeInsets.only(top: 24),
child: ScrollableWithBottomSection(
@@ -92,7 +91,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(child: walletImage, fit: BoxFit.fill)),
child: FittedBox(child: widget.walletImage, fit: BoxFit.fill)),
),
Padding(
padding: EdgeInsets.only(top: 24),
@@ -1,6 +1,13 @@
import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
import 'package:flushbar/flushbar.dart';
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart';
@@ -10,25 +17,36 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
class NewWalletTypePage extends BasePage {
NewWalletTypePage({this.onTypeSelected, this.isNewWallet = true});
NewWalletTypePage(this.walletNewVM, {this.onTypeSelected, this.isNewWallet});
final void Function(BuildContext, WalletType) onTypeSelected;
final bool isNewWallet;
final WalletNewVM walletNewVM;
final walletTypeImage = Image.asset('assets/images/wallet_type.png');
final walletTypeLightImage =
Image.asset('assets/images/wallet_type_light.png');
@override
String get title => isNewWallet
? S.current.new_wallet
: S.current.wallet_list_restore_wallet;
String get title =>
isNewWallet ? S.current.new_wallet : S.current.wallet_list_restore_wallet;
@override
Widget body(BuildContext context) =>
WalletTypeForm(onTypeSelected: onTypeSelected);
Widget body(BuildContext context) => WalletTypeForm(walletNewVM, isNewWallet,
onTypeSelected: onTypeSelected,
walletImage: currentTheme.type == ThemeType.dark
? walletTypeImage
: walletTypeLightImage);
}
class WalletTypeForm extends StatefulWidget {
WalletTypeForm({this.onTypeSelected});
WalletTypeForm(this.walletNewVM, this.isNewWallet,
{this.onTypeSelected, this.walletImage});
final void Function(BuildContext, WalletType) onTypeSelected;
final WalletNewVM walletNewVM;
final bool isNewWallet;
final Image walletImage;
@override
WalletTypeFormState createState() => WalletTypeFormState();
@@ -42,10 +60,12 @@ class WalletTypeFormState extends State<WalletTypeForm> {
final bitcoinIcon =
Image.asset('assets/images/bitcoin.png', height: 24, width: 24);
final walletTypeImage = Image.asset('assets/images/wallet_type.png');
final walletTypeLightImage = Image.asset('assets/images/wallet_type_light.png');
final walletTypeLightImage =
Image.asset('assets/images/wallet_type_light.png');
WalletType selected;
List<WalletType> types;
Flushbar<void> _progressBar;
@override
void initState() {
@@ -55,11 +75,8 @@ class WalletTypeFormState extends State<WalletTypeForm> {
@override
Widget build(BuildContext context) {
final walletImage = getIt.get<SettingsStore>().isDarkTheme
? walletTypeImage : walletTypeLightImage;
return Container(
padding: EdgeInsets.only(top: 24),
padding: EdgeInsets.only(top: 24, bottom: 24),
child: ScrollableWithBottomSection(
contentPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
content: Column(
@@ -69,7 +86,8 @@ class WalletTypeFormState extends State<WalletTypeForm> {
padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(child: walletImage, fit: BoxFit.fill)),
child:
FittedBox(child: widget.walletImage, fit: BoxFit.fill)),
),
Padding(
padding: EdgeInsets.only(top: 48),
@@ -86,7 +104,7 @@ class WalletTypeFormState extends State<WalletTypeForm> {
padding: EdgeInsets.only(top: 24),
child: SelectButton(
image: _iconFor(type),
text: walletTypeToString(type),
text: walletTypeToDisplayName(type),
isSelected: selected == type,
onTap: () => setState(() => selected = type)),
))
@@ -94,9 +112,9 @@ class WalletTypeFormState extends State<WalletTypeForm> {
),
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
bottomSection: PrimaryButton(
onPressed: () => widget.onTypeSelected(context, selected),
onPressed: () => onTypeSelected(),
text: S.of(context).seed_language_next,
color: Colors.green,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
isDisabled: selected == null,
),
@@ -114,4 +132,35 @@ class WalletTypeFormState extends State<WalletTypeForm> {
return null;
}
}
Future<void> onTypeSelected() async {
if (!widget.isNewWallet) {
widget.onTypeSelected(context, selected);
return;
}
try {
_changeProcessText(S.of(context).creating_new_wallet);
widget.walletNewVM.type = selected;
await widget.walletNewVM
.create(options: 'English'); // FIXME: Unnamed constant
await _progressBar?.dismiss();
final state = widget.walletNewVM.state;
if (state is ExecutedSuccessfullyState) {
widget.onTypeSelected(context, selected);
}
if (state is FailureState) {
_changeProcessText(
S.of(context).creating_new_wallet_error(state.error));
}
} catch (e) {
_changeProcessText(S.of(context).creating_new_wallet_error(e.toString()));
}
}
void _changeProcessText(String text) {
_progressBar = createBar<void>(text, duration: null)..show(context);
}
}
@@ -16,7 +16,7 @@ class SelectButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final color = isSelected
? Theme.of(context).accentTextTheme.subtitle.decorationColor
? Colors.green
: Theme.of(context).accentTextTheme.caption.color;
final textColor = isSelected
? Theme.of(context).accentTextTheme.headline.decorationColor
@@ -1,3 +1,7 @@
import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
@@ -67,6 +71,39 @@ class NodeCreateOrEditPage extends BasePage {
@override
Widget body(BuildContext context) {
reaction((_) => nodeCreateOrEditViewModel.connectionState,
(ExecutionState state) {
if (state is ExecutedSuccessfullyState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showPopUp<void>(
context: context,
builder: (BuildContext context) =>
AlertWithOneAction(
alertTitle: S.of(context).new_node_testing,
alertContent: state.payload as bool
? S.of(context).node_connection_successful
: S.of(context).node_connection_failed,
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop()));
});
}
if (state is FailureState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertWithOneAction(
alertTitle: S.of(context).error,
alertContent: state.error,
buttonText: S.of(context).ok,
buttonAction: () => Navigator.of(context).pop());
});
});
}
});
return Container(
padding: EdgeInsets.only(left: 24, right: 24),
child: ScrollableWithBottomSection(
@@ -122,7 +159,22 @@ class NodeCreateOrEditPage extends BasePage {
)
)
],
)
),
Padding(
padding: EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Observer(
builder: (_) => StandardCheckbox(
value: nodeCreateOrEditViewModel.useSSL,
onChanged: (value) =>
nodeCreateOrEditViewModel.useSSL = value,
caption: S.of(context).use_ssl,
))
],
))
]
],
)),
@@ -133,9 +185,18 @@ class NodeCreateOrEditPage extends BasePage {
Flexible(
child: Container(
padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton(
onPressed: () => nodeCreateOrEditViewModel.reset(),
text: S.of(context).reset,
child: LoadingPrimaryButton(
onPressed: () async {
if (!_formKey.currentState.validate()) {
return;
}
await nodeCreateOrEditViewModel.connect();
},
isLoading: nodeCreateOrEditViewModel
.connectionState is IsExecutingState,
text: S.of(context).node_test,
isDisabled: !nodeCreateOrEditViewModel.isReady,
color: Colors.orange,
textColor: Colors.white),
)),
@@ -154,7 +215,9 @@ class NodeCreateOrEditPage extends BasePage {
text: S.of(context).save,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
isDisabled: !nodeCreateOrEditViewModel.isReady,
isDisabled: (!nodeCreateOrEditViewModel.isReady)||
(nodeCreateOrEditViewModel
.connectionState is IsExecutingState),
),
)),
],
+80 -88
View File
@@ -65,98 +65,90 @@ class NodeListPage extends BasePage {
padding: EdgeInsets.only(top: 10),
child: Observer(
builder: (BuildContext context) {
return nodeListViewModel.nodes.isNotEmpty
? SectionStandardList(
sectionCount: 2,
context: context,
itemCounter: (int sectionIndex) {
if (sectionIndex == 0) {
return 1;
}
return SectionStandardList(
sectionCount: 2,
context: context,
itemCounter: (int sectionIndex) {
if (sectionIndex == 0) {
return 1;
}
return nodeListViewModel.nodes.length;
},
itemBuilder: (_, sectionIndex, index) {
if (sectionIndex == 0) {
return NodeHeaderListRow(
title: S.of(context).add_new_node,
onTap: (_) async => await Navigator.of(context)
.pushNamed(Routes.newNode));
}
return nodeListViewModel.nodes.length;
},
itemBuilder: (_, sectionIndex, index) {
if (sectionIndex == 0) {
return NodeHeaderListRow(
title: S.of(context).add_new_node,
onTap: (_) async => await Navigator.of(context)
.pushNamed(Routes.newNode));
}
final node = nodeListViewModel.nodes[index];
final isSelected = node.keyIndex ==
nodeListViewModel.settingsStore.currentNode.keyIndex;
final nodeListRow = NodeListRow(
title: node.uri,
isSelected: isSelected,
isAlive: node.requestNode(),
onTap: (_) async {
if (isSelected) {
return;
final node = nodeListViewModel.nodes[index];
final isSelected =
node.keyIndex == nodeListViewModel.currentNode?.keyIndex;
final nodeListRow = NodeListRow(
title: node.uri,
isSelected: isSelected,
isAlive: node.requestNode(),
onTap: (_) async {
if (isSelected) {
return;
}
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
alertTitle:
S.of(context).change_current_node_title,
alertContent:
S.of(context).change_current_node(node.uri),
leftButtonText: S.of(context).cancel,
rightButtonText: S.of(context).change,
actionLeftButton: () =>
Navigator.of(context).pop(),
actionRightButton: () async {
await nodeListViewModel.setAsCurrent(node);
Navigator.of(context).pop();
});
});
});
final dismissibleRow = Slidable(
key: Key('${node.keyIndex}'),
actionPane: SlidableDrawerActionPane(),
child: nodeListRow,
secondaryActions: <Widget>[
IconSlideAction(
caption: S.of(context).delete,
color: Colors.red,
icon: CupertinoIcons.delete,
onTap: () async {
final confirmed = await showPopUp<bool>(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
alertTitle: S.of(context).remove_node,
alertContent:
S.of(context).remove_node_message,
rightButtonText: S.of(context).remove,
leftButtonText: S.of(context).cancel,
actionRightButton: () =>
Navigator.pop(context, true),
actionLeftButton: () =>
Navigator.pop(context, false));
}) ??
false;
if (confirmed) {
await nodeListViewModel.delete(node);
}
},
),
]);
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
// FIXME: Add translation.
return AlertWithTwoActions(
alertTitle: 'Change current node',
alertContent: S
.of(context)
.change_current_node(node.uri),
leftButtonText: S.of(context).cancel,
rightButtonText: S.of(context).change,
actionLeftButton: () =>
Navigator.of(context).pop(),
actionRightButton: () async {
await nodeListViewModel
.setAsCurrent(node);
Navigator.of(context).pop();
});
});
});
final dismissibleRow = Slidable(
key: Key('${node.keyIndex}'),
actionPane: SlidableDrawerActionPane(),
child: nodeListRow,
secondaryActions: <Widget>[
IconSlideAction(
caption: S.of(context).delete,
color: Colors.red,
icon: CupertinoIcons.delete,
onTap: () async {
final confirmed = await showPopUp<bool>(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
alertTitle:
S.of(context).remove_node,
alertContent: S
.of(context)
.remove_node_message,
rightButtonText:
S.of(context).remove,
leftButtonText:
S.of(context).cancel,
actionRightButton: () =>
Navigator.pop(context, true),
actionLeftButton: () =>
Navigator.pop(context, false));
}) ??
false;
if (confirmed) {
await nodeListViewModel.delete(node);
}
},
),
]);
return isSelected ? nodeListRow : dismissibleRow;
})
: Container();
return isSelected ? nodeListRow : dismissibleRow;
});
},
),
);
+54 -23
View File
@@ -1,4 +1,5 @@
import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@@ -27,16 +28,47 @@ class ReceivePage extends BasePage {
String get title => S.current.receive;
@override
Color get backgroundLightColor => Colors.transparent;
Color get backgroundLightColor => currentTheme.type == ThemeType.bright
? Colors.transparent : Colors.white;
@override
Color get backgroundDarkColor => Colors.transparent;
@override
Color get titleColor => Colors.white;
final FocusNode _cryptoAmountFocus;
@override
Widget leading(BuildContext context) {
final _backButton = Icon(Icons.arrow_back_ios,
color: Theme.of(context).accentTextTheme.display3.backgroundColor,
size: 16,);
return SizedBox(
height: 37,
width: 37,
child: ButtonTheme(
minWidth: double.minPositive,
child: FlatButton(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () => onClose(context),
child: _backButton),
),
);
}
@override
Widget middle(BuildContext context) {
return Text(
title,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
fontFamily: 'Lato',
color: Theme.of(context).accentTextTheme.display3.backgroundColor),
);
}
@override
Widget Function(BuildContext, Widget) get rootWrapper =>
(BuildContext context, Widget scaffold) => Container(
@@ -51,7 +83,8 @@ class ReceivePage extends BasePage {
@override
Widget trailing(BuildContext context) {
final shareImage =
Image.asset('assets/images/share.png', color: Colors.white);
Image.asset('assets/images/share.png',
color: Theme.of(context).accentTextTheme.display3.backgroundColor);
return SizedBox(
height: 20.0,
@@ -74,9 +107,8 @@ class ReceivePage extends BasePage {
return KeyboardActions(
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: isDarkTheme
? Color.fromRGBO(48, 51, 60, 1.0)
: Color.fromRGBO(98, 98, 98, 1.0),
keyboardBarColor: Theme.of(context).accentTextTheme.body2
.backgroundColor,
nextFocus: false,
actions: [
KeyboardActionsItem(
@@ -117,7 +149,7 @@ class ReceivePage extends BasePage {
Icons.arrow_forward_ios,
size: 14,
color:
Theme.of(context).textTheme.display1.color,
Theme.of(context).textTheme.display1.color,
));
}
@@ -130,7 +162,7 @@ class ReceivePage extends BasePage {
Icons.add,
size: 20,
color:
Theme.of(context).textTheme.display1.color,
Theme.of(context).textTheme.display1.color,
));
}
@@ -140,13 +172,13 @@ class ReceivePage extends BasePage {
addressListViewModel.address.address;
final backgroundColor = isCurrent
? Theme.of(context)
.textTheme
.display3
.decorationColor
.textTheme
.display3
.decorationColor
: Theme.of(context)
.textTheme
.display2
.decorationColor;
.textTheme
.display2
.decorationColor;
final textColor = isCurrent
? Theme.of(context).textTheme.display3.color
: Theme.of(context).textTheme.display2.color;
@@ -155,8 +187,7 @@ class ReceivePage extends BasePage {
isCurrent: isCurrent,
backgroundColor: backgroundColor,
textColor: textColor,
onTap: (_) =>
addressListViewModel.setAddress(item),
onTap: (_) => addressListViewModel.setAddress(item),
onEdit: () => Navigator.of(context).pushNamed(
Routes.newSubaddress,
arguments: item));
@@ -166,11 +197,11 @@ class ReceivePage extends BasePage {
return index != 0
? cell
: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
child: cell,
);
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
child: cell,
);
})),
],
),
@@ -14,6 +14,7 @@ class AddressCell extends StatelessWidget {
address: item.address,
name: item.name,
isCurrent: isCurrent,
isPrimary: item.isPrimary,
backgroundColor: backgroundColor,
textColor: textColor,
onTap: onTap,
@@ -23,6 +24,7 @@ class AddressCell extends StatelessWidget {
{@required this.address,
@required this.name,
@required this.isCurrent,
@required this.isPrimary,
@required this.backgroundColor,
@required this.textColor,
this.onTap,
@@ -31,6 +33,7 @@ class AddressCell extends StatelessWidget {
final String address;
final String name;
final bool isCurrent;
final bool isPrimary;
final Color backgroundColor;
final Color textColor;
final Function(String) onTap;
@@ -56,7 +59,7 @@ class AddressCell extends StatelessWidget {
),
));
return isCurrent
return (isCurrent || isPrimary)
? cell
: Slidable(
key: Key(address),
+8 -16
View File
@@ -47,24 +47,14 @@ class QRWidget extends StatelessWidget {
child: QrImage(
data: addressListViewModel.uri.toString(),
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
//Theme.of(context).textTheme.headline.color,
foregroundColor: Theme.of(context).accentTextTheme.
display3.backgroundColor,
))))),
Spacer(flex: 3)
]),
Padding(
padding: EdgeInsets.only(top: 20),
child: Text(
S.of(context).scan_qr_code,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
color: Theme.of(context).indicatorColor),
),
),
isAmountFieldShow
? Padding(
padding: EdgeInsets.only(top: 40),
padding: EdgeInsets.only(top: 60),
child: Row(
children: <Widget>[
Expanded(
@@ -77,11 +67,12 @@ class QRWidget extends StatelessWidget {
decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
RegExp('[\\-|\\ ]'))
],
textAlign: TextAlign.center,
hintText: S.of(context).receive_amount,
textColor: Colors.white,
textColor: Theme.of(context).accentTextTheme.
display3.backgroundColor,
borderColor: Theme.of(context)
.textTheme
.headline
@@ -120,7 +111,8 @@ class QRWidget extends StatelessWidget {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white),
color: Theme.of(context).accentTextTheme.
display3.backgroundColor),
),
),
Padding(
@@ -1,3 +1,5 @@
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/view_model/wallet_restore_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
@@ -7,12 +9,20 @@ import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/widgets/blockchain_height_widget.dart';
class WalletRestoreFromSeedForm extends StatefulWidget {
WalletRestoreFromSeedForm({Key key, this.blockHeightFocusNode,
this.onHeightOrDateEntered})
WalletRestoreFromSeedForm(
{Key key,
@required this.displayLanguageSelector,
@required this.displayBlockHeightSelector,
@required this.type,
this.blockHeightFocusNode,
this.onHeightOrDateEntered})
: super(key: key);
final WalletType type;
final bool displayLanguageSelector;
final bool displayBlockHeightSelector;
final FocusNode blockHeightFocusNode;
final Function (bool) onHeightOrDateEntered;
final Function(bool) onHeightOrDateEntered;
@override
WalletRestoreFromSeedFormState createState() =>
@@ -41,32 +51,35 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
return Container(
padding: EdgeInsets.only(left: 25, right: 25),
child: Column(children: [
SeedWidget(key: seedWidgetStateKey, language: language),
GestureDetector(
onTap: () async {
final selected = await showPopUp<String>(
context: context,
builder: (BuildContext context) =>
SeedLanguagePicker(selected: language));
SeedWidget(
key: seedWidgetStateKey, language: language, type: widget.type),
if (widget.displayLanguageSelector)
GestureDetector(
onTap: () async {
final selected = await showPopUp<String>(
context: context,
builder: (BuildContext context) =>
SeedLanguagePicker(selected: language));
if (selected == null || selected.isEmpty) {
return;
}
if (selected == null || selected.isEmpty) {
return;
}
_changeLanguage(selected);
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.only(top: 20.0),
child: IgnorePointer(
child: BaseTextFormField(
controller: languageController,
enableInteractiveSelection: false,
readOnly: true)))),
BlockchainHeightWidget(
focusNode: widget.blockHeightFocusNode,
key: blockchainHeightKey,
onHeightOrDateEntered: widget.onHeightOrDateEntered)
_changeLanguage(selected);
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.only(top: 20.0),
child: IgnorePointer(
child: BaseTextFormField(
controller: languageController,
enableInteractiveSelection: false,
readOnly: true)))),
if (widget.displayBlockHeightSelector)
BlockchainHeightWidget(
focusNode: widget.blockHeightFocusNode,
key: blockchainHeightKey,
onHeightOrDateEntered: widget.onHeightOrDateEntered)
]));
}
@@ -25,16 +25,30 @@ class WalletRestorePage extends BasePage {
_pages = [],
_blockHeightFocusNode = FocusNode(),
_controller = PageController(initialPage: 0) {
_pages.addAll([
WalletRestoreFromSeedForm(
key: walletRestoreFromSeedFormKey,
blockHeightFocusNode: _blockHeightFocusNode,
onHeightOrDateEntered: (value)
=> walletRestoreViewModel.isButtonEnabled = value),
WalletRestoreFromKeysFrom(key: walletRestoreFromKeysFormKey,
onHeightOrDateEntered: (value)
=> walletRestoreViewModel.isButtonEnabled = value)
]);
walletRestoreViewModel.availableModes.forEach((mode) {
switch (mode) {
case WalletRestoreMode.seed:
_pages.add(WalletRestoreFromSeedForm(
displayBlockHeightSelector:
walletRestoreViewModel.hasBlockchainHeightLanguageSelector,
displayLanguageSelector:
walletRestoreViewModel.hasSeedLanguageSelector,
type: walletRestoreViewModel.type,
key: walletRestoreFromSeedFormKey,
blockHeightFocusNode: _blockHeightFocusNode,
onHeightOrDateEntered: (value) =>
walletRestoreViewModel.isButtonEnabled = value));
break;
case WalletRestoreMode.keys:
_pages.add(WalletRestoreFromKeysFrom(
key: walletRestoreFromKeysFormKey,
onHeightOrDateEntered: (value) =>
walletRestoreViewModel.isButtonEnabled = value));
break;
default:
break;
}
});
}
@override
@@ -76,20 +90,19 @@ class WalletRestorePage extends BasePage {
}
});
reaction((_) => walletRestoreViewModel.mode, (WalletRestoreMode mode)
{
walletRestoreViewModel.isButtonEnabled = false;
reaction((_) => walletRestoreViewModel.mode, (WalletRestoreMode mode) {
walletRestoreViewModel.isButtonEnabled = false;
walletRestoreFromSeedFormKey.currentState.blockchainHeightKey
.currentState.restoreHeightController.text = '';
walletRestoreFromSeedFormKey.currentState.blockchainHeightKey
.currentState.dateController.text = '';
walletRestoreFromSeedFormKey.currentState.blockchainHeightKey.currentState
.restoreHeightController.text = '';
walletRestoreFromSeedFormKey.currentState.blockchainHeightKey.currentState
.dateController.text = '';
walletRestoreFromKeysFormKey.currentState.blockchainHeightKey
.currentState.restoreHeightController.text = '';
walletRestoreFromKeysFormKey.currentState.blockchainHeightKey
.currentState.dateController.text = '';
});
walletRestoreFromKeysFormKey.currentState.blockchainHeightKey.currentState
.restoreHeightController.text = '';
walletRestoreFromKeysFormKey.currentState.blockchainHeightKey.currentState
.dateController.text = '';
});
return Column(mainAxisAlignment: MainAxisAlignment.center, children: [
Expanded(
@@ -100,40 +113,37 @@ class WalletRestorePage extends BasePage {
},
controller: _controller,
itemCount: _pages.length,
itemBuilder: (_, index) => SingleChildScrollView(child: _pages[index]))),
Padding(
padding: EdgeInsets.only(top: 10),
child: SmoothPageIndicator(
controller: _controller,
count: _pages.length,
effect: ColorTransitionEffect(
spacing: 6.0,
radius: 6.0,
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context).hintColor.withOpacity(0.5),
activeDotColor: Theme.of(context).hintColor),
)),
itemBuilder: (_, index) =>
SingleChildScrollView(child: _pages[index]))),
if (_pages.length > 1)
Padding(
padding: EdgeInsets.only(top: 10),
child: SmoothPageIndicator(
controller: _controller,
count: _pages.length,
effect: ColorTransitionEffect(
spacing: 6.0,
radius: 6.0,
dotWidth: 6.0,
dotHeight: 6.0,
dotColor: Theme.of(context).hintColor.withOpacity(0.5),
activeDotColor: Theme.of(context).hintColor),
)),
Padding(
padding: EdgeInsets.only(top: 20, bottom: 40, left: 25, right: 25),
child: Observer(
builder: (context) {
return LoadingPrimaryButton(
onPressed: () =>
walletRestoreViewModel.create(options: _credentials()),
text: S.of(context).restore_recover,
color: Theme
.of(context)
.accentTextTheme
.subtitle
.decorationColor,
textColor: Theme
.of(context)
.accentTextTheme
.headline
.decorationColor,
isLoading: walletRestoreViewModel.state is IsExecutingState,
isDisabled: !walletRestoreViewModel.isButtonEnabled,);
onPressed: () =>
walletRestoreViewModel.create(options: _credentials()),
text: S.of(context).restore_recover,
color:
Theme.of(context).accentTextTheme.subtitle.decorationColor,
textColor:
Theme.of(context).accentTextTheme.headline.decorationColor,
isLoading: walletRestoreViewModel.state is IsExecutingState,
isDisabled: !walletRestoreViewModel.isButtonEnabled,
);
},
))
]);
@@ -145,8 +155,11 @@ class WalletRestorePage extends BasePage {
if (walletRestoreViewModel.mode == WalletRestoreMode.seed) {
credentials['seed'] = walletRestoreFromSeedFormKey
.currentState.seedWidgetStateKey.currentState.text;
credentials['height'] = walletRestoreFromSeedFormKey
.currentState.blockchainHeightKey.currentState.height;
if (walletRestoreViewModel.hasBlockchainHeightLanguageSelector) {
credentials['height'] = walletRestoreFromSeedFormKey
.currentState.blockchainHeightKey.currentState.height;
}
} else {
credentials['address'] =
walletRestoreFromKeysFormKey.currentState.addressController.text;
+75
View File
@@ -0,0 +1,75 @@
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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';
class PreSeedPage extends BasePage {
PreSeedPage(this.type)
: imageLight = Image.asset('assets/images/pre_seed_light.png'),
imageDark = Image.asset('assets/images/pre_seed_dark.png'),
wordsCount = type == WalletType.monero
? 25
: 12; // FIXME: Stupid fast implementation
final Image imageDark;
final Image imageLight;
final WalletType type;
final int wordsCount;
@override
Widget leading(BuildContext context) => null;
@override
String get title => S.current.pre_seed_title;
@override
Widget body(BuildContext context) {
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
return WillPopScope(
onWillPop: () async => false,
child: Container(
padding: EdgeInsets.all(24),
child: Column(
children: [
Flexible(
flex: 2,
child: AspectRatio(
aspectRatio: 1,
child: FittedBox(child: image, fit: BoxFit.contain))),
Flexible(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: EdgeInsets.only(top: 70, left: 16, right: 16),
child: Text(
S.of(context).pre_seed_description(wordsCount),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.primaryTextTheme
.caption
.color),
),
),
PrimaryButton(
onPressed: () => Navigator.of(context)
.popAndPushNamed(Routes.seed, arguments: true),
text: S.of(context).pre_seed_button_text,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white)
],
))
],
),
));
}
}
+6 -8
View File
@@ -1,7 +1,6 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/cupertino.dart';
@@ -17,8 +16,8 @@ import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
class WalletSeedPage extends BasePage {
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');
final imageLight = Image.asset('assets/images/crypto_lock_light.png');
final imageDark = Image.asset('assets/images/crypto_lock.png');
@override
String get title => S.current.seed_title;
@@ -83,10 +82,9 @@ class WalletSeedPage extends BasePage {
@override
Widget body(BuildContext context) {
final image =
getIt.get<SettingsStore>().isDarkTheme ? imageDark : imageLight;
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
return Container(
return WillPopScope(onWillPop: () async => false, child: Container(
padding: EdgeInsets.all(24),
child: Column(
children: <Widget>[
@@ -194,6 +192,6 @@ class WalletSeedPage extends BasePage {
],
))
],
));
)));
}
}
@@ -1,6 +1,5 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/src/widgets/seed_language_selector.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
@@ -15,17 +14,26 @@ class SeedLanguage extends BasePage {
final Function(BuildContext, String) onConfirm;
final walletNameImage = Image.asset('assets/images/wallet_name.png');
final walletNameLightImage =
Image.asset('assets/images/wallet_name_light.png');
@override
String get title => S.current.wallet_list_restore_wallet;
@override
Widget body(BuildContext context) => SeedLanguageForm(onConfirm: onConfirm);
Widget body(BuildContext context) =>
SeedLanguageForm(
onConfirm: onConfirm,
walletImage: currentTheme.type == ThemeType.dark
? walletNameImage : walletNameLightImage);
}
class SeedLanguageForm extends StatefulWidget {
SeedLanguageForm({this.onConfirm});
SeedLanguageForm({this.onConfirm, this.walletImage});
final Function(BuildContext, String) onConfirm;
final Image walletImage;
@override
SeedLanguageFormState createState() => SeedLanguageFormState();
@@ -33,18 +41,10 @@ class SeedLanguageForm extends StatefulWidget {
class SeedLanguageFormState extends State<SeedLanguageForm> {
static const aspectRatioImage = 1.22;
final walletNameImage = Image.asset('assets/images/wallet_name.png');
final walletNameLightImage =
Image.asset('assets/images/wallet_name_light.png');
final _languageSelectorKey = GlobalKey<SeedLanguageSelectorState>();
@override
Widget build(BuildContext context) {
final walletImage = getIt.get<SettingsStore>().isDarkTheme
? walletNameImage
: walletNameLightImage;
return Container(
padding: EdgeInsets.only(top: 24),
child: ScrollableWithBottomSection(
@@ -55,7 +55,8 @@ class SeedLanguageFormState extends State<SeedLanguageForm> {
padding: EdgeInsets.only(left: 12, right: 12),
child: AspectRatio(
aspectRatio: aspectRatioImage,
child: FittedBox(child: walletImage, fit: BoxFit.fill)),
child: FittedBox(child: widget.walletImage,
fit: BoxFit.fill)),
),
Padding(
padding: EdgeInsets.only(top: 40),
+10 -14
View File
@@ -83,9 +83,8 @@ class SendPage extends BasePage {
return KeyboardActions(
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: isDarkTheme
? Color.fromRGBO(48, 51, 60, 1.0)
: Color.fromRGBO(98, 98, 98, 1.0),
keyboardBarColor: Theme.of(context).accentTextTheme.body2
.backgroundColor,
nextFocus: false,
actions: [
KeyboardActionsItem(
@@ -133,7 +132,8 @@ class SendPage extends BasePage {
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'];
amount = uri.queryParameters['tx_amount'] ??
uri.queryParameters['amount'];
} else {
address = uri.toString();
}
@@ -497,14 +497,8 @@ class SendPage extends BasePage {
}
},
text: S.of(context).send,
color: Theme.of(context)
.accentTextTheme
.subtitle
.decorationColor,
textColor: Theme.of(context)
.accentTextTheme
.headline
.decorationColor,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
isLoading: sendViewModel.state is IsExecutingState ||
sendViewModel.state is TransactionCommitting,
isDisabled:
@@ -634,7 +628,9 @@ class SendPage extends BasePage {
padding: EdgeInsets.only(
top: 220, left: 24, right: 24),
child: Text(
S.of(context).send_success,
S.of(context).send_success(
sendViewModel.currency
.toString()),
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
@@ -748,7 +744,7 @@ class SendPage extends BasePage {
}
Future<void> _setTransactionPriority(BuildContext context) async {
final items = TransactionPriority.all;
final items = TransactionPriority.forWalletType(sendViewModel.walletType);
final selectedItem = items.indexOf(sendViewModel.transactionPriority);
await showPopUp<void>(
+6 -7
View File
@@ -49,9 +49,8 @@ class SendTemplatePage extends BasePage {
return KeyboardActions(
config: KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: isDarkTheme
? Color.fromRGBO(48, 51, 60, 1.0)
: Color.fromRGBO(98, 98, 98, 1.0),
keyboardBarColor: Theme.of(context).accentTextTheme.body2
.backgroundColor,
nextFocus: false,
actions: [
KeyboardActionsItem(
@@ -113,7 +112,8 @@ class SendTemplatePage extends BasePage {
if (uri != null) {
address = uri.path;
amount = uri.queryParameters['tx_amount'];
amount = uri.queryParameters['tx_amount'] ??
uri.queryParameters['amount'];
} else {
address = uri.toString();
}
@@ -246,9 +246,8 @@ class SendTemplatePage extends BasePage {
}
},
text: S.of(context).save,
color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
textColor:
Theme.of(context).accentTextTheme.headline.decorationColor,
color: Colors.green,
textColor: Colors.white,
),
),
));
@@ -49,6 +49,7 @@ class TransactionDetailsPage extends BasePage {
value: tx.amountFormatted()),
StandartListItem(title: S.current.send_fee, value: tx.feeFormatted())
];
if (showRecipientAddress) {
final recipientAddress = transactionDescriptionBox.values
.firstWhere((val) => val.id == transactionInfo.id,
@@ -61,6 +62,12 @@ class TransactionDetailsPage extends BasePage {
value: recipientAddress));
}
}
if (tx.key?.isNotEmpty ?? null) {
// FIXME: add translation
items.add(StandartListItem(title: 'Transaction Key', value: tx.key));
}
_items.addAll(items);
_items.add(StandartListItem(
title: "View in Block Explorer",
@@ -81,9 +88,8 @@ class TransactionDetailsPage extends BasePage {
StandartListItem(
title: S.current.transaction_details_amount,
value: tx.amountFormatted()),
StandartListItem(
title: "View in Block Explorer",
value: "https://www.blockchain.com/btc/tx/${tx.id}"),
if (tx.feeFormatted()?.isNotEmpty)
StandartListItem(title: S.current.send_fee, value: tx.feeFormatted())
];
_items.addAll(items);
@@ -91,6 +97,18 @@ class TransactionDetailsPage extends BasePage {
title: "View in Block Explorer",
value: "https://www.blockchain.com/btc/tx/${tx.id}"));
}
if (showRecipientAddress) {
final recipientAddress = transactionDescriptionBox.values
.firstWhere((val) => val.id == transactionInfo.id, orElse: () => null)
?.recipientAddress;
if (recipientAddress?.isNotEmpty ?? false) {
_items.add(StandartListItem(
title: S.current.transaction_details_recipient_address,
value: recipientAddress));
}
}
}
@override
@@ -1,5 +1,4 @@
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
import 'package:cake_wallet/src/screens/wallet_list/widgets/wallet_menu_alert.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/utils/show_bar.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
@@ -15,7 +14,6 @@ import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class WalletListPage extends BasePage {
@@ -51,7 +49,7 @@ class WalletListBodyState extends State<WalletListBody> {
final newWalletImage = Image.asset('assets/images/new_wallet.png',
height: 12,
width: 12,
color: Theme.of(context).accentTextTheme.headline.decorationColor);
color: Colors.white);
final restoreWalletImage = Image.asset('assets/images/restore_wallet.png',
height: 12,
width: 12,
@@ -165,17 +163,16 @@ class WalletListBodyState extends State<WalletListBody> {
),
bottomSection: Column(children: <Widget>[
PrimaryImageButton(
onPressed: () => _generateNewWallet(),
onPressed: () => Navigator.of(context).pushNamed(Routes.newWalletType),
image: newWalletImage,
text: S.of(context).wallet_list_create_new_wallet,
color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
textColor:
Theme.of(context).accentTextTheme.headline.decorationColor,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
),
SizedBox(height: 10.0),
PrimaryImageButton(
onPressed: () =>
Navigator.of(context).pushNamed(Routes.restoreWallet),
Navigator.of(context).pushNamed(Routes.restoreWalletType),
image: restoreWalletImage,
text: S.of(context).wallet_list_restore_wallet,
color: Theme.of(context).accentTextTheme.caption.color,
@@ -243,7 +240,7 @@ class WalletListBodyState extends State<WalletListBody> {
changeProcessText(S.of(context).creating_new_wallet);
await widget.walletListViewModel.walletNewVM.create(options: 'English'); // FIXME: Unnamed constant
hideProgressText();
await Navigator.of(context).pushNamed(Routes.seed, arguments: true);
await Navigator.of(context).pushNamed(Routes.preSeed);
} catch(e) {
changeProcessText(S.of(context).creating_new_wallet_error(e.toString()));
}
+2 -5
View File
@@ -1,5 +1,4 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
@@ -23,9 +22,7 @@ class WelcomePage extends BasePage {
@override
Widget body(BuildContext context) {
final welcomeImage = getIt
.get<SettingsStore>()
.isDarkTheme
final welcomeImage = currentTheme.type == ThemeType.dark
? welcomeImageDark : welcomeImageLight;
final newWalletImage = Image.asset('assets/images/new_wallet.png',
+1 -1
View File
@@ -204,7 +204,7 @@ class AddressTextField extends StatelessWidget {
onURIScanned(uri);
}
} catch (e) {
print('Error $e');
print(e.toString());
}
}
+3 -2
View File
@@ -31,7 +31,7 @@ class AlertWithOneAction extends BaseAlertDialog {
width: 300,
height: 52,
padding: EdgeInsets.only(left: 12, right: 12),
color: Theme.of(context).accentTextTheme.body2.color,
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
child: ButtonTheme(
minWidth: double.infinity,
child: FlatButton(
@@ -44,7 +44,8 @@ class AlertWithOneAction extends BaseAlertDialog {
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: Colors.white,
color: Theme.of(context).primaryTextTheme.body1
.backgroundColor,
decoration: TextDecoration.none,
),
)),
+14 -3
View File
@@ -61,18 +61,24 @@ class BaseAlertDialog extends StatelessWidget {
fontSize: 15,
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: Colors.white,
color: Theme.of(context).primaryTextTheme.body2
.backgroundColor,
decoration: TextDecoration.none,
),
)),
),
)
),
Container(
width: 1,
height: 52,
color: Theme.of(context).dividerColor,
),
Flexible(
child: Container(
height: 52,
padding: EdgeInsets.only(left: 6, right: 6),
color: Theme.of(context).accentTextTheme.body2.color,
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
child: ButtonTheme(
minWidth: double.infinity,
child: FlatButton(
@@ -86,7 +92,8 @@ class BaseAlertDialog extends StatelessWidget {
fontSize: 15,
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: Colors.white,
color: Theme.of(context).primaryTextTheme.body1
.backgroundColor,
decoration: TextDecoration.none,
),
)),
@@ -133,6 +140,10 @@ class BaseAlertDialog extends StatelessWidget {
],
),
),
Container(
height: 1,
color: Theme.of(context).dividerColor,
),
actionButtons(context)
],
),
+7 -5
View File
@@ -12,20 +12,21 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:flutter/widgets.dart';
class SeedWidget extends StatefulWidget {
SeedWidget({Key key, this.language}) : super(key: key);
SeedWidget({Key key, this.language, this.type}) : super(key: key);
final String language;
final WalletType type;
@override
SeedWidgetState createState() => SeedWidgetState(language);
SeedWidgetState createState() => SeedWidgetState(language, type);
}
class SeedWidgetState extends State<SeedWidget> {
SeedWidgetState(String language)
SeedWidgetState(String language, this.type)
: controller = TextEditingController(),
focusNode = FocusNode(),
words = SeedValidator.getWordList(
type: WalletType.monero, language: language) {
type:type, language: language) {
focusNode.addListener(() {
setState(() {
if (!focusNode.hasFocus && controller.text.isEmpty) {
@@ -41,6 +42,7 @@ class SeedWidgetState extends State<SeedWidget> {
final TextEditingController controller;
final FocusNode focusNode;
final WalletType type;
List<String> words;
bool _showPlaceholder;
@@ -55,7 +57,7 @@ class SeedWidgetState extends State<SeedWidget> {
void changeSeedLanguage(String language) {
setState(() {
words = SeedValidator.getWordList(
type: WalletType.monero, language: language);
type: type, language: language);
});
}
+76
View File
@@ -0,0 +1,76 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StandardCheckbox extends StatefulWidget {
StandardCheckbox({
@required this.value,
this.caption = '',
@required this.onChanged});
final bool value;
final String caption;
final Function(bool) onChanged;
@override
StandardCheckboxState createState() =>
StandardCheckboxState(value, caption, onChanged);
}
class StandardCheckboxState extends State<StandardCheckbox> {
StandardCheckboxState(this.value, this.caption, this.onChanged);
bool value;
String caption;
Function(bool) onChanged;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
value = !value;
onChanged(value);
setState(() {});
},
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
height: 24.0,
width: 24.0,
margin: EdgeInsets.only(
right: 10.0,
),
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context)
.primaryTextTheme
.caption
.color,
width: 1.0),
borderRadius: BorderRadius.all(
Radius.circular(8.0)),
color: Theme.of(context).backgroundColor),
child: value
? Icon(
Icons.check,
color: Colors.blue,
size: 20.0,
)
: Offstage(),
),
Text(
caption,
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
)
],
),
);
}
}
+4 -1
View File
@@ -21,7 +21,10 @@ class TrailButton extends StatelessWidget {
child: Text(
caption,
style: TextStyle(
color: Theme.of(context).textTheme.subhead.decorationColor,
color: Theme.of(context)
.accentTextTheme
.display4
.decorationColor,
fontWeight: FontWeight.w500,
fontSize: 14),
),