mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
Merge branch 'new-world' into CAKE-54-usdterc20-for-changenow
This commit is contained in:
@@ -1,98 +0,0 @@
|
||||
// import 'dart:async';
|
||||
// import 'package:flutter/foundation.dart';
|
||||
// import 'package:mobx/mobx.dart';
|
||||
// import 'package:cake_wallet/entities/node.dart';
|
||||
// import 'package:cake_wallet/entities/sync_status.dart';
|
||||
// import 'package:cake_wallet/src/domain/services/wallet_service.dart';
|
||||
// import 'package:cake_wallet/src/start_updating_price.dart';
|
||||
// import 'package:cake_wallet/src/stores/sync/sync_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/price/price_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/authentication/authentication_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/login/login_store.dart';
|
||||
//
|
||||
// Timer _reconnectionTimer;
|
||||
// ReactionDisposer _connectToNodeDisposer;
|
||||
// ReactionDisposer _onSyncStatusChangeDisposer;
|
||||
// ReactionDisposer _onCurrentWalletChangeDisposer;
|
||||
//
|
||||
// void setReactions(
|
||||
// {@required SettingsStore settingsStore,
|
||||
// @required PriceStore priceStore,
|
||||
// @required SyncStore syncStore,
|
||||
// @required WalletStore walletStore,
|
||||
// @required WalletService walletService,
|
||||
// // @required AuthenticationStore authenticationStore,
|
||||
// @required LoginStore loginStore}) {
|
||||
// connectToNode(settingsStore: settingsStore, walletStore: walletStore);
|
||||
// onSyncStatusChange(
|
||||
// syncStore: syncStore,
|
||||
// walletStore: walletStore,
|
||||
// settingsStore: settingsStore);
|
||||
// onCurrentWalletChange(
|
||||
// walletStore: walletStore,
|
||||
// settingsStore: settingsStore,
|
||||
// priceStore: priceStore);
|
||||
// autorun((_) async {
|
||||
// // if (authenticationStore.state == AuthenticationState.allowed) {
|
||||
// // await loginStore.loadCurrentWallet();
|
||||
// // authenticationStore.state = AuthenticationState.readyToLogin;
|
||||
// // }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// void connectToNode({SettingsStore settingsStore, WalletStore walletStore}) {
|
||||
// _connectToNodeDisposer?.call();
|
||||
//
|
||||
// _connectToNodeDisposer = reaction((_) => settingsStore.node,
|
||||
// (Node node) async => await walletStore.connectToNode(node: node));
|
||||
// }
|
||||
//
|
||||
// void onCurrentWalletChange(
|
||||
// {WalletStore walletStore,
|
||||
// SettingsStore settingsStore,
|
||||
// PriceStore priceStore}) {
|
||||
// _onCurrentWalletChangeDisposer?.call();
|
||||
//
|
||||
// reaction((_) => walletStore.name, (String _) {
|
||||
// walletStore.connectToNode(node: settingsStore.node);
|
||||
// startUpdatingPrice(settingsStore: settingsStore, priceStore: priceStore);
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// void onSyncStatusChange(
|
||||
// {SyncStore syncStore,
|
||||
// WalletStore walletStore,
|
||||
// SettingsStore settingsStore}) {
|
||||
// // _onSyncStatusChangeDisposer?.call();
|
||||
//
|
||||
// // reaction((_) => syncStore.status, (SyncStatus status) async {
|
||||
// // if (status is ConnectedSyncStatus) {
|
||||
// // await walletStore.startSync();
|
||||
// // }
|
||||
//
|
||||
// // // Reconnect to the node if the app is not started sync after 30 seconds
|
||||
// // if (status is StartingSyncStatus) {
|
||||
// // startReconnectionObserver(syncStore: syncStore, walletStore: walletStore);
|
||||
// // }
|
||||
// // });
|
||||
// }
|
||||
//
|
||||
// void startReconnectionObserver({SyncStore syncStore, WalletStore walletStore}) {
|
||||
// if (_reconnectionTimer != null) {
|
||||
// _reconnectionTimer.cancel();
|
||||
// }
|
||||
//
|
||||
// _reconnectionTimer = Timer.periodic(Duration(minutes: 1), (_) async {
|
||||
// try {
|
||||
// final isConnected = await walletStore.isConnected();
|
||||
//
|
||||
// if (!isConnected) {
|
||||
// await walletStore.reconnect();
|
||||
// }
|
||||
// } catch (e) {
|
||||
// print(e);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
@@ -27,7 +27,7 @@ class AuthPageState extends State<AuthPage> {
|
||||
final _key = GlobalKey<ScaffoldState>();
|
||||
final _pinCodeKey = GlobalKey<PinCodeState>();
|
||||
final _backArrowImageDarkTheme =
|
||||
Image.asset('assets/images/back_arrow_dark_theme.png');
|
||||
Image.asset('assets/images/close_button.png');
|
||||
ReactionDisposer _reaction;
|
||||
|
||||
@override
|
||||
@@ -122,9 +122,11 @@ class AuthPageState extends State<AuthPage> {
|
||||
key: _key,
|
||||
appBar: CupertinoNavigationBar(
|
||||
leading: widget.closable
|
||||
? SizedBox(
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SizedBox(
|
||||
height: 37,
|
||||
width: 20,
|
||||
width: 37,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.minPositive,
|
||||
child: FlatButton(
|
||||
@@ -134,7 +136,7 @@ class AuthPageState extends State<AuthPage> {
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: _backArrowImageDarkTheme),
|
||||
),
|
||||
)
|
||||
))
|
||||
: Container(),
|
||||
backgroundColor: Theme.of(context).backgroundColor,
|
||||
border: null),
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/nav_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/themes.dart';
|
||||
import 'package:cake_wallet/theme_changer.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/src/widgets/nav_bar.dart';
|
||||
|
||||
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');
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey;
|
||||
final Image _closeButtonImage;
|
||||
final Image _closeButtonImageDarkTheme;
|
||||
|
||||
String get title => null;
|
||||
|
||||
bool get isModalBackButton => false;
|
||||
@@ -29,11 +37,7 @@ abstract class BasePage extends StatelessWidget {
|
||||
|
||||
Widget Function(BuildContext, Widget) get rootWrapper => null;
|
||||
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
final _closeButtonImage = Image.asset('assets/images/close_button.png');
|
||||
final _closeButtonImageDarkTheme =
|
||||
Image.asset('assets/images/close_button_dark_theme.png');
|
||||
bool get _isDarkTheme => getIt.get<SettingsStore>().isDarkTheme;
|
||||
|
||||
void onOpenEndDrawer() => _scaffoldKey.currentState.openEndDrawer();
|
||||
|
||||
@@ -45,12 +49,9 @@ abstract class BasePage extends StatelessWidget {
|
||||
}
|
||||
|
||||
final _backButton = Image.asset('assets/images/back_arrow.png',
|
||||
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color);
|
||||
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
final _closeButton = _themeChanger.getTheme() == Themes.darkTheme
|
||||
? _closeButtonImageDarkTheme
|
||||
: _closeButtonImage;
|
||||
color: titleColor ?? Theme.of(context).primaryTextTheme.title.color);
|
||||
final _closeButton =
|
||||
_isDarkTheme ? _closeButtonImageDarkTheme : _closeButtonImage;
|
||||
|
||||
return SizedBox(
|
||||
height: 37,
|
||||
@@ -77,7 +78,7 @@ abstract class BasePage extends StatelessWidget {
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Poppins',
|
||||
color: titleColor ??
|
||||
Theme.of(context).primaryTextTheme.title.color),
|
||||
Theme.of(context).primaryTextTheme.title.color),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -86,10 +87,8 @@ abstract class BasePage extends StatelessWidget {
|
||||
Widget floatingActionButton(BuildContext context) => null;
|
||||
|
||||
ObstructingPreferredSizeWidget appBar(BuildContext context) {
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
|
||||
final appBarColor = _isDarkTheme
|
||||
? backgroundDarkColor : backgroundLightColor;
|
||||
final appBarColor =
|
||||
_isDarkTheme ? backgroundDarkColor : backgroundLightColor;
|
||||
|
||||
switch (appBarStyle) {
|
||||
case AppBarStyle.regular:
|
||||
@@ -131,9 +130,6 @@ abstract class BasePage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
|
||||
|
||||
final root = Scaffold(
|
||||
key: _scaffoldKey,
|
||||
backgroundColor:
|
||||
@@ -142,7 +138,7 @@ abstract class BasePage extends StatelessWidget {
|
||||
extendBodyBehindAppBar: extendBodyBehindAppBar,
|
||||
endDrawer: endDrawer,
|
||||
appBar: appBar(context),
|
||||
body: body(context), //SafeArea(child: ),
|
||||
body: body(context),
|
||||
floatingActionButton: floatingActionButton(context));
|
||||
|
||||
return rootWrapper?.call(context, root) ?? root;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -172,8 +173,8 @@ class ContactListPage extends BasePage {
|
||||
],
|
||||
dismissal: SlidableDismissal(
|
||||
child: SlidableDrawerDismissal(),
|
||||
onDismissed: (actionType) async =>
|
||||
await contactListViewModel.delete(contact),
|
||||
onDismissed: (actionType) async => null,
|
||||
// await contactListViewModel.delete(contact),
|
||||
onWillDismiss: (actionType) async =>
|
||||
showAlertDialog(context),
|
||||
),
|
||||
@@ -252,7 +253,7 @@ class ContactListPage extends BasePage {
|
||||
}
|
||||
|
||||
Future<bool> showAlertDialog(BuildContext context) async {
|
||||
return await showDialog(
|
||||
return await showPopUp(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
@@ -267,7 +268,7 @@ class ContactListPage extends BasePage {
|
||||
|
||||
Future<bool> showNameAndAddressDialog(
|
||||
BuildContext context, String name, String address) async {
|
||||
return await showDialog(
|
||||
return await showPopUp(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:cake_wallet/palette.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';
|
||||
@@ -138,7 +139,7 @@ class ContactPage extends BasePage {
|
||||
}
|
||||
|
||||
void _presentCurrencyPicker(BuildContext context) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
builder: (_) => CurrencyPicker(
|
||||
selectedAtIndex:
|
||||
contactViewModel.currencies.indexOf(contactViewModel.currency),
|
||||
@@ -150,7 +151,7 @@ class ContactPage extends BasePage {
|
||||
}
|
||||
|
||||
void _onContactSavingFailure(BuildContext context, String error) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/exchange/trade.dart';
|
||||
// import 'package:cake_wallet/monero/transaction_description.dart';
|
||||
// import 'package:cake_wallet/src/domain/services/wallet_service.dart';
|
||||
// import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart';
|
||||
// import 'package:cake_wallet/src/stores/action_list/action_list_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/action_list/trade_filter_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/action_list/transaction_filter_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/price/price_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
// import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
||||
|
||||
// FIXME: Remove me.
|
||||
|
||||
// Widget createDashboardPage(
|
||||
// {@required WalletService walletService,
|
||||
// @required PriceStore priceStore,
|
||||
// @required Box<TransactionDescription> transactionDescriptions,
|
||||
// @required SettingsStore settingsStore,
|
||||
// @required Box<Trade> trades,
|
||||
// @required WalletStore walletStore}) =>
|
||||
// Provider(
|
||||
// create: (_) => ActionListStore(
|
||||
// walletService: walletService,
|
||||
// settingsStore: settingsStore,
|
||||
// priceStore: priceStore,
|
||||
// tradesSource: trades,
|
||||
// transactionFilterStore: TransactionFilterStore(),
|
||||
// tradeFilterStore: TradeFilterStore(walletStore: walletStore),
|
||||
// transactionDescriptions: transactionDescriptions),
|
||||
// child: DashboardPage());
|
||||
@@ -103,29 +103,18 @@ class DashboardPage extends BasePage {
|
||||
activeDotColor: Colors.white),
|
||||
)),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(
|
||||
left: 45,
|
||||
right: 45,
|
||||
bottom: 24
|
||||
),
|
||||
padding: EdgeInsets.only(left: 45, right: 45, bottom: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
ActionButton(
|
||||
image: sendImage,
|
||||
title: S.of(context).send,
|
||||
route: Routes.send,
|
||||
alignment: Alignment.centerLeft,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: ActionButton(
|
||||
image: exchangeImage,
|
||||
title: S.of(context).exchange,
|
||||
route: Routes.exchange
|
||||
),
|
||||
),
|
||||
route: Routes.send),
|
||||
ActionButton(
|
||||
image: exchangeImage,
|
||||
title: S.of(context).exchange,
|
||||
route: Routes.exchange),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -72,7 +73,7 @@ class WalletMenu {
|
||||
}
|
||||
|
||||
Future<void> _presentReconnectAlert(BuildContext context) async {
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
|
||||
@@ -15,8 +15,6 @@ class ActionButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
height: 93,
|
||||
alignment: alignment,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
@@ -38,6 +36,7 @@ class ActionButton extends StatelessWidget {
|
||||
child: image,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15),
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 14, color: Colors.white),
|
||||
|
||||
@@ -11,57 +11,42 @@ class BalancePage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: 160,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Observer(
|
||||
builder: (_) {
|
||||
return Text(
|
||||
dashboardViewModel.wallet.currency.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
return Text(
|
||||
dashboardViewModel.balanceViewModel.cryptoBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 54,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
height: 1
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
Observer(
|
||||
builder: (_) {
|
||||
return Text(
|
||||
dashboardViewModel.balanceViewModel.fiatBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).indicatorColor,
|
||||
height: 1
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
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),
|
||||
);
|
||||
}),
|
||||
SizedBox(height: 10),
|
||||
Observer(builder: (_) {
|
||||
return Text(dashboardViewModel.balanceViewModel.cryptoBalance,
|
||||
style: TextStyle(
|
||||
fontSize: 54,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
height: 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);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_widget.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
@@ -31,7 +32,7 @@ class HeaderRow extends StatelessWidget {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (context) => FilterWidget(dashboardViewModel: dashboardViewModel)
|
||||
);
|
||||
|
||||
@@ -3,13 +3,13 @@ import 'package:cake_wallet/entities/transaction_direction.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class TransactionRow extends StatelessWidget {
|
||||
TransactionRow({
|
||||
this.direction,
|
||||
this.formattedDate,
|
||||
this.formattedAmount,
|
||||
this.formattedFiatAmount,
|
||||
this.isPending,
|
||||
@required this.onTap});
|
||||
TransactionRow(
|
||||
{this.direction,
|
||||
this.formattedDate,
|
||||
this.formattedAmount,
|
||||
this.formattedFiatAmount,
|
||||
this.isPending,
|
||||
@required this.onTap});
|
||||
|
||||
final VoidCallback onTap;
|
||||
final TransactionDirection direction;
|
||||
@@ -23,75 +23,73 @@ class TransactionRow extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 52,
|
||||
height: 62,
|
||||
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'),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Container(
|
||||
height: 46,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
(direction == TransactionDirection.incoming
|
||||
child: Container(
|
||||
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 : ''),
|
||||
(isPending ? S.of(context).pending : ''),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white)),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(10)),
|
||||
color: (direction ==
|
||||
TransactionDirection.incoming
|
||||
? Colors.green.withOpacity(0.8)
|
||||
: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.body2
|
||||
.decorationColor
|
||||
.withOpacity(0.8))),
|
||||
padding: EdgeInsets.only(
|
||||
top: 3, bottom: 3, left: 10, right: 10),
|
||||
child: Text(formattedAmount,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white
|
||||
)),
|
||||
Text(direction == TransactionDirection.incoming
|
||||
? formattedAmount
|
||||
: '- ' + 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(direction == TransactionDirection.incoming
|
||||
? formattedFiatAmount
|
||||
: '- ' + formattedFiatAmount,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).textTheme
|
||||
.overline.backgroundColor))
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
))
|
||||
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))
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -51,7 +52,7 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
|
||||
}
|
||||
|
||||
Future<void> _showAlertDialog(BuildContext context) async {
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/widgets/template_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/trail_button.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -293,7 +294,7 @@ class ExchangePage extends BasePage {
|
||||
exchangeViewModel, template);
|
||||
},
|
||||
onRemove: () {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return AlertWithTwoActions(
|
||||
@@ -492,7 +493,7 @@ class ExchangePage extends BasePage {
|
||||
// reaction((_) => exchangeViewModel.tradeState, (ExchangeTradeState state) {
|
||||
// if (state is TradeIsCreatedFailure) {
|
||||
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// showDialog<void>(
|
||||
// showPopUp<void>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertWithOneAction(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
@@ -145,11 +146,11 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
textAlign: TextAlign.left,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(15),
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
// inputFormatters: [
|
||||
// LengthLimitingTextInputFormatter(15),
|
||||
// BlacklistingTextInputFormatter(
|
||||
// RegExp('[\\-|\\ |\\,]'))
|
||||
// ],
|
||||
hintText: '0.0000',
|
||||
borderColor: widget.borderColor,
|
||||
textStyle: TextStyle(
|
||||
@@ -303,7 +304,7 @@ class ExchangeCardState extends State<ExchangeCard> {
|
||||
}
|
||||
|
||||
void _presentPicker(BuildContext context) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
builder: (_) => CurrencyPicker(
|
||||
selectedAtIndex: widget.currencies.indexOf(_selectedCurrency),
|
||||
items: widget.currencies,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider.dart';
|
||||
@@ -72,7 +73,7 @@ class PresentProviderPicker extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
builder: (_) => Picker(
|
||||
items: items,
|
||||
images: images,
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/standart_list_row.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -37,7 +38,7 @@ void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext
|
||||
: S.current.exchange_result_description(
|
||||
trade.amount ?? fetchingLabel, trade.from.toString());
|
||||
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => InformationPage(information: information)
|
||||
);
|
||||
@@ -255,7 +256,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
reaction((_) => sendStore.state, (SendingState state) {
|
||||
if (state is SendingFailed) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
@@ -270,7 +271,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
|
||||
if (state is TransactionCreatedSuccessfully) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
@@ -292,7 +293,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
|
||||
|
||||
if (state is TransactionCommitted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class FAQItem extends StatefulWidget {
|
||||
FAQItem(this.title, this.text);
|
||||
|
||||
final String title;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => FAQItemState();
|
||||
}
|
||||
|
||||
class FAQItemState extends State<FAQItem> {
|
||||
bool isActive;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
isActive = false;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final addIcon =
|
||||
Icon(Icons.add, color: Theme.of(context).primaryTextTheme.title.color);
|
||||
final removeIcon = Icon(Icons.remove, color: Palette.blueCraiola);
|
||||
final icon = isActive ? removeIcon : addIcon;
|
||||
final color = isActive
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).primaryTextTheme.title.color;
|
||||
|
||||
return ListTileTheme(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 6, 24, 6),
|
||||
child: ExpansionTile(
|
||||
title: Text(widget.title,
|
||||
style: TextStyle(
|
||||
fontSize: 14, fontWeight: FontWeight.w500, color: color)),
|
||||
trailing: icon,
|
||||
onExpansionChanged: (value) => setState(() => isActive = value),
|
||||
children: <Widget>[
|
||||
Row(mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
right: 24.0,
|
||||
),
|
||||
child: Text(
|
||||
widget.text,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
),
|
||||
))
|
||||
])
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,30 @@
|
||||
import 'dart:convert';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/src/screens/faq/faq_item.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
|
||||
class FaqPage extends BasePage {
|
||||
FaqPage(this.settingsStore);
|
||||
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
@override
|
||||
String get title => S.current.faq;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) => FaqForm();
|
||||
}
|
||||
|
||||
class FaqForm extends StatefulWidget {
|
||||
@override
|
||||
FaqFormState createState() => FaqFormState();
|
||||
}
|
||||
|
||||
class FaqFormState extends State<FaqForm> {
|
||||
List<Icon> icons;
|
||||
List<Color> colors;
|
||||
bool isLoaded = false;
|
||||
String get path => 'assets/faq/faq_' + settingsStore.languageCode + '.json';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final addIcon = Icon(Icons.add, color: Theme.of(context).primaryTextTheme.title.color);
|
||||
final removeIcon = Icon(Icons.remove, color: Palette.blueCraiola);
|
||||
|
||||
Widget body(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 12, left: 24),
|
||||
child: FutureBuilder(
|
||||
builder: (context, snapshot) {
|
||||
final faqItems = jsonDecode(snapshot.data.toString()) as List;
|
||||
|
||||
if (snapshot.hasData) {
|
||||
setIconsAndColors(context, faqItems.length, addIcon);
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
@@ -49,112 +33,20 @@ class FaqFormState extends State<FaqForm> {
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final itemTitle = faqItems[index]["question"].toString();
|
||||
final itemChild = faqItems[index]["answer"].toString();
|
||||
final title = faqItems[index]["question"].toString();
|
||||
final text = faqItems[index]["answer"].toString();
|
||||
|
||||
return ListTileTheme(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 6, 24, 6),
|
||||
child: ExpansionTile(
|
||||
title: Text(
|
||||
itemTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colors[index]
|
||||
),
|
||||
),
|
||||
trailing: icons[index],
|
||||
onExpansionChanged: (value) {
|
||||
setState(() {
|
||||
if (value) {
|
||||
icons[index] = removeIcon;
|
||||
colors[index] = Palette.blueCraiola;
|
||||
} else {
|
||||
icons[index] = addIcon;
|
||||
colors[index] = Theme.of(context).primaryTextTheme.title.color;
|
||||
}
|
||||
});
|
||||
},
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
right: 24.0,
|
||||
),
|
||||
child: Text(
|
||||
itemChild,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
),
|
||||
))
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
return FAQItem(title, text);
|
||||
},
|
||||
separatorBuilder: (_, __) =>
|
||||
StandardListSeparator(),
|
||||
itemCount: faqItems == null ? 0 : faqItems.length,
|
||||
separatorBuilder: (_, __) => StandardListSeparator(),
|
||||
itemCount: faqItems?.length ?? 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
future: rootBundle.loadString(getFaqPath(context)),
|
||||
future: rootBundle.loadString(path),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void setIconsAndColors(BuildContext context, int index, Icon icon) {
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
icons = List.generate(index, (int i) => icon);
|
||||
colors = List.generate(index, (int i) => Theme.of(context).primaryTextTheme.title.color);
|
||||
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
String getFaqPath(BuildContext context) {
|
||||
// FIXME: FIXME
|
||||
// final settingsStore = Provider.of<SettingsStore>(context);
|
||||
//
|
||||
// switch (settingsStore.languageCode) {
|
||||
// case 'en':
|
||||
// return 'assets/faq/faq_en.json';
|
||||
// case 'uk':
|
||||
// return 'assets/faq/faq_uk.json';
|
||||
// case 'ru':
|
||||
// return 'assets/faq/faq_ru.json';
|
||||
// case 'es':
|
||||
// return 'assets/faq/faq_es.json';
|
||||
// case 'ja':
|
||||
// return 'assets/faq/faq_ja.json';
|
||||
// case 'ko':
|
||||
// return 'assets/faq/faq_ko.json';
|
||||
// case 'hi':
|
||||
// return 'assets/faq/faq_hi.json';
|
||||
// case 'de':
|
||||
// return 'assets/faq/faq_de.json';
|
||||
// case 'zh':
|
||||
// return 'assets/faq/faq_zh.json';
|
||||
// case 'pt':
|
||||
// return 'assets/faq/faq_pt.json';
|
||||
// case 'pl':
|
||||
// return 'assets/faq/faq_pl.json';
|
||||
// case 'nl':
|
||||
// return 'assets/faq/faq_nl.json';
|
||||
// default:
|
||||
// return 'assets/faq/faq_en.json';
|
||||
// }
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class AccountTile extends StatelessWidget {
|
||||
accountName,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Poppins',
|
||||
color: textColor,
|
||||
decoration: TextDecoration.none,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -60,7 +61,7 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||
|
||||
if (state is FailureState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
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';
|
||||
@@ -29,7 +30,7 @@ class NodeListPage extends BasePage {
|
||||
minWidth: double.minPositive,
|
||||
child: FlatButton(
|
||||
onPressed: () async {
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
@@ -66,87 +67,86 @@ class NodeListPage extends BasePage {
|
||||
sectionCount: 2,
|
||||
context: context,
|
||||
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 Observer(builder: (_) {
|
||||
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 nodeListRow = NodeListRow(
|
||||
title: node.value.uri,
|
||||
isSelected: node.isSelected,
|
||||
isAlive: node.value.requestNode(),
|
||||
onTap: (_) async {
|
||||
if (node.isSelected) {
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
content: Text(
|
||||
S.of(context).change_current_node(node.value.uri),
|
||||
textAlign: TextAlign.center,
|
||||
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 = Dismissible(
|
||||
key: Key('${node.keyIndex}'),
|
||||
confirmDismiss: (direction) async {
|
||||
return await showPopUp(
|
||||
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));
|
||||
});
|
||||
},
|
||||
onDismissed: (direction) async =>
|
||||
nodeListViewModel.delete(node),
|
||||
direction: DismissDirection.endToStart,
|
||||
background: Container(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
color: Palette.red,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
CupertinoIcons.delete,
|
||||
color: Colors.white,
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(S.of(context).cancel)),
|
||||
FlatButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
await nodeListViewModel
|
||||
.setAsCurrent(node.value);
|
||||
},
|
||||
child: Text(S.of(context).change)),
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
Text(
|
||||
S.of(context).delete,
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
)),
|
||||
child: nodeListRow);
|
||||
|
||||
final dismissibleRow = Dismissible(
|
||||
key: Key('${node.keyIndex}'),
|
||||
confirmDismiss: (direction) async {
|
||||
return await showDialog(
|
||||
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));
|
||||
});
|
||||
},
|
||||
onDismissed: (direction) async =>
|
||||
nodeListViewModel.delete(node.value),
|
||||
direction: DismissDirection.endToStart,
|
||||
background: Container(
|
||||
padding: EdgeInsets.only(right: 10.0),
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
color: Palette.red,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
const Icon(
|
||||
CupertinoIcons.delete,
|
||||
color: Colors.white,
|
||||
),
|
||||
Text(
|
||||
S.of(context).delete,
|
||||
style: TextStyle(color: Colors.white),
|
||||
)
|
||||
],
|
||||
)),
|
||||
child: nodeListRow);
|
||||
|
||||
return node.isSelected ? nodeListRow : dismissibleRow;
|
||||
return isSelected ? nodeListRow : dismissibleRow;
|
||||
});
|
||||
},
|
||||
itemCounter: (int sectionIndex) {
|
||||
if (sectionIndex == 0) {
|
||||
|
||||
@@ -266,7 +266,7 @@ class PinCodeState<T extends PinCodeWidget> extends State<T> {
|
||||
return;
|
||||
}
|
||||
|
||||
pin.substring(0, pin.length - 1);
|
||||
setState(() => pin = pin.substring(0, pin.length - 1));
|
||||
}
|
||||
|
||||
String _changePinLengthText() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
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';
|
||||
@@ -34,21 +35,19 @@ class ReceivePage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||
(BuildContext context, Widget scaffold) => Container(
|
||||
(BuildContext context, Widget scaffold) => Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).accentColor,
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
Theme.of(context).primaryColor,
|
||||
],
|
||||
begin: Alignment.topRight,
|
||||
end: Alignment.bottomLeft)),
|
||||
Theme.of(context).accentColor,
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
Theme.of(context).primaryColor,
|
||||
], begin: Alignment.topRight, end: Alignment.bottomLeft)),
|
||||
child: scaffold);
|
||||
|
||||
@override
|
||||
Widget trailing(BuildContext context) {
|
||||
final shareImage = Image.asset('assets/images/share.png',
|
||||
color: Colors.white);
|
||||
final shareImage =
|
||||
Image.asset('assets/images/share.png', color: Colors.white);
|
||||
|
||||
return SizedBox(
|
||||
height: 20.0,
|
||||
@@ -56,12 +55,12 @@ class ReceivePage extends BasePage {
|
||||
child: ButtonTheme(
|
||||
minWidth: double.minPositive,
|
||||
child: FlatButton(
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
padding: EdgeInsets.all(0),
|
||||
onPressed: () => Share.text(S.current.share_address,
|
||||
addressListViewModel.address.address, 'text/plain'),
|
||||
child: shareImage),
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
padding: EdgeInsets.all(0),
|
||||
onPressed: () => Share.text(S.current.share_address,
|
||||
addressListViewModel.address.address, 'text/plain'),
|
||||
child: shareImage),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -80,10 +79,9 @@ class ReceivePage extends BasePage {
|
||||
),
|
||||
Observer(
|
||||
builder: (_) => ListView.separated(
|
||||
separatorBuilder: (context, _) =>
|
||||
Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).dividerColor),
|
||||
padding: EdgeInsets.all(0),
|
||||
separatorBuilder: (context, _) => Container(
|
||||
height: 1, color: Theme.of(context).dividerColor),
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: addressListViewModel.items.length,
|
||||
@@ -93,9 +91,10 @@ class ReceivePage extends BasePage {
|
||||
|
||||
if (item is WalletAccountListHeader) {
|
||||
cell = HeaderTile(
|
||||
onTap: () async => await showDialog<void>(
|
||||
onTap: () async => await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => getIt.get<MoneroAccountListPage>()),
|
||||
builder: (_) =>
|
||||
getIt.get<MoneroAccountListPage>()),
|
||||
title: addressListViewModel.accountLabel,
|
||||
icon: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
@@ -117,27 +116,31 @@ class ReceivePage extends BasePage {
|
||||
}
|
||||
|
||||
if (item is WalletAddressListItem) {
|
||||
cell = Observer(
|
||||
builder: (_) {
|
||||
final isCurrent = item.address ==
|
||||
addressListViewModel.address.address;
|
||||
final backgroundColor = isCurrent
|
||||
? Theme.of(context).textTheme.display3.decorationColor
|
||||
: Theme.of(context).textTheme.display2.decorationColor;
|
||||
final textColor = isCurrent
|
||||
? Theme.of(context).textTheme.display3.color
|
||||
: Theme.of(context).textTheme.display2.color;
|
||||
cell = Observer(builder: (_) {
|
||||
final isCurrent = item.address ==
|
||||
addressListViewModel.address.address;
|
||||
final backgroundColor = isCurrent
|
||||
? Theme.of(context)
|
||||
.textTheme
|
||||
.display3
|
||||
.decorationColor
|
||||
: Theme.of(context)
|
||||
.textTheme
|
||||
.display2
|
||||
.decorationColor;
|
||||
final textColor = isCurrent
|
||||
? Theme.of(context).textTheme.display3.color
|
||||
: Theme.of(context).textTheme.display2.color;
|
||||
|
||||
return AddressCell.fromItem(item,
|
||||
isCurrent: isCurrent,
|
||||
backgroundColor: backgroundColor,
|
||||
textColor: textColor,
|
||||
onTap: (_) => addressListViewModel.address = item,
|
||||
onEdit: () => Navigator.of(context).pushNamed(
|
||||
Routes.newSubaddress,
|
||||
arguments: item));
|
||||
}
|
||||
);
|
||||
return AddressCell.fromItem(item,
|
||||
isCurrent: isCurrent,
|
||||
backgroundColor: backgroundColor,
|
||||
textColor: textColor,
|
||||
onTap: (_) => addressListViewModel.address = item,
|
||||
onEdit: () => Navigator.of(context).pushNamed(
|
||||
Routes.newSubaddress,
|
||||
arguments: item));
|
||||
});
|
||||
}
|
||||
|
||||
return index != 0
|
||||
|
||||
@@ -80,7 +80,7 @@ class _RestoreFromKeysFromState extends State<RestoreFromKeysFrom> {
|
||||
|
||||
if (state is WalletRestorationFailure) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
@@ -53,7 +54,7 @@ class _RestoreFromSeedDetailsFormState
|
||||
|
||||
if (state is FailureState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:cake_wallet/di.dart';
|
||||
import 'package:cake_wallet/palette.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_pop_up.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -24,9 +26,28 @@ class WalletSeedPage extends BasePage {
|
||||
final WalletSeedViewModel walletSeedViewModel;
|
||||
|
||||
@override
|
||||
void onClose(BuildContext context) => isNewWalletCreated
|
||||
? Navigator.of(context).popUntil((route) => route.isFirst)
|
||||
: Navigator.of(context).pop();
|
||||
void onClose(BuildContext context) async {
|
||||
if (isNewWalletCreated) {
|
||||
final confirmed = await showPopUp<bool>(context: context, builder: (BuildContext context) {
|
||||
// FIXME: add translations
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: 'Attention',
|
||||
alertContent: 'The seed is the only way to recover your wallet. Have you written it down?',
|
||||
leftButtonText: 'Go back',
|
||||
rightButtonText: 'Yes, I have',
|
||||
actionLeftButton: () => Navigator.of(context).pop(false),
|
||||
actionRightButton: () => Navigator.of(context).pop(true));
|
||||
}) ?? false;
|
||||
|
||||
if (confirmed) {
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget leading(BuildContext context) =>
|
||||
@@ -36,31 +57,39 @@ class WalletSeedPage extends BasePage {
|
||||
Widget trailing(BuildContext context) {
|
||||
return isNewWalletCreated
|
||||
? GestureDetector(
|
||||
onTap: () => onClose(context),
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 32,
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
color: Theme.of(context).accentTextTheme.caption.color),
|
||||
child: Text(
|
||||
S.of(context).seed_language_next,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Palette.blueCraiola),
|
||||
),
|
||||
),
|
||||
)
|
||||
onTap: () => onClose(context),
|
||||
child: Container(
|
||||
width: 100,
|
||||
height: 32,
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
color: Theme
|
||||
.of(context)
|
||||
.accentTextTheme
|
||||
.caption
|
||||
.color),
|
||||
child: Text(
|
||||
S
|
||||
.of(context)
|
||||
.seed_language_next,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Palette.blueCraiola),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Offstage();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final image =
|
||||
getIt.get<SettingsStore>().isDarkTheme ? imageDark : imageLight;
|
||||
getIt
|
||||
.get<SettingsStore>()
|
||||
.isDarkTheme ? imageDark : imageLight;
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24),
|
||||
@@ -87,21 +116,23 @@ class WalletSeedPage extends BasePage {
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
color: Theme
|
||||
.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.only(top: 20, left: 16, right: 16),
|
||||
EdgeInsets.only(top: 20, left: 16, right: 16),
|
||||
child: Text(
|
||||
walletSeedViewModel.seed,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context)
|
||||
color: Theme
|
||||
.of(context)
|
||||
.primaryTextTheme
|
||||
.caption
|
||||
.color),
|
||||
@@ -115,62 +146,78 @@ class WalletSeedPage extends BasePage {
|
||||
children: <Widget>[
|
||||
isNewWalletCreated
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: 52, left: 43, right: 43),
|
||||
child: Text(
|
||||
S.of(context).seed_reminder,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.overline
|
||||
.color),
|
||||
),
|
||||
)
|
||||
padding: EdgeInsets.only(
|
||||
bottom: 52, left: 43, right: 43),
|
||||
child: Text(
|
||||
S
|
||||
.of(context)
|
||||
.seed_reminder,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme
|
||||
.of(context)
|
||||
.primaryTextTheme
|
||||
.overline
|
||||
.color),
|
||||
),
|
||||
)
|
||||
: Offstage(),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: PrimaryButton(
|
||||
onPressed: () => Share.text(
|
||||
S.of(context).seed_share,
|
||||
walletSeedViewModel.seed,
|
||||
'text/plain'),
|
||||
text: S.of(context).save,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white),
|
||||
)),
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
child: PrimaryButton(
|
||||
onPressed: () =>
|
||||
Share.text(
|
||||
S
|
||||
.of(context)
|
||||
.seed_share,
|
||||
walletSeedViewModel.seed,
|
||||
'text/plain'),
|
||||
text: S
|
||||
.of(context)
|
||||
.save,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white),
|
||||
)),
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 8.0),
|
||||
child: Builder(
|
||||
builder: (context) => PrimaryButton(
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: walletSeedViewModel.seed));
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(S
|
||||
.of(context)
|
||||
.copied_to_clipboard),
|
||||
backgroundColor: Colors.green,
|
||||
duration:
|
||||
Duration(milliseconds: 1500),
|
||||
),
|
||||
);
|
||||
},
|
||||
text: S.of(context).copy,
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.body2
|
||||
.color,
|
||||
textColor: Colors.white)),
|
||||
))
|
||||
padding: EdgeInsets.only(left: 8.0),
|
||||
child: Builder(
|
||||
builder: (context) =>
|
||||
PrimaryButton(
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: walletSeedViewModel
|
||||
.seed));
|
||||
Scaffold.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(S
|
||||
.of(context)
|
||||
.copied_to_clipboard),
|
||||
backgroundColor: Colors
|
||||
.green,
|
||||
duration:
|
||||
Duration(
|
||||
milliseconds: 1500),
|
||||
),
|
||||
);
|
||||
},
|
||||
text: S
|
||||
.of(context)
|
||||
.copy,
|
||||
color: Theme
|
||||
.of(context)
|
||||
.accentTextTheme
|
||||
.body2
|
||||
.color,
|
||||
textColor: Colors.white)),
|
||||
))
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
+154
-158
@@ -1,4 +1,5 @@
|
||||
import 'dart:ui';
|
||||
|
||||
// import 'package:cake_wallet/src/domain/common/transaction_priority.dart';
|
||||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
@@ -6,6 +7,7 @@ import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:cake_wallet/src/widgets/trail_button.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -19,6 +21,7 @@ import 'package:dotted_border/dotted_border.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
|
||||
|
||||
// import 'package:cake_wallet/src/screens/send/widgets/sending_alert.dart';
|
||||
import 'package:cake_wallet/src/widgets/template_tile.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
@@ -69,8 +72,7 @@ class SendPage extends BasePage {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24)
|
||||
),
|
||||
bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).primaryTextTheme.subhead.color,
|
||||
Theme.of(context).primaryTextTheme.subhead.decorationColor,
|
||||
@@ -105,10 +107,14 @@ class SendPage extends BasePage {
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook
|
||||
],
|
||||
buttonColor:
|
||||
Theme.of(context).primaryTextTheme.display1.color,
|
||||
borderColor:
|
||||
Theme.of(context).primaryTextTheme.headline.color,
|
||||
buttonColor: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.color,
|
||||
borderColor: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -122,83 +128,76 @@ class SendPage extends BasePage {
|
||||
.decorationColor),
|
||||
validator: sendViewModel.addressValidator,
|
||||
),
|
||||
Observer(builder: (_) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: BaseTextFormField(
|
||||
controller: _cryptoAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 9),
|
||||
child:
|
||||
Text(sendViewModel.currency.title + ':',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
suffixIcon: Container(
|
||||
height: 32,
|
||||
width: 32,
|
||||
margin: EdgeInsets.only(
|
||||
left: 14, top: 4, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.color,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6))),
|
||||
child: InkWell(
|
||||
onTap: () =>
|
||||
sendViewModel.setSendAll(),
|
||||
child: Center(
|
||||
child: Text(S.of(context).all,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.decorationColor)),
|
||||
),
|
||||
),
|
||||
),
|
||||
hintText: '0.0000',
|
||||
borderColor: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white),
|
||||
placeholderTextStyle: TextStyle(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: BaseTextFormField(
|
||||
controller: _cryptoAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 9),
|
||||
child:
|
||||
Text(sendViewModel.currency.title + ':',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
suffixIcon: Container(
|
||||
height: 32,
|
||||
width: 32,
|
||||
margin: EdgeInsets.only(
|
||||
left: 14, top: 4, bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
validator: sendViewModel.amountValidator));
|
||||
}),
|
||||
.display1
|
||||
.color,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(6))),
|
||||
child: InkWell(
|
||||
onTap: () => sendViewModel.setSendAll(),
|
||||
child: Center(
|
||||
child: Text(S.of(context).all,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.decorationColor)),
|
||||
),
|
||||
),
|
||||
),
|
||||
hintText: '0.0000',
|
||||
borderColor: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.color,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white),
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.decorationColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14),
|
||||
validator: sendViewModel.amountValidator)),
|
||||
Observer(
|
||||
builder: (_) => Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
S.of(context).available_balance + ':',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
@@ -208,29 +207,25 @@ class SendPage extends BasePage {
|
||||
.headline
|
||||
.decorationColor),
|
||||
)),
|
||||
Text(
|
||||
sendViewModel.balance,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.decorationColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
Text(
|
||||
sendViewModel.balance,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.headline
|
||||
.decorationColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: BaseTextFormField(
|
||||
controller: _fiatAmountController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
signed: false, decimal: true),
|
||||
inputFormatters: [
|
||||
BlacklistingTextInputFormatter(
|
||||
RegExp('[\\-|\\ |\\,]'))
|
||||
],
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(top: 9),
|
||||
child: Text(sendViewModel.fiat.title + ':',
|
||||
@@ -259,51 +254,51 @@ class SendPage extends BasePage {
|
||||
)),
|
||||
Observer(
|
||||
builder: (_) => GestureDetector(
|
||||
onTap: () =>
|
||||
_setTransactionPriority(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(S.of(context).send_estimated_fee,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||
color: Colors.white)),
|
||||
Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
sendViewModel.estimatedFee
|
||||
.toString() +
|
||||
' ' +
|
||||
sendViewModel
|
||||
.currency.title,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight.w600,
|
||||
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||
color: Colors.white)),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.only(left: 5),
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
))
|
||||
onTap: () =>
|
||||
_setTransactionPriority(context),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(S.of(context).send_estimated_fee,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||
color: Colors.white)),
|
||||
Container(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
sendViewModel.estimatedFee
|
||||
.toString() +
|
||||
' ' +
|
||||
sendViewModel
|
||||
.currency.title,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight:
|
||||
FontWeight.w600,
|
||||
//color: Theme.of(context).primaryTextTheme.display2.color,
|
||||
color: Colors.white)),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.only(left: 5),
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -357,7 +352,7 @@ class SendPage extends BasePage {
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(20)),
|
||||
BorderRadius.all(Radius.circular(20)),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: Text(
|
||||
@@ -397,7 +392,7 @@ class SendPage extends BasePage {
|
||||
// getOpenaliasRecord(context);
|
||||
// },
|
||||
// onRemove: () {
|
||||
// showDialog<void>(
|
||||
// showPopUp<void>(
|
||||
// context: context,
|
||||
// builder: (dialogContext) {
|
||||
// return AlertWithTwoActions(
|
||||
@@ -426,13 +421,12 @@ class SendPage extends BasePage {
|
||||
)
|
||||
],
|
||||
),
|
||||
bottomSectionPadding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSectionPadding:
|
||||
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||
bottomSection: Observer(builder: (_) {
|
||||
return LoadingPrimaryButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState.validate()) {
|
||||
|
||||
}
|
||||
if (_formKey.currentState.validate()) {}
|
||||
},
|
||||
text: S.of(context).send,
|
||||
color: Theme.of(context).accentTextTheme.body2.color,
|
||||
@@ -440,10 +434,9 @@ class SendPage extends BasePage {
|
||||
isLoading: sendViewModel.state is IsExecutingState ||
|
||||
sendViewModel.state is TransactionCommitting,
|
||||
isDisabled:
|
||||
false // FIXME !(syncStore.status is SyncedSyncStatus),
|
||||
);
|
||||
})
|
||||
),
|
||||
false // FIXME !(syncStore.status is SyncedSyncStatus),
|
||||
);
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -492,7 +485,7 @@ class SendPage extends BasePage {
|
||||
reaction((_) => sendViewModel.state, (ExecutionState state) {
|
||||
if (state is FailureState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
@@ -506,14 +499,14 @@ class SendPage extends BasePage {
|
||||
|
||||
if (state is ExecutedSuccessfullyState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ConfirmSendingAlert(
|
||||
alertTitle: S.of(context).confirm_sending,
|
||||
amount: S.of(context).send_amount,
|
||||
amountValue:
|
||||
sendViewModel.pendingTransaction.amountFormatted,
|
||||
sendViewModel.pendingTransaction.amountFormatted,
|
||||
fee: S.of(context).send_fee,
|
||||
feeValue: sendViewModel.pendingTransaction.feeFormatted,
|
||||
leftButtonText: S.of(context).ok,
|
||||
@@ -521,7 +514,7 @@ class SendPage extends BasePage {
|
||||
actionLeftButton: () {
|
||||
Navigator.of(context).pop();
|
||||
sendViewModel.commitTransaction();
|
||||
showDialog<void>(
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Observer(builder: (_) {
|
||||
@@ -564,7 +557,10 @@ class SendPage extends BasePage {
|
||||
onPressed: () =>
|
||||
Navigator.of(context).pop(),
|
||||
text: S.of(context).send_got_it,
|
||||
color: Theme.of(context).accentTextTheme.body2.color,
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.body2
|
||||
.color,
|
||||
textColor: Colors.white))
|
||||
],
|
||||
);
|
||||
@@ -635,7 +631,7 @@ class SendPage extends BasePage {
|
||||
// if (isOpenalias) {
|
||||
// _addressController.text = sendViewModel.recordAddress;
|
||||
|
||||
// await showDialog<void>(
|
||||
// await showPopUp<void>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertWithOneAction(
|
||||
@@ -653,7 +649,7 @@ class SendPage extends BasePage {
|
||||
// final items = TransactionPriority.all;
|
||||
// final selectedItem = items.indexOf(sendViewModel.transactionPriority);
|
||||
//
|
||||
// await showDialog<void>(
|
||||
// await showPopUp<void>(
|
||||
// builder: (_) => Picker(
|
||||
// items: items,
|
||||
// selectedAtIndex: selectedItem,
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/language_row.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
import 'package:cake_wallet/store/settings_store.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';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/entities/language.dart';
|
||||
import 'package:cake_wallet/entities/language_service.dart';
|
||||
|
||||
// import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
|
||||
// FIXME: FIXME
|
||||
class LanguageListPage extends BasePage {
|
||||
LanguageListPage(this.settingsStore);
|
||||
|
||||
final SettingsStore settingsStore;
|
||||
|
||||
class ChangeLanguage extends BasePage {
|
||||
@override
|
||||
String get title => S.current.settings_change_language;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
// final settingsStore = Provider.of<SettingsStore>(context);
|
||||
// final currentLanguage = Provider.of<Language>(context);
|
||||
//
|
||||
// return Container(
|
||||
// padding: EdgeInsets.only(top: 10.0),
|
||||
// child: SectionStandardList(
|
||||
// sectionCount: 1,
|
||||
// context: context,
|
||||
// itemCounter: (int sectionIndex) => languages.values.length,
|
||||
// itemBuilder: (_, sectionIndex, index) {
|
||||
// final item = languages.values.elementAt(index);
|
||||
// final code = languages.keys.elementAt(index);
|
||||
//
|
||||
// final isCurrent = settingsStore.languageCode == null
|
||||
// ? false
|
||||
// : code == settingsStore.languageCode;
|
||||
//
|
||||
// return LanguageRow(
|
||||
// title: item,
|
||||
// isSelected: isCurrent,
|
||||
// handler: (context) async {
|
||||
// if (!isCurrent) {
|
||||
// await showDialog<void>(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertWithTwoActions(
|
||||
// alertTitle: S.of(context).change_language,
|
||||
// alertContent: S.of(context).change_language_to(item),
|
||||
// rightButtonText: S.of(context).change,
|
||||
// leftButtonText: S.of(context).cancel,
|
||||
// actionRightButton: () {
|
||||
// settingsStore.saveLanguageCode(
|
||||
// languageCode: code);
|
||||
// currentLanguage.setCurrentLanguage(code);
|
||||
// Navigator.of(context).pop();
|
||||
// },
|
||||
// actionLeftButton: () => Navigator.of(context).pop()
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// )
|
||||
// );
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10.0),
|
||||
child: SectionStandardList(
|
||||
sectionCount: 1,
|
||||
context: context,
|
||||
itemCounter: (int sectionIndex) => LanguageService.list.values.length,
|
||||
itemBuilder: (_, sectionIndex, index) {
|
||||
return Observer(builder: (BuildContext context) {
|
||||
final item = LanguageService.list.values.elementAt(index);
|
||||
final code = LanguageService.list.keys.elementAt(index);
|
||||
final isCurrent = code == settingsStore.languageCode ?? false;
|
||||
|
||||
return LanguageRow(
|
||||
title: item,
|
||||
isSelected: isCurrent,
|
||||
handler: (context) async {
|
||||
if (!isCurrent) {
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
alertTitle: S.of(context).change_language,
|
||||
alertContent:
|
||||
S.of(context).change_language_to(item),
|
||||
rightButtonText: S.of(context).change,
|
||||
leftButtonText: S.of(context).cancel,
|
||||
actionRightButton: () {
|
||||
settingsStore.languageCode = code;
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
actionLeftButton: () =>
|
||||
Navigator.of(context).pop());
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
@@ -16,7 +17,7 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
||||
onTap: (BuildContext context) async {
|
||||
final selectedAtIndex = items.indexOf(selectedItem);
|
||||
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (_) => Picker(
|
||||
items: items,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
@@ -26,7 +27,7 @@ class SetupPinCodePage extends BasePage {
|
||||
}
|
||||
|
||||
if (!pinCodeViewModel.isPinCodeCorrect) {
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
@@ -43,7 +44,7 @@ class SetupPinCodePage extends BasePage {
|
||||
try {
|
||||
await pinCodeViewModel.setupPinCode();
|
||||
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
@@ -60,7 +61,7 @@ class SetupPinCodePage extends BasePage {
|
||||
});
|
||||
} catch (e) {
|
||||
// FIXME: Add translation for alert content text.
|
||||
await showDialog<void>(
|
||||
await showPopUp<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithOneAction(
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:cake_wallet/src/screens/wallet_list/widgets/wallet_menu_alert.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';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
|
||||
@@ -10,7 +11,6 @@ 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:cake_wallet/src/screens/wallet_list/widgets/wallet_tile.dart';
|
||||
|
||||
class WalletListPage extends BasePage {
|
||||
WalletListPage({this.walletListViewModel});
|
||||
@@ -65,95 +65,66 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
itemCount: widget.walletListViewModel.wallets.length,
|
||||
itemBuilder: (__, index) {
|
||||
final wallet = widget.walletListViewModel.wallets[index];
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final walletMenu = WalletMenu(context, widget.walletListViewModel);
|
||||
final items =
|
||||
walletMenu.generateItemsForWalletMenu(wallet.isCurrent);
|
||||
final colors = walletMenu
|
||||
.generateColorsForWalletMenu(wallet.isCurrent);
|
||||
final images = walletMenu
|
||||
.generateImagesForWalletMenu(wallet.isCurrent);
|
||||
final currentColor = wallet.isCurrent
|
||||
? Theme.of(context).accentTextTheme.subtitle.decorationColor
|
||||
: Theme.of(context).backgroundColor;
|
||||
|
||||
return Container(
|
||||
height: tileHeight,
|
||||
width: double.infinity,
|
||||
child: CustomScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: scrollController,
|
||||
slivers: <Widget>[
|
||||
SliverPersistentHeader(
|
||||
pinned: false,
|
||||
floating: true,
|
||||
delegate: WalletTile(
|
||||
min: screenWidth - 170,
|
||||
max: screenWidth,
|
||||
image: _imageFor(type: wallet.type),
|
||||
walletName: wallet.name,
|
||||
walletAddress: '', //shortAddress,
|
||||
isCurrent: wallet.isCurrent),
|
||||
),
|
||||
SliverList(
|
||||
delegate:
|
||||
SliverChildBuilderDelegate((context, index) {
|
||||
final item = items[index];
|
||||
final image = images[index];
|
||||
final firstColor = colors[index*2];
|
||||
final secondColor = colors[index*2 + 1];
|
||||
|
||||
final radius = index == 0 ? 10.0 : 0.0;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
scrollController.animateTo(0.0,
|
||||
duration: Duration(milliseconds: 500),
|
||||
curve: Curves.fastOutSlowIn);
|
||||
walletMenu.action(
|
||||
walletMenu.listItems.indexOf(item),
|
||||
wallet,
|
||||
wallet.isCurrent);
|
||||
},
|
||||
child: Container(
|
||||
height: tileHeight,
|
||||
width: 80,
|
||||
color: Theme.of(context).backgroundColor,
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
showPopUp<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) {
|
||||
return WalletMenuAlert(
|
||||
wallet: wallet,
|
||||
walletMenu: walletMenu,
|
||||
items: items);
|
||||
}
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: tileHeight,
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: tileHeight,
|
||||
width: 4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(4),
|
||||
bottomRight: Radius.circular(4)),
|
||||
color: currentColor
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 5, right: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(radius),
|
||||
bottomLeft: Radius.circular(radius)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
firstColor,
|
||||
secondColor
|
||||
]
|
||||
height: tileHeight,
|
||||
padding: EdgeInsets.only(left: 20, right: 20),
|
||||
color: Theme.of(context).backgroundColor,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
_imageFor(type: wallet.type),
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
wallet.name,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
)
|
||||
),
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
image,
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
item,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 7,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}, childCount: items.length))
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu_item.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
// import 'package:cake_wallet/src/stores/wallet_list/wallet_list_store.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
@@ -15,85 +15,46 @@ class WalletMenu {
|
||||
final WalletListViewModel walletListViewModel;
|
||||
final BuildContext context;
|
||||
|
||||
final List<String> listItems = [
|
||||
S.current.wallet_list_load_wallet,
|
||||
S.current.show_seed,
|
||||
S.current.remove,
|
||||
S.current.rescan
|
||||
final List<WalletMenuItem> menuItems = [
|
||||
WalletMenuItem(
|
||||
title: S.current.wallet_list_load_wallet,
|
||||
firstGradientColor: Palette.cornflower,
|
||||
secondGradientColor: Palette.royalBlue,
|
||||
image: Image.asset('assets/images/load.png',
|
||||
height: 24, width: 24, color: Colors.white)),
|
||||
WalletMenuItem(
|
||||
title: S.current.show_seed,
|
||||
firstGradientColor: Palette.moderateOrangeYellow,
|
||||
secondGradientColor: Palette.moderateOrange,
|
||||
image: Image.asset('assets/images/eye_action.png',
|
||||
height: 24, width: 24, color: Colors.white)),
|
||||
WalletMenuItem(
|
||||
title: S.current.remove,
|
||||
firstGradientColor: Palette.lightRed,
|
||||
secondGradientColor: Palette.persianRed,
|
||||
image: Image.asset('assets/images/trash.png',
|
||||
height: 24, width: 24, color: Colors.white)),
|
||||
WalletMenuItem(
|
||||
title: S.current.rescan,
|
||||
firstGradientColor: Palette.shineGreen,
|
||||
secondGradientColor: Palette.moderateGreen,
|
||||
image: Image.asset('assets/images/scanner.png',
|
||||
height: 24, width: 24, color: Colors.white))
|
||||
];
|
||||
|
||||
final List<Color> firstColors = [
|
||||
Palette.cornflower,
|
||||
Palette.moderateOrangeYellow,
|
||||
Palette.lightRed,
|
||||
Palette.shineGreen
|
||||
];
|
||||
List<WalletMenuItem> generateItemsForWalletMenu(bool isCurrentWallet) {
|
||||
final items = List<WalletMenuItem>();
|
||||
|
||||
final List<Color> secondColors = [
|
||||
Palette.royalBlue,
|
||||
Palette.moderateOrange,
|
||||
Palette.persianRed,
|
||||
Palette.moderateGreen
|
||||
];
|
||||
|
||||
final List<Image> listImages = [
|
||||
Image.asset('assets/images/load.png',
|
||||
height: 24, width: 24, color: Colors.white),
|
||||
Image.asset('assets/images/eye_action.png',
|
||||
height: 24, width: 24, color: Colors.white),
|
||||
Image.asset('assets/images/trash.png',
|
||||
height: 24, width: 24, color: Colors.white),
|
||||
Image.asset('assets/images/scanner.png',
|
||||
height: 24, width: 24, color: Colors.white)
|
||||
];
|
||||
|
||||
List<String> generateItemsForWalletMenu(bool isCurrentWallet) {
|
||||
final items = List<String>();
|
||||
|
||||
if (!isCurrentWallet) items.add(listItems[0]);
|
||||
if (isCurrentWallet) items.add(listItems[1]);
|
||||
if (!isCurrentWallet) items.add(listItems[2]);
|
||||
if (isCurrentWallet) items.add(listItems[3]);
|
||||
if (!isCurrentWallet) items.add(menuItems[0]);
|
||||
if (isCurrentWallet) items.add(menuItems[1]);
|
||||
if (!isCurrentWallet) items.add(menuItems[2]);
|
||||
if (isCurrentWallet) items.add(menuItems[3]);
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
List<Color> generateColorsForWalletMenu(bool isCurrentWallet) {
|
||||
final colors = <Color>[];
|
||||
|
||||
if (!isCurrentWallet) {
|
||||
colors.add(firstColors[0]);
|
||||
colors.add(secondColors[0]);
|
||||
}
|
||||
if (isCurrentWallet) {
|
||||
colors.add(firstColors[1]);
|
||||
colors.add(secondColors[1]);
|
||||
}
|
||||
if (!isCurrentWallet) {
|
||||
colors.add(firstColors[2]);
|
||||
colors.add(secondColors[2]);
|
||||
}
|
||||
if (isCurrentWallet) {
|
||||
colors.add(firstColors[3]);
|
||||
colors.add(secondColors[3]);
|
||||
}
|
||||
|
||||
return colors;
|
||||
}
|
||||
|
||||
List<Image> generateImagesForWalletMenu(bool isCurrentWallet) {
|
||||
final images = <Image>[];
|
||||
|
||||
if (!isCurrentWallet) images.add(listImages[0]);
|
||||
if (isCurrentWallet) images.add(listImages[1]);
|
||||
if (!isCurrentWallet) images.add(listImages[2]);
|
||||
if (isCurrentWallet) images.add(listImages[3]);
|
||||
|
||||
return images;
|
||||
}
|
||||
|
||||
Future<void> action(
|
||||
int index, WalletListItem wallet, bool isCurrentWallet) async {
|
||||
int index, WalletListItem wallet) async {
|
||||
switch (index) {
|
||||
case 0:
|
||||
await Navigator.of(context).pushNamed(Routes.auth, arguments:
|
||||
@@ -126,7 +87,7 @@ class WalletMenu {
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
final isComfirmed = await showDialog<bool>(
|
||||
final isComfirmed = await showPopUp<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertWithTwoActions(
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class WalletMenuItem {
|
||||
WalletMenuItem({
|
||||
@required this.title,
|
||||
@required this.firstGradientColor,
|
||||
@required this.secondGradientColor,
|
||||
@required this.image
|
||||
});
|
||||
|
||||
final String title;
|
||||
final Color firstGradientColor;
|
||||
final Color secondGradientColor;
|
||||
final Image image;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_list/wallet_menu_item.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
|
||||
class WalletMenuAlert extends StatelessWidget {
|
||||
WalletMenuAlert({
|
||||
@required this.wallet,
|
||||
@required this.walletMenu,
|
||||
@required this.items
|
||||
});
|
||||
|
||||
final WalletListItem wallet;
|
||||
final WalletMenu walletMenu;
|
||||
final List<WalletMenuItem> items;
|
||||
final closeButton = Image.asset('assets/images/close.png',
|
||||
color: Palette.darkBlueCraiola,
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertBackground(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 24,
|
||||
right: 24,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
||||
child: Container(
|
||||
color: Theme.of(context).textTheme.body2.decorationColor,
|
||||
padding: EdgeInsets.only(left: 24),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: items.length,
|
||||
separatorBuilder: (context, _) => Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).accentTextTheme.subhead.backgroundColor,
|
||||
),
|
||||
itemBuilder: (_, index) {
|
||||
final item = items[index];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
walletMenu.action(
|
||||
walletMenu.menuItems.indexOf(item),
|
||||
wallet);
|
||||
},
|
||||
child: Container(
|
||||
height: 60,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 32,
|
||||
width: 32,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(4)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
item.firstGradientColor,
|
||||
item.secondGradientColor
|
||||
]
|
||||
)
|
||||
),
|
||||
child: Center(
|
||||
child: item.image,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.title,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
fontSize: 18,
|
||||
fontFamily: 'Poppins',
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.none
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
AlertCloseButton(image: closeButton)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class WalletTile extends SliverPersistentHeaderDelegate {
|
||||
WalletTile({
|
||||
@required this.min,
|
||||
@required this.max,
|
||||
@required this.image,
|
||||
@required this.walletName,
|
||||
@required this.walletAddress,
|
||||
@required this.isCurrent
|
||||
});
|
||||
|
||||
final double min;
|
||||
final double max;
|
||||
final Image image;
|
||||
final String walletName;
|
||||
final String walletAddress;
|
||||
final bool isCurrent;
|
||||
final double tileHeight = 60;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
var opacity = 1 - shrinkOffset / (max - min);
|
||||
opacity = opacity >= 0 ? opacity : 0;
|
||||
|
||||
var panelWidth = 10 * opacity;
|
||||
panelWidth = panelWidth < 10 ? 0 : 10;
|
||||
|
||||
final currentColor = isCurrent
|
||||
? Theme.of(context).accentTextTheme.subtitle.decorationColor
|
||||
: Theme.of(context).backgroundColor;
|
||||
|
||||
return Stack(
|
||||
fit: StackFit.expand,
|
||||
overflow: Overflow.visible,
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: max - 4,
|
||||
child: Container(
|
||||
height: tileHeight,
|
||||
width: 4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topRight: Radius.circular(4), bottomRight: Radius.circular(4)),
|
||||
color: currentColor
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 10,
|
||||
child: Container(
|
||||
height: tileHeight,
|
||||
width: max - 14,
|
||||
padding: EdgeInsets.only(left: 20, right: 20),
|
||||
color: Theme.of(context).backgroundColor,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Row(
|
||||
//mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
image,
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
walletName,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
/*Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
image,
|
||||
SizedBox(width: 10),
|
||||
Text(
|
||||
walletName,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context).primaryTextTheme.title.color
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
isCurrent ? SizedBox(height: 5) : Offstage(),
|
||||
isCurrent
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
SizedBox(width: 34),
|
||||
Text(
|
||||
walletAddress,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Offstage()
|
||||
],
|
||||
),*/
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: Opacity(
|
||||
opacity: opacity,
|
||||
child: Container(
|
||||
height: tileHeight,
|
||||
width: panelWidth,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Theme.of(context).accentTextTheme.headline.color,
|
||||
Theme.of(context).accentTextTheme.headline.backgroundColor
|
||||
]
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
double get maxExtent => max;
|
||||
|
||||
@override
|
||||
double get minExtent => min;
|
||||
|
||||
@override
|
||||
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) => true;
|
||||
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class WelcomePage extends BasePage {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: PrimaryImageButton(
|
||||
onPressed: () => Navigator.pushNamed(context, Routes.newWalletFromWelcome),
|
||||
onPressed: () => Navigator.pushNamed(context, Routes.newWallet),
|
||||
image: newWalletImage,
|
||||
text: S.of(context).create_new,
|
||||
color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
|
||||
@@ -113,7 +113,7 @@ class WelcomePage extends BasePage {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: PrimaryImageButton(
|
||||
onPressed: () => Navigator.pushNamed(context, Routes.restoreWalletOptionsFromWelcome),
|
||||
onPressed: () => Navigator.pushNamed(context, Routes.restoreWalletOptions),
|
||||
image: restoreWalletImage,
|
||||
text: S.of(context).restore_wallet,
|
||||
color: Theme.of(context).accentTextTheme.caption.color,
|
||||
|
||||
@@ -8,7 +8,7 @@ class AlertCloseButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Positioned(
|
||||
bottom: 24,
|
||||
bottom: 60,
|
||||
child: GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
|
||||
@@ -35,7 +36,7 @@ class SeedLanguageSelectorState extends State<SeedLanguageSelector> {
|
||||
image: null,
|
||||
text: seedLocales[seedLanguages.indexOf(selected)],
|
||||
onTap: () async {
|
||||
final selected = await showDialog<String>(
|
||||
final selected = await showPopUp<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) =>
|
||||
SeedLanguagePicker(key: _pickerKey, selected: this.selected));
|
||||
|
||||
Reference in New Issue
Block a user