Fixes

M committed Sep 30, 2020 at 21:23 UTC fe147ff9eda0fef9c4bb277773788dfc0cfd501f
49 files changed +699 -728
ios/Flutter/.last_build_id
+1 -1
@@ -1 +1 @@
1 -bc336703210c48e30d7216fac3fe1c0f
\ No newline at end of file
1 +4dc2ef1ba73deeed13cd85894dacb10b
\ No newline at end of file
ios/Runner.xcodeproj/project.pbxproj
+3 -3
@@ -354,7 +354,7 @@
354 buildSettings = {
355 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
356 CLANG_ENABLE_MODULES = YES;
357 - CURRENT_PROJECT_VERSION = 2;
357 + CURRENT_PROJECT_VERSION = 3;
358 DEVELOPMENT_TEAM = 32J6BB6VUS;
359 ENABLE_BITCODE = NO;
360 FRAMEWORK_SEARCH_PATHS = (
@@ -493,7 +493,7 @@
493 buildSettings = {
494 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
495 CLANG_ENABLE_MODULES = YES;
496 - CURRENT_PROJECT_VERSION = 2;
496 + CURRENT_PROJECT_VERSION = 3;
497 DEVELOPMENT_TEAM = 32J6BB6VUS;
498 ENABLE_BITCODE = NO;
499 FRAMEWORK_SEARCH_PATHS = (
@@ -526,7 +526,7 @@
526 buildSettings = {
527 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
528 CLANG_ENABLE_MODULES = YES;
529 - CURRENT_PROJECT_VERSION = 2;
529 + CURRENT_PROJECT_VERSION = 3;
530 DEVELOPMENT_TEAM = 32J6BB6VUS;
531 ENABLE_BITCODE = NO;
532 FRAMEWORK_SEARCH_PATHS = (
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
+18 -39
@@ -1,117 +1,96 @@
1 {
2 "images" : [
3 {
4 - "size" : "20x20",
4 "idiom" : "iphone",
6 - "filename" : "Icon-App-20x20@2x.png",
5 + "size" : "20x20",
6 "scale" : "2x"
7 },
8 {
10 - "size" : "20x20",
9 "idiom" : "iphone",
12 - "filename" : "Icon-App-20x20@3x.png",
10 + "size" : "20x20",
11 "scale" : "3x"
12 },
13 {
16 - "size" : "29x29",
14 "idiom" : "iphone",
18 - "filename" : "Icon-App-29x29@1x.png",
19 - "scale" : "1x"
20 - },
21 - {
15 "size" : "29x29",
23 - "idiom" : "iphone",
24 - "filename" : "Icon-App-29x29@2x.png",
16 "scale" : "2x"
17 },
18 {
28 - "size" : "29x29",
19 "idiom" : "iphone",
30 - "filename" : "Icon-App-29x29@3x.png",
20 + "size" : "29x29",
21 "scale" : "3x"
22 },
23 {
34 - "size" : "40x40",
24 "idiom" : "iphone",
36 - "filename" : "Icon-App-40x40@2x.png",
25 + "size" : "40x40",
26 "scale" : "2x"
27 },
28 {
40 - "size" : "40x40",
29 "idiom" : "iphone",
42 - "filename" : "Icon-App-40x40@3x.png",
30 + "size" : "40x40",
31 "scale" : "3x"
32 },
33 {
34 "size" : "60x60",
35 "idiom" : "iphone",
48 - "filename" : "Icon-App-60x60@2x.png",
36 + "filename" : "cake_xmr_120.png",
37 "scale" : "2x"
38 },
39 {
40 "size" : "60x60",
41 "idiom" : "iphone",
54 - "filename" : "Icon-App-60x60@3x.png",
42 + "filename" : "cake_xmr_180.png",
43 "scale" : "3x"
44 },
45 {
58 - "size" : "20x20",
46 "idiom" : "ipad",
60 - "filename" : "Icon-App-20x20@1x.png",
47 + "size" : "20x20",
48 "scale" : "1x"
49 },
50 {
64 - "size" : "20x20",
51 "idiom" : "ipad",
66 - "filename" : "Icon-App-20x20@2x.png",
52 + "size" : "20x20",
53 "scale" : "2x"
54 },
55 {
70 - "size" : "29x29",
56 "idiom" : "ipad",
72 - "filename" : "Icon-App-29x29@1x.png",
57 + "size" : "29x29",
58 "scale" : "1x"
59 },
60 {
76 - "size" : "29x29",
61 "idiom" : "ipad",
78 - "filename" : "Icon-App-29x29@2x.png",
62 + "size" : "29x29",
63 "scale" : "2x"
64 },
65 {
82 - "size" : "40x40",
66 "idiom" : "ipad",
84 - "filename" : "Icon-App-40x40@1x.png",
67 + "size" : "40x40",
68 "scale" : "1x"
69 },
70 {
88 - "size" : "40x40",
71 "idiom" : "ipad",
90 - "filename" : "Icon-App-40x40@2x.png",
72 + "size" : "40x40",
73 "scale" : "2x"
74 },
75 {
94 - "size" : "76x76",
76 "idiom" : "ipad",
96 - "filename" : "Icon-App-76x76@1x.png",
77 + "size" : "76x76",
78 "scale" : "1x"
79 },
80 {
100 - "size" : "76x76",
81 "idiom" : "ipad",
102 - "filename" : "Icon-App-76x76@2x.png",
82 + "size" : "76x76",
83 "scale" : "2x"
84 },
85 {
106 - "size" : "83.5x83.5",
86 "idiom" : "ipad",
108 - "filename" : "Icon-App-83.5x83.5@2x.png",
87 + "size" : "83.5x83.5",
88 "scale" : "2x"
89 },
90 {
91 "size" : "1024x1024",
92 "idiom" : "ios-marketing",
114 - "filename" : "Icon-App-1024x1024@1x.png",
93 + "filename" : "cake_xmr_1024.png",
94 "scale" : "1x"
95 }
96 ],
@@ -119,4 +98,4 @@
98 "version" : 1,
99 "author" : "xcode"
100 }
122 -}
101 +}
\ No newline at end of file
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png differ
lib/entities/node.dart
+6 -1
@@ -39,12 +39,17 @@ class Node extends HiveObject with Keyable {
39 int typeRaw;
40
41 @override
42 - dynamic get keyIndex => key;
42 + dynamic get keyIndex {
43 + _keyIndex ??= key;
44 + return _keyIndex;
45 + }
46
47 WalletType get type => deserializeFromInt(typeRaw);
48
49 set type(WalletType type) => typeRaw = serializeToInt(type);
50
51 + dynamic _keyIndex;
52 +
53 Future<bool> requestNode() async {
54 try {
55 switch (type) {
lib/entities/node_list.dart
+3 -3
@@ -39,9 +39,9 @@ Future<List<Node>> loadElectrumServerList() async {
39
40 Future resetToDefault(Box<Node> nodeSource) async {
41 final moneroNodes = await loadDefaultNodes();
42 - final bitcoinElectrumServerList = await loadElectrumServerList();
43 - final nodes = moneroNodes + bitcoinElectrumServerList;
42 + // final bitcoinElectrumServerList = await loadElectrumServerList();
43 + // final nodes = moneroNodes + bitcoinElectrumServerList;
44
45 await nodeSource.clear();
46 - await nodeSource.addAll(nodes);
46 + await nodeSource.addAll(moneroNodes);
47 }
lib/monero/monero_subaddress_list.dart
+16 -2
@@ -39,8 +39,22 @@ abstract class MoneroSubaddressListBase with Store {
39 }
40
41 List<Subaddress> getAll() {
42 - return subaddress_list
43 - .getAllSubaddresses()
42 + final subaddresses = subaddress_list.getAllSubaddresses();
43 + if (subaddresses.length > 1) {
44 + // final primary = subaddresses.first;
45 + // final last = subaddresses.last;
46 + // subaddresses[subaddresses.length - 1] = primary;
47 + // subaddresses[0] = last;
48 +
49 + // for (var i = subaddresses.length - 1; i >= 0; i--) {
50 + // final pre = subaddresses[i];
51 + // final post = subaddresses[subaddresses.length - i];
52 + // subaddresses[subaddresses.length - i] = pre;
53 + // subaddresses[i] = post;
54 + // }
55 + }
56 +
57 + return subaddresses
58 .map((subaddressRow) => Subaddress.fromRow(subaddressRow))
59 .toList();
60 }
lib/monero/monero_wallet_service.dart
+1 -1
@@ -88,7 +88,7 @@ class MoneroWalletService extends WalletService<
88 Future<MoneroWallet> openWallet(String name, String password) async {
89 try {
90 final path = await pathForWallet(name: name, type: WalletType.monero);
91 - monero_wallet_manager.openWallet(path: path, password: password);
91 + await monero_wallet_manager.openWalletAsync({'path': path, 'password': password});
92 final walletInfo = walletInfoSource.values.firstWhere(
93 (info) => info.id == WalletBase.idFor(name, WalletType.monero), orElse: () => null);
94 final wallet = MoneroWallet(
lib/monero/subaddress.dart
+4 -1
@@ -11,7 +11,10 @@ class Subaddress {
11 Subaddress.fromRow(SubaddressRow row)
12 : this.id = row.getId(),
13 this.address = row.getAddress(),
14 - this.label = row.getLabel();
14 + this.label = row.getId() == 0 &&
15 + row.getLabel().toLowerCase() == 'Primary account'.toLowerCase()
16 + ? 'Primary address'
17 + : row.getLabel();
18
19 final int id;
20 final String address;
lib/src/screens/auth/auth_page.dart
+44 -43
@@ -1,3 +1,5 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 +import 'package:flushbar/flushbar.dart';
3 import 'package:mobx/mobx.dart';
4 import 'package:flutter/material.dart';
5 import 'package:flutter/cupertino.dart';
@@ -29,6 +31,8 @@ class AuthPageState extends State<AuthPage> {
31 final _backArrowImageDarkTheme =
32 Image.asset('assets/images/close_button.png');
33 ReactionDisposer _reaction;
34 + Flushbar<void> _authBar;
35 + Flushbar<void> _progressBar;
36
37 @override
38 void initState() {
@@ -39,37 +43,26 @@ class AuthPageState extends State<AuthPage> {
43 if (widget.onAuthenticationFinished != null) {
44 widget.onAuthenticationFinished(true, this);
45 } else {
42 - _key.currentState.showSnackBar(
43 - SnackBar(
44 - content: Text(S.of(context).authenticated),
45 - backgroundColor: Colors.green,
46 - ),
47 - );
46 + _authBar?.dismiss();
47 + showBar<void>(context, S.of(context).authenticated);
48 }
49 });
50 }
51
52 if (state is IsExecutingState) {
53 WidgetsBinding.instance.addPostFrameCallback((_) {
54 - _key.currentState.showSnackBar(
55 - SnackBar(
56 - content: Text(S.of(context).authentication),
57 - backgroundColor: Colors.green,
58 - ),
59 - );
54 + _authBar =
55 + createBar<void>(S.of(context).authentication, duration: null)
56 + ..show(context);
57 });
58 }
59
60 if (state is FailureState) {
61 WidgetsBinding.instance.addPostFrameCallback((_) {
62 _pinCodeKey.currentState.clear();
66 - _key.currentState.hideCurrentSnackBar();
67 - _key.currentState.showSnackBar(
68 - SnackBar(
69 - content: Text(S.of(context).failed_authentication(state.error)),
70 - backgroundColor: Colors.red,
71 - ),
72 - );
63 + _authBar?.dismiss();
64 + showBar<void>(
65 + context, S.of(context).failed_authentication(state.error));
66
67 if (widget.onAuthenticationFinished != null) {
68 widget.onAuthenticationFinished(false, this);
@@ -80,13 +73,9 @@ class AuthPageState extends State<AuthPage> {
73 if (state is AuthenticationBanned) {
74 WidgetsBinding.instance.addPostFrameCallback((_) {
75 _pinCodeKey.currentState.clear();
83 - _key.currentState.hideCurrentSnackBar();
84 - _key.currentState.showSnackBar(
85 - SnackBar(
86 - content: Text(S.of(context).failed_authentication(state.error)),
87 - backgroundColor: Colors.red,
88 - ),
89 - );
76 + _authBar?.dismiss();
77 + showBar<void>(
78 + context, S.of(context).failed_authentication(state.error));
79
80 if (widget.onAuthenticationFinished != null) {
81 widget.onAuthenticationFinished(false, this);
@@ -111,10 +100,22 @@ class AuthPageState extends State<AuthPage> {
100 super.dispose();
101 }
102
114 - void changeProcessText(String text) => _key.currentState.showSnackBar(
115 - SnackBar(content: Text(text), backgroundColor: Colors.green));
103 + void changeProcessText(String text) {
104 + _authBar?.dismiss();
105 + _progressBar = createBar<void>(text, duration: null)
106 + ..show(_key.currentContext);
107 + }
108 +
109 + void hideProgressText() {
110 + _progressBar?.dismiss();
111 + _progressBar = null;
112 + }
113
117 - void close() => Navigator.of(_key.currentContext).pop();
114 + void close() {
115 + _authBar?.dismiss();
116 + _progressBar?.dismiss();
117 + Navigator.of(_key.currentContext).pop();
118 + }
119
120 @override
121 Widget build(BuildContext context) {
@@ -123,20 +124,20 @@ class AuthPageState extends State<AuthPage> {
124 appBar: CupertinoNavigationBar(
125 leading: widget.closable
126 ? Container(
126 - padding: EdgeInsets.only(top: 10),
127 - child: SizedBox(
128 - height: 37,
129 - width: 37,
130 - child: ButtonTheme(
131 - minWidth: double.minPositive,
132 - child: FlatButton(
133 - highlightColor: Colors.transparent,
134 - splashColor: Colors.transparent,
135 - padding: EdgeInsets.all(0),
136 - onPressed: () => Navigator.of(context).pop(),
137 - child: _backArrowImageDarkTheme),
138 - ),
139 - ))
127 + padding: EdgeInsets.only(top: 10),
128 + child: SizedBox(
129 + height: 37,
130 + width: 37,
131 + child: ButtonTheme(
132 + minWidth: double.minPositive,
133 + child: FlatButton(
134 + highlightColor: Colors.transparent,
135 + splashColor: Colors.transparent,
136 + padding: EdgeInsets.all(0),
137 + onPressed: () => Navigator.of(context).pop(),
138 + child: _backArrowImageDarkTheme),
139 + ),
140 + ))
141 : Container(),
142 backgroundColor: Theme.of(context).backgroundColor,
143 border: null),
lib/src/screens/contact/contact_list_page.dart
+3 -20
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 import 'package:cake_wallet/utils/show_pop_up.dart';
3 import 'package:flutter/material.dart';
4 import 'package:flutter/cupertino.dart';
@@ -56,16 +57,6 @@ class ContactListPage extends BasePage {
57
58 @override
59 Widget body(BuildContext context) {
59 - final shortDivider = Container(
60 - height: 1,
61 - padding: EdgeInsets.only(left: 24),
62 - color: Theme.of(context).backgroundColor,
63 - child: Container(
64 - height: 1,
65 - color: Theme.of(context).primaryTextTheme.title.backgroundColor,
66 - ),
67 - );
68 -
60 return Container(
61 padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
62 child: Observer(
@@ -92,16 +83,8 @@ class ContactListPage extends BasePage {
83 if (isCopied != null && isCopied) {
84 await Clipboard.setData(
85 ClipboardData(text: contact.address));
95 - Scaffold.of(context).showSnackBar(
96 - SnackBar(
97 - content: Text(
98 - S.of(context).copied_to_clipboard,
99 - style: TextStyle(color: Colors.white),
100 - ),
101 - backgroundColor: Colors.green,
102 - duration: Duration(milliseconds: 1500),
103 - ),
104 - );
86 + await showBar<void>(context,
87 + S.of(context).copied_to_clipboard);
88 }
89 },
90 child: Column(
lib/src/screens/dashboard/wallet_menu.dart
+10 -5
@@ -13,6 +13,7 @@ class WalletMenu {
13
14 final List<String> items = [
15 S.current.reconnect,
16 + S.current.rescan,
17 S.current.wallets,
18 S.current.nodes,
19 S.current.show_seed,
@@ -23,6 +24,7 @@ class WalletMenu {
24
25 final List<Image> images = [
26 Image.asset('assets/images/reconnect_menu.png', height: 16, width: 16),
27 + Image.asset('assets/images/filter_icon.png', height: 16, width: 16),
28 Image.asset('assets/images/wallet_menu.png', height: 16, width: 16),
29 Image.asset('assets/images/nodes_menu.png', height: 16, width: 16),
30 Image.asset('assets/images/eye_menu.png', height: 16, width: 16),
@@ -40,12 +42,15 @@ class WalletMenu {
42 _presentReconnectAlert(context);
43 break;
44 case 1:
43 - Navigator.of(context).pushNamed(Routes.walletList);
45 + Navigator.of(context).pushNamed(Routes.rescan);
46 break;
47 case 2:
46 - Navigator.of(context).pushNamed(Routes.nodeList);
48 + Navigator.of(context).pushNamed(Routes.walletList);
49 break;
50 case 3:
51 + Navigator.of(context).pushNamed(Routes.nodeList);
52 + break;
53 + case 4:
54 Navigator.of(context).pushNamed(Routes.auth,
55 arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) =>
56 isAuthenticatedSuccessfully
@@ -53,7 +58,7 @@ class WalletMenu {
58 : null);
59
60 break;
56 - case 4:
61 + case 5:
62 Navigator.of(context).pushNamed(Routes.auth,
63 arguments: (bool isAuthenticatedSuccessfully, AuthPageState auth) =>
64 isAuthenticatedSuccessfully
@@ -61,10 +66,10 @@ class WalletMenu {
66 .popAndPushNamed(Routes.showKeys)
67 : null);
68 break;
64 - case 5:
69 + case 6:
70 Navigator.of(context).pushNamed(Routes.addressBook);
71 break;
67 - case 6:
72 + case 7:
73 Navigator.of(context).pushNamed(Routes.settings);
74 break;
75 default:
lib/src/screens/exchange/widgets/exchange_card.dart
+3 -8
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 import 'package:cake_wallet/utils/show_pop_up.dart';
3 import 'package:flutter/services.dart';
4 import 'package:flutter/material.dart';
@@ -270,14 +271,8 @@ class ExchangeCardState extends State<ExchangeCard> {
271 onTap: () {
272 Clipboard.setData(
273 ClipboardData(text: addressController.text));
273 - Scaffold.of(context).showSnackBar(SnackBar(
274 - content: Text(
275 - S.of(context).copied_to_clipboard,
276 - style: TextStyle(color: Colors.white),
277 - ),
278 - backgroundColor: Colors.green,
279 - duration: Duration(milliseconds: 500),
280 - ));
274 + showBar<void>(context,
275 + S.of(context).copied_to_clipboard);
276 },
277 child: Row(
278 mainAxisSize: MainAxisSize.max,
lib/src/screens/exchange_trade/exchange_confirm_page.dart
+77 -83
@@ -1,4 +1,5 @@
1 import 'package:cake_wallet/store/dashboard/trades_store.dart';
2 +import 'package:cake_wallet/utils/show_bar.dart';
3 import 'package:flutter/material.dart';
4 import 'package:flutter/cupertino.dart';
5 import 'package:flutter/services.dart';
@@ -25,91 +26,84 @@ class ExchangeConfirmPage extends BasePage {
26 children: <Widget>[
27 Expanded(
28 child: Column(
28 - children: <Widget>[
29 - Flexible(
30 - child: Center(
31 - child: Text(
32 - S.of(context).exchange_result_write_down_trade_id,
33 - textAlign: TextAlign.center,
34 - style: TextStyle(
35 - fontSize: 18.0,
36 - fontWeight: FontWeight.w500,
37 - color: Theme.of(context).primaryTextTheme.title.color),
38 - ),
39 - )
40 - ),
41 - Container(
42 - height: 178,
43 - decoration: BoxDecoration(
44 - borderRadius: BorderRadius.all(Radius.circular(30)),
45 - border: Border.all(
29 + children: <Widget>[
30 + Flexible(
31 + child: Center(
32 + child: Text(
33 + S.of(context).exchange_result_write_down_trade_id,
34 + textAlign: TextAlign.center,
35 + style: TextStyle(
36 + fontSize: 18.0,
37 + fontWeight: FontWeight.w500,
38 + color: Theme.of(context).primaryTextTheme.title.color),
39 + ),
40 + )),
41 + Container(
42 + height: 178,
43 + decoration: BoxDecoration(
44 + borderRadius: BorderRadius.all(Radius.circular(30)),
45 + border: Border.all(
46 width: 1,
47 - color: Theme.of(context).accentTextTheme.caption.color
48 - ),
49 - color: Theme.of(context).accentTextTheme.title.color
50 - ),
51 - child: Column(
52 - children: <Widget>[
53 - Expanded(
54 - child: Padding(
55 - padding: EdgeInsets.all(24),
56 - child: Column(
57 - mainAxisAlignment: MainAxisAlignment.spaceBetween,
58 - crossAxisAlignment: CrossAxisAlignment.center,
59 - children: <Widget>[
60 - Text(
61 - S.of(context).trade_id,
62 - style: TextStyle(
63 - fontSize: 12.0,
64 - fontWeight: FontWeight.w500,
65 - color: Theme.of(context).primaryTextTheme.overline.color
66 - ),
67 - ),
68 - Text(
69 - trade.id,
70 - maxLines: 1,
71 - overflow: TextOverflow.ellipsis,
72 - style: TextStyle(
73 - fontSize: 20,
74 - fontWeight: FontWeight.w600,
75 - color: Theme.of(context).primaryTextTheme.title.color
76 - ),
77 - ),
78 - ],
79 - ),
80 - )
81 - ),
82 - Padding(
83 - padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
84 - child: Builder(
85 - builder: (context) => PrimaryButton(
86 - onPressed: () {
87 - Clipboard.setData(ClipboardData(text: trade.id));
88 - Scaffold.of(context).showSnackBar(SnackBar(
89 - content: Text(
90 - S.of(context).copied_to_clipboard,
91 - textAlign: TextAlign.center,
92 - style: TextStyle(color: Colors.white),
93 - ),
94 - backgroundColor: Colors.green,
95 - duration: Duration(milliseconds: 1500),
96 - ));
97 - },
98 - text: S.of(context).copy_id,
99 - color: Theme.of(context).accentTextTheme.caption.backgroundColor,
100 - textColor: Theme.of(context).primaryTextTheme.title.color
101 - ),
47 + color: Theme.of(context).accentTextTheme.caption.color),
48 + color: Theme.of(context).accentTextTheme.title.color),
49 + child: Column(
50 + children: <Widget>[
51 + Expanded(
52 + child: Padding(
53 + padding: EdgeInsets.all(24),
54 + child: Column(
55 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
56 + crossAxisAlignment: CrossAxisAlignment.center,
57 + children: <Widget>[
58 + Text(
59 + S.of(context).trade_id,
60 + style: TextStyle(
61 + fontSize: 12.0,
62 + fontWeight: FontWeight.w500,
63 + color: Theme.of(context)
64 + .primaryTextTheme
65 + .overline
66 + .color),
67 + ),
68 + Text(
69 + trade.id,
70 + maxLines: 1,
71 + overflow: TextOverflow.ellipsis,
72 + style: TextStyle(
73 + fontSize: 20,
74 + fontWeight: FontWeight.w600,
75 + color: Theme.of(context)
76 + .primaryTextTheme
77 + .title
78 + .color),
79 ),
103 - )
104 - ],
105 - ),
106 - ),
107 - Flexible(
108 - child: Offstage()
109 - ),
110 - ],
111 - )
112 - ),
80 + ],
81 + ),
82 + )),
83 + Padding(
84 + padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
85 + child: Builder(
86 + builder: (context) => PrimaryButton(
87 + onPressed: () {
88 + Clipboard.setData(ClipboardData(text: trade.id));
89 + showBar<void>(
90 + context, S.of(context).copied_to_clipboard);
91 + },
92 + text: S.of(context).copy_id,
93 + color: Theme.of(context)
94 + .accentTextTheme
95 + .caption
96 + .backgroundColor,
97 + textColor:
98 + Theme.of(context).primaryTextTheme.title.color),
99 + ),
100 + )
101 + ],
102 + ),
103 + ),
104 + Flexible(child: Offstage()),
105 + ],
106 + )),
107 PrimaryButton(
108 onPressed: () => Navigator.of(context)
109 .pushReplacementNamed(Routes.exchangeTrade),
lib/src/screens/exchange_trade/exchange_trade_page.dart
+128 -120
@@ -4,6 +4,7 @@ import 'package:cake_wallet/exchange/exchange_provider_description.dart';
4 import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_item.dart';
5 import 'package:cake_wallet/src/screens/exchange_trade/information_page.dart';
6 import 'package:cake_wallet/src/widgets/standart_list_row.dart';
7 +import 'package:cake_wallet/utils/show_bar.dart';
8 import 'package:cake_wallet/utils/show_pop_up.dart';
9 import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
10 import 'package:mobx/mobx.dart';
@@ -13,6 +14,7 @@ import 'package:flutter/material.dart';
14 import 'package:flutter/cupertino.dart';
15 import 'package:flutter/services.dart';
16 import 'package:cake_wallet/generated/i18n.dart';
17 +
18 // import 'package:cake_wallet/src/stores/exchange_trade/exchange_trade_store.dart';
19 // import 'package:cake_wallet/src/stores/send/send_store.dart';
20 // import 'package:cake_wallet/src/stores/send/sending_state.dart';
@@ -25,23 +27,21 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
27 import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
28 import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
29
28 -void showInformation(ExchangeTradeViewModel exchangeTradeViewModel, BuildContext context) {
30 +void showInformation(
31 + ExchangeTradeViewModel exchangeTradeViewModel, BuildContext context) {
32 final fetchingLabel = S.current.fetching;
33 final trade = exchangeTradeViewModel.trade;
34 final walletName = exchangeTradeViewModel.wallet.name;
35
36 final information = exchangeTradeViewModel.isSendable
37 ? S.current.exchange_result_confirm(
35 - trade.amount ?? fetchingLabel,
36 - trade.from.toString(),
37 - walletName)
38 + trade.amount ?? fetchingLabel, trade.from.toString(), walletName)
39 : S.current.exchange_result_description(
39 - trade.amount ?? fetchingLabel, trade.from.toString());
40 + trade.amount ?? fetchingLabel, trade.from.toString());
41
42 showPopUp<void>(
42 - context: context,
43 - builder: (_) => InformationPage(information: information)
44 - );
43 + context: context,
44 + builder: (_) => InformationPage(information: information));
45 }
46
47 class ExchangeTradePage extends BasePage {
@@ -73,7 +73,8 @@ class ExchangeTradePage extends BasePage {
73 }
74
75 @override
76 - Widget body(BuildContext context) => ExchangeTradeForm(exchangeTradeViewModel);
76 + Widget body(BuildContext context) =>
77 + ExchangeTradeForm(exchangeTradeViewModel);
78 }
79
80 class ExchangeTradeForm extends StatefulWidget {
@@ -87,6 +88,7 @@ class ExchangeTradeForm extends StatefulWidget {
88
89 class ExchangeTradeState extends State<ExchangeTradeForm> {
90 final fetchingLabel = S.current.fetching;
91 +
92 String get title => S.current.exchange;
93
94 bool _effectsInstalled = false;
@@ -104,127 +106,133 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
106 @override
107 Widget build(BuildContext context) {
108 final copyImage = Image.asset('assets/images/copy_content.png',
107 - height: 16, width: 16,
109 + height: 16,
110 + width: 16,
111 color: Theme.of(context).primaryTextTheme.overline.color);
112
113 //_setEffects(context);
114
115 return Container(
116 child: ScrollableWithBottomSection(
114 - contentPadding: EdgeInsets.only(top: 10, bottom: 16),
115 - content: Observer(builder: (_) {
116 - final trade = widget.exchangeTradeViewModel.trade;
117 -
118 - return Column(
119 - children: <Widget>[
120 - trade.expiredAt != null
121 - ? Row(
122 - mainAxisSize: MainAxisSize.max,
123 - mainAxisAlignment: MainAxisAlignment.center,
124 - children: <Widget>[
125 - Text(
126 - S.of(context).offer_expires_in,
127 - style: TextStyle(
128 - fontSize: 14.0,
129 - fontWeight: FontWeight.w500,
130 - color: Theme.of(context).primaryTextTheme.overline.color),
131 - ),
132 - TimerWidget(trade.expiredAt,
133 - color: Theme.of(context).primaryTextTheme.title.color)
134 - ])
135 - : Offstage(),
136 - Padding(
137 - padding: EdgeInsets.only(top: 32),
138 - child: Row(children: <Widget>[
139 - Spacer(flex: 3),
140 - Flexible(
141 - flex: 4,
142 - child: Center(
143 - child: AspectRatio(
144 - aspectRatio: 1.0,
145 - child: QrImage(
146 - data: trade.inputAddress ?? fetchingLabel,
147 - backgroundColor: Colors.transparent,
148 - foregroundColor: Theme.of(context)
149 - .accentTextTheme.subtitle.color,
150 - )))),
151 - Spacer(flex: 3)
152 - ]),
153 - ),
154 - Padding(
155 - padding: EdgeInsets.only(top: 16),
156 - child: ListView.separated(
157 - shrinkWrap: true,
158 - physics: NeverScrollableScrollPhysics(),
159 - itemCount: widget.exchangeTradeViewModel.items.length,
160 - separatorBuilder: (context, index) => Container(
161 - height: 1,
162 - color: Theme.of(context).accentTextTheme.subtitle.backgroundColor,
163 - ),
164 - itemBuilder: (context, index) {
165 - final item = widget.exchangeTradeViewModel.items[index];
166 - String value;
117 + contentPadding: EdgeInsets.only(top: 10, bottom: 16),
118 + content: Observer(builder: (_) {
119 + final trade = widget.exchangeTradeViewModel.trade;
120
168 - final content = Observer(
169 - builder: (_) {
170 - switch (index) {
171 - case 0:
172 - value = '${widget.exchangeTradeViewModel.trade.id ?? fetchingLabel}';
173 - break;
174 - case 1:
175 - value = '${widget.exchangeTradeViewModel.trade.amount ?? fetchingLabel}';
176 - break;
177 - case 2:
178 - value = '${widget.exchangeTradeViewModel.trade.state ?? fetchingLabel}';
179 - break;
180 - case 3:
181 - value = widget.exchangeTradeViewModel.trade.inputAddress ?? fetchingLabel;
182 - break;
183 - }
121 + return Column(
122 + children: <Widget>[
123 + trade.expiredAt != null
124 + ? Row(
125 + mainAxisSize: MainAxisSize.max,
126 + mainAxisAlignment: MainAxisAlignment.center,
127 + children: <Widget>[
128 + Text(
129 + S.of(context).offer_expires_in,
130 + style: TextStyle(
131 + fontSize: 14.0,
132 + fontWeight: FontWeight.w500,
133 + color: Theme.of(context)
134 + .primaryTextTheme
135 + .overline
136 + .color),
137 + ),
138 + TimerWidget(trade.expiredAt,
139 + color: Theme.of(context)
140 + .primaryTextTheme
141 + .title
142 + .color)
143 + ])
144 + : Offstage(),
145 + Padding(
146 + padding: EdgeInsets.only(top: 32),
147 + child: Row(children: <Widget>[
148 + Spacer(flex: 3),
149 + Flexible(
150 + flex: 4,
151 + child: Center(
152 + child: AspectRatio(
153 + aspectRatio: 1.0,
154 + child: QrImage(
155 + data: trade.inputAddress ?? fetchingLabel,
156 + backgroundColor: Colors.transparent,
157 + foregroundColor: Theme.of(context)
158 + .accentTextTheme
159 + .subtitle
160 + .color,
161 + )))),
162 + Spacer(flex: 3)
163 + ]),
164 + ),
165 + Padding(
166 + padding: EdgeInsets.only(top: 16),
167 + child: ListView.separated(
168 + shrinkWrap: true,
169 + physics: NeverScrollableScrollPhysics(),
170 + itemCount: widget.exchangeTradeViewModel.items.length,
171 + separatorBuilder: (context, index) => Container(
172 + height: 1,
173 + color: Theme.of(context)
174 + .accentTextTheme
175 + .subtitle
176 + .backgroundColor,
177 + ),
178 + itemBuilder: (context, index) {
179 + final item = widget.exchangeTradeViewModel.items[index];
180 + String value;
181
185 - return StandartListRow(
186 - title: item.title,
187 - value: value,
188 - valueFontSize: 14,
189 - image: item.isCopied ? copyImage : null,
190 - );
182 + final content = Observer(builder: (_) {
183 + switch (index) {
184 + case 0:
185 + value =
186 + '${widget.exchangeTradeViewModel.trade.id ?? fetchingLabel}';
187 + break;
188 + case 1:
189 + value =
190 + '${widget.exchangeTradeViewModel.trade.amount ?? fetchingLabel}';
191 + break;
192 + case 2:
193 + value =
194 + '${widget.exchangeTradeViewModel.trade.state ?? fetchingLabel}';
195 + break;
196 + case 3:
197 + value = widget.exchangeTradeViewModel.trade
198 + .inputAddress ??
199 + fetchingLabel;
200 + break;
201 }
192 - );
202
194 - return item.isCopied
195 - ? Builder(
196 - builder: (context) =>
197 - GestureDetector(
198 - onTap: () {
199 - Clipboard.setData(ClipboardData(text: value));
200 - Scaffold.of(context).showSnackBar(SnackBar(
201 - content: Text(
202 - S.of(context).copied_to_clipboard,
203 - textAlign: TextAlign.center,
204 - style: TextStyle(color: Colors.white),
205 - ),
206 - backgroundColor: Colors.green,
207 - duration: Duration(milliseconds: 1500),
208 - ));
209 - },
210 - child: content,
211 - )
212 - )
213 - : content;
214 - },
203 + return StandartListRow(
204 + title: item.title,
205 + value: value,
206 + valueFontSize: 14,
207 + image: item.isCopied ? copyImage : null,
208 + );
209 + });
210 +
211 + return item.isCopied
212 + ? Builder(
213 + builder: (context) => GestureDetector(
214 + onTap: () {
215 + Clipboard.setData(
216 + ClipboardData(text: value));
217 + showBar<void>(context,
218 + S.of(context).copied_to_clipboard);
219 + },
220 + child: content,
221 + ))
222 + : content;
223 + },
224 + ),
225 ),
216 - ),
217 - ],
218 - );
219 - }),
220 - bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
221 - bottomSection: PrimaryButton(
222 - onPressed: () {},
223 - text: S.of(context).confirm,
224 - color: Theme.of(context).accentTextTheme.body2.color,
225 - textColor: Colors.white
226 - )
227 - /*Observer(
226 + ],
227 + );
228 + }),
229 + bottomSectionPadding: EdgeInsets.fromLTRB(24, 0, 24, 24),
230 + bottomSection: PrimaryButton(
231 + onPressed: () {},
232 + text: S.of(context).confirm,
233 + color: Theme.of(context).accentTextTheme.body2.color,
234 + textColor: Colors.white)
235 + /*Observer(
236 builder: (_) => tradeStore.trade.from == CryptoCurrency.xmr &&
237 !(sendStore.state is TransactionCommitted)
238 ? LoadingPrimaryButton(
@@ -242,7 +250,7 @@ class ExchangeTradeState extends State<ExchangeTradeForm> {
250 color: Colors.blue,
251 textColor: Colors.white)
252 : Offstage()),*/
245 - ),
253 + ),
254 );
255 }
256
lib/src/screens/login/login_page.dart deleted
-114
@@ -1,114 +0,0 @@
1 -// import 'package:cake_wallet/src/stores/auth/auth_state.dart';
2 -// import 'package:cake_wallet/src/stores/login/login_store.dart';
3 -// import 'package:flutter/material.dart';
4 -// import 'package:flutter/cupertino.dart';
5 -// import 'package:mobx/mobx.dart';
6 -// import 'package:provider/provider.dart';
7 -// import 'package:cake_wallet/src/screens/pin_code/pin_code.dart';
8 -// import 'package:cake_wallet/src/screens/base_page.dart';
9 -
10 -// class LoginPage extends BasePage {
11 -// @override
12 -// Widget leading(BuildContext context) => Container();
13 -
14 -// @override
15 -// Widget body(BuildContext context) => _LoginPinCode();
16 -// }
17 -
18 -// class _LoginPinCode extends PinCode {
19 -// _LoginPinCode([Key key]) : super((_, __) => null, false, key);
20 -
21 -// @override
22 -// _LoginPinCodeState createState() => _LoginPinCodeState();
23 -// }
24 -
25 -// class _LoginPinCodeState extends PinCodeState<_LoginPinCode> {
26 -// LoginStore _loginStore;
27 -// String title = 'Enter your PIN';
28 -
29 -// @override
30 -// Future onPinCodeEntered(PinCodeState state) async {
31 -// final password = pin.fold("", (ac, val) => ac + '$val');
32 -
33 -// await _loginStore.authStore.auth(password: password);
34 -// super.onPinCodeEntered(state);
35 -// }
36 -
37 -// @override
38 -// Widget build(BuildContext context) {
39 -// _setLoginStore(store: Provider.of<LoginStore>(context));
40 -// return body(context);
41 -// }
42 -
43 -// void _setLoginStore({LoginStore store}) {
44 -// if (_loginStore != null) {
45 -// return;
46 -// }
47 -
48 -// _loginStore = store;
49 -
50 -// reaction((_) => _loginStore.authStore.state, (state) {
51 -// if (state is AuthenticationFailure) {
52 -// WidgetsBinding.instance.addPostFrameCallback((_) {
53 -// clear();
54 -// Scaffold.of(context).showSnackBar(
55 -// SnackBar(
56 -// content: Text(state.error),
57 -// backgroundColor: Colors.red,
58 -// ),
59 -// );
60 -// });
61 -// }
62 -
63 -// if (state is AuthenticationBanned) {
64 -// WidgetsBinding.instance.addPostFrameCallback((_) {
65 -// clear();
66 -// Scaffold.of(context).showSnackBar(
67 -// SnackBar(
68 -// content: Text(state.error),
69 -// backgroundColor: Colors.red,
70 -// ),
71 -// );
72 -// });
73 -// }
74 -
75 -// if (state is AuthenticationInProgress) {
76 -// WidgetsBinding.instance.addPostFrameCallback((_) {
77 -// Scaffold.of(context).hideCurrentSnackBar();
78 -// Scaffold.of(context).showSnackBar(
79 -// SnackBar(
80 -// content: Text('Authentication'),
81 -// backgroundColor: Colors.green,
82 -// ),
83 -// );
84 -// });
85 -// }
86 -// });
87 -
88 -// reaction((_) => _loginStore.state, (state) {
89 -// if (state is LoadedCurrentWalletFailure) {
90 -// WidgetsBinding.instance.addPostFrameCallback((_) {
91 -// clear();
92 -// Scaffold.of(context).showSnackBar(
93 -// SnackBar(
94 -// content: Text(state.errorMessage),
95 -// backgroundColor: Colors.red,
96 -// ),
97 -// );
98 -// });
99 -// }
100 -
101 -// if (state is LoadingCurrentWallet) {
102 -// WidgetsBinding.instance.addPostFrameCallback((_) {
103 -// Scaffold.of(context).hideCurrentSnackBar();
104 -// Scaffold.of(context).showSnackBar(
105 -// SnackBar(
106 -// content: Text('Loading your wallet'),
107 -// backgroundColor: Colors.green,
108 -// ),
109 -// );
110 -// });
111 -// }
112 -// });
113 -// }
114 -// }
lib/src/screens/receive/receive_page.dart
+2 -2
@@ -95,7 +95,7 @@ class ReceivePage extends BasePage {
95 context: context,
96 builder: (_) =>
97 getIt.get<MoneroAccountListPage>()),
98 - title: addressListViewModel.accountLabel,
98 + title: S.of(context).accounts,
99 icon: Icon(
100 Icons.arrow_forward_ios,
101 size: 14,
@@ -136,7 +136,7 @@ class ReceivePage extends BasePage {
136 isCurrent: isCurrent,
137 backgroundColor: backgroundColor,
138 textColor: textColor,
139 - onTap: (_) => addressListViewModel.address = item,
139 + onTap: (_) => addressListViewModel.setAddress(item),
140 onEdit: () => Navigator.of(context).pushNamed(
141 Routes.newSubaddress,
142 arguments: item));
lib/src/screens/receive/widgets/qr_widget.dart
+82 -86
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 import 'package:flutter/material.dart';
3 import 'package:flutter/cupertino.dart';
4 import 'package:flutter/services.dart';
@@ -9,13 +10,12 @@ import 'package:cake_wallet/core/amount_validator.dart';
10 import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
11
12 class QRWidget extends StatelessWidget {
12 - QRWidget({
13 - @required this.addressListViewModel,
14 - this.isAmountFieldShow = false
15 - }) : amountController = TextEditingController(),
16 - _formKey = GlobalKey<FormState>() {
13 + QRWidget(
14 + {@required this.addressListViewModel, this.isAmountFieldShow = false})
15 + : amountController = TextEditingController(),
16 + _formKey = GlobalKey<FormState>() {
17 amountController.addListener(() => addressListViewModel.amount =
18 - _formKey.currentState.validate() ? amountController.text : '');
18 + _formKey.currentState.validate() ? amountController.text : '');
19 }
20
21 final WalletAddressListViewModel addressListViewModel;
@@ -26,7 +26,7 @@ class QRWidget extends StatelessWidget {
26 @override
27 Widget build(BuildContext context) {
28 final copyImage = Image.asset('assets/images/copy_address.png',
29 - color: Theme.of(context).textTheme.subhead.decorationColor);
29 + color: Theme.of(context).textTheme.subhead.decorationColor);
30 final addressTopOffset = isAmountFieldShow ? 60.0 : 40.0;
31
32 return Column(
@@ -36,16 +36,17 @@ class QRWidget extends StatelessWidget {
36 Row(children: <Widget>[
37 Spacer(flex: 3),
38 Observer(
39 - builder: (_) => Flexible(
40 - flex: 5,
41 - child: Center(
42 - child: AspectRatio(
43 - aspectRatio: 1.0,
44 - child: QrImage(
45 - data: addressListViewModel.uri.toString(),
46 - backgroundColor: Colors.transparent,
47 - foregroundColor: Theme.of(context).textTheme.headline.color,
48 - ))))),
39 + builder: (_) => Flexible(
40 + flex: 5,
41 + child: Center(
42 + child: AspectRatio(
43 + aspectRatio: 1.0,
44 + child: QrImage(
45 + data: addressListViewModel.uri.toString(),
46 + backgroundColor: Colors.transparent,
47 + foregroundColor:
48 + Theme.of(context).textTheme.headline.color,
49 + ))))),
50 Spacer(flex: 3)
51 ]),
52 Padding(
@@ -53,85 +54,80 @@ class QRWidget extends StatelessWidget {
54 child: Text(
55 S.of(context).scan_qr_code,
56 style: TextStyle(
56 - fontSize: 12,
57 - fontWeight: FontWeight.w500,
58 - color: Theme.of(context).indicatorColor
59 - ),
57 + fontSize: 12,
58 + fontWeight: FontWeight.w500,
59 + color: Theme.of(context).indicatorColor),
60 ),
61 ),
62 isAmountFieldShow
63 - ? Padding(
64 - padding: EdgeInsets.only(top: 40),
65 - child: Row(
66 - children: <Widget>[
67 - Expanded(
68 - child: Form(
69 - key: _formKey,
70 - child: BaseTextFormField(
71 - controller: amountController,
72 - keyboardType:
73 - TextInputType.numberWithOptions(decimal: true),
74 - inputFormatters: [
75 - BlacklistingTextInputFormatter(
76 - RegExp('[\\-|\\ |\\,]'))
77 - ],
78 - textAlign: TextAlign.center,
79 - hintText: S.of(context).receive_amount,
80 - textColor: Colors.white,
81 - borderColor: Theme.of(context).textTheme.headline.decorationColor,
82 - validator: AmountValidator(
83 - type: addressListViewModel.type,
84 - isAutovalidate: true
85 - ),
86 - autovalidate: true,
87 - placeholderTextStyle: TextStyle(
88 - color: Theme.of(context).hoverColor,
89 - fontSize: 18,
90 - fontWeight: FontWeight.w500))))
91 - ],
92 - ),
93 - )
94 - : Offstage(),
63 + ? Padding(
64 + padding: EdgeInsets.only(top: 40),
65 + child: Row(
66 + children: <Widget>[
67 + Expanded(
68 + child: Form(
69 + key: _formKey,
70 + child: BaseTextFormField(
71 + controller: amountController,
72 + keyboardType: TextInputType.numberWithOptions(
73 + decimal: true),
74 + inputFormatters: [
75 + BlacklistingTextInputFormatter(
76 + RegExp('[\\-|\\ |\\,]'))
77 + ],
78 + textAlign: TextAlign.center,
79 + hintText: S.of(context).receive_amount,
80 + textColor: Colors.white,
81 + borderColor: Theme.of(context)
82 + .textTheme
83 + .headline
84 + .decorationColor,
85 + validator: AmountValidator(
86 + type: addressListViewModel.type,
87 + isAutovalidate: true),
88 + autovalidate: true,
89 + placeholderTextStyle: TextStyle(
90 + color: Theme.of(context).hoverColor,
91 + fontSize: 18,
92 + fontWeight: FontWeight.w500))))
93 + ],
94 + ),
95 + )
96 + : Offstage(),
97 Padding(
98 padding: EdgeInsets.only(top: addressTopOffset),
99 child: Builder(
100 builder: (context) => Observer(
101 builder: (context) => GestureDetector(
100 - onTap: () {
101 - Clipboard.setData(ClipboardData(
102 - text: addressListViewModel.address.address));
103 - Scaffold.of(context).showSnackBar(SnackBar(
104 - content: Text(
105 - S.of(context).copied_to_clipboard,
106 - style: TextStyle(color: Colors.white),
107 - ),
108 - backgroundColor: Colors.green,
109 - duration: Duration(milliseconds: 500),
110 - ));
111 - },
112 - child: Row(
113 - mainAxisSize: MainAxisSize.max,
114 - children: <Widget>[
115 - Expanded(
116 - child: Text(
117 - addressListViewModel.address.address,
118 - maxLines: 1,
119 - overflow: TextOverflow.ellipsis,
120 - style: TextStyle(
121 - fontSize: 16,
122 - fontWeight: FontWeight.w500,
123 - color: Colors.white),
124 - ),
102 + onTap: () {
103 + Clipboard.setData(ClipboardData(
104 + text: addressListViewModel.address.address));
105 + showBar<void>(
106 + context, S.of(context).copied_to_clipboard);
107 + },
108 + child: Row(
109 + mainAxisSize: MainAxisSize.max,
110 + children: <Widget>[
111 + Expanded(
112 + child: Text(
113 + addressListViewModel.address.address,
114 + maxLines: 1,
115 + overflow: TextOverflow.ellipsis,
116 + style: TextStyle(
117 + fontSize: 16,
118 + fontWeight: FontWeight.w500,
119 + color: Colors.white),
120 + ),
121 + ),
122 + Padding(
123 + padding: EdgeInsets.only(left: 12),
124 + child: copyImage,
125 + )
126 + ],
127 ),
126 - Padding(
127 - padding: EdgeInsets.only(left: 12),
128 - child: copyImage,
129 - )
130 - ],
131 - ),
132 - ))),
128 + ))),
129 )
130 ],
131 );
132 }
137 -}
\ No newline at end of file
133 +}
lib/src/screens/seed/wallet_seed_page.dart
+77 -106
@@ -2,6 +2,7 @@ import 'package:cake_wallet/di.dart';
2 import 'package:cake_wallet/palette.dart';
3 import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
4 import 'package:cake_wallet/store/settings_store.dart';
5 +import 'package:cake_wallet/utils/show_bar.dart';
6 import 'package:cake_wallet/utils/show_pop_up.dart';
7 import 'package:flutter/cupertino.dart';
8 import 'package:flutter/material.dart';
@@ -28,16 +29,20 @@ class WalletSeedPage extends BasePage {
29 @override
30 void onClose(BuildContext context) async {
31 if (isNewWalletCreated) {
31 - final confirmed = await showPopUp<bool>(context: context, builder: (BuildContext context) {
32 - // FIXME: add translations
33 - return AlertWithTwoActions(
34 - alertTitle: 'Attention',
35 - alertContent: 'The seed is the only way to recover your wallet. Have you written it down?',
36 - leftButtonText: 'Go back',
37 - rightButtonText: 'Yes, I have',
38 - actionLeftButton: () => Navigator.of(context).pop(false),
39 - actionRightButton: () => Navigator.of(context).pop(true));
40 - }) ?? false;
32 + final confirmed = await showPopUp<bool>(
33 + context: context,
34 + builder: (BuildContext context) {
35 + // FIXME: add translations
36 + return AlertWithTwoActions(
37 + alertTitle: 'Attention',
38 + alertContent:
39 + 'The seed is the only way to recover your wallet. Have you written it down?',
40 + leftButtonText: 'Go back',
41 + rightButtonText: 'Yes, I have',
42 + actionLeftButton: () => Navigator.of(context).pop(false),
43 + actionRightButton: () => Navigator.of(context).pop(true));
44 + }) ??
45 + false;
46
47 if (confirmed) {
48 Navigator.of(context).popUntil((route) => route.isFirst);
@@ -57,39 +62,31 @@ class WalletSeedPage extends BasePage {
62 Widget trailing(BuildContext context) {
63 return isNewWalletCreated
64 ? GestureDetector(
60 - onTap: () => onClose(context),
61 - child: Container(
62 - width: 100,
63 - height: 32,
64 - alignment: Alignment.center,
65 - margin: EdgeInsets.only(left: 10),
66 - decoration: BoxDecoration(
67 - borderRadius: BorderRadius.all(Radius.circular(16)),
68 - color: Theme
69 - .of(context)
70 - .accentTextTheme
71 - .caption
72 - .color),
73 - child: Text(
74 - S
75 - .of(context)
76 - .seed_language_next,
77 - style: TextStyle(
78 - fontSize: 14,
79 - fontWeight: FontWeight.w600,
80 - color: Palette.blueCraiola),
81 - ),
82 - ),
83 - )
65 + onTap: () => onClose(context),
66 + child: Container(
67 + width: 100,
68 + height: 32,
69 + alignment: Alignment.center,
70 + margin: EdgeInsets.only(left: 10),
71 + decoration: BoxDecoration(
72 + borderRadius: BorderRadius.all(Radius.circular(16)),
73 + color: Theme.of(context).accentTextTheme.caption.color),
74 + child: Text(
75 + S.of(context).seed_language_next,
76 + style: TextStyle(
77 + fontSize: 14,
78 + fontWeight: FontWeight.w600,
79 + color: Palette.blueCraiola),
80 + ),
81 + ),
82 + )
83 : Offstage();
84 }
85
86 @override
87 Widget body(BuildContext context) {
88 final image =
90 - getIt
91 - .get<SettingsStore>()
92 - .isDarkTheme ? imageDark : imageLight;
89 + getIt.get<SettingsStore>().isDarkTheme ? imageDark : imageLight;
90
91 return Container(
92 padding: EdgeInsets.all(24),
@@ -116,23 +113,21 @@ class WalletSeedPage extends BasePage {
113 style: TextStyle(
114 fontSize: 20,
115 fontWeight: FontWeight.w600,
119 - color: Theme
120 - .of(context)
116 + color: Theme.of(context)
117 .primaryTextTheme
118 .title
119 .color),
120 ),
121 Padding(
122 padding:
127 - EdgeInsets.only(top: 20, left: 16, right: 16),
123 + EdgeInsets.only(top: 20, left: 16, right: 16),
124 child: Text(
125 walletSeedViewModel.seed,
126 textAlign: TextAlign.center,
127 style: TextStyle(
128 fontSize: 14,
129 fontWeight: FontWeight.normal,
134 - color: Theme
135 - .of(context)
130 + color: Theme.of(context)
131 .primaryTextTheme
132 .caption
133 .color),
@@ -146,78 +141,54 @@ class WalletSeedPage extends BasePage {
141 children: <Widget>[
142 isNewWalletCreated
143 ? Padding(
149 - padding: EdgeInsets.only(
150 - bottom: 52, left: 43, right: 43),
151 - child: Text(
152 - S
153 - .of(context)
154 - .seed_reminder,
155 - textAlign: TextAlign.center,
156 - style: TextStyle(
157 - fontSize: 12,
158 - fontWeight: FontWeight.normal,
159 - color: Theme
160 - .of(context)
161 - .primaryTextTheme
162 - .overline
163 - .color),
164 - ),
165 - )
144 + padding: EdgeInsets.only(
145 + bottom: 52, left: 43, right: 43),
146 + child: Text(
147 + S.of(context).seed_reminder,
148 + textAlign: TextAlign.center,
149 + style: TextStyle(
150 + fontSize: 12,
151 + fontWeight: FontWeight.normal,
152 + color: Theme.of(context)
153 + .primaryTextTheme
154 + .overline
155 + .color),
156 + ),
157 + )
158 : Offstage(),
159 Row(
160 mainAxisSize: MainAxisSize.max,
161 children: <Widget>[
162 Flexible(
163 child: Container(
172 - padding: EdgeInsets.only(right: 8.0),
173 - child: PrimaryButton(
174 - onPressed: () =>
175 - Share.text(
176 - S
177 - .of(context)
178 - .seed_share,
179 - walletSeedViewModel.seed,
180 - 'text/plain'),
181 - text: S
182 - .of(context)
183 - .save,
184 - color: Colors.green,
185 - textColor: Colors.white),
186 - )),
164 + padding: EdgeInsets.only(right: 8.0),
165 + child: PrimaryButton(
166 + onPressed: () => Share.text(
167 + S.of(context).seed_share,
168 + walletSeedViewModel.seed,
169 + 'text/plain'),
170 + text: S.of(context).save,
171 + color: Colors.green,
172 + textColor: Colors.white),
173 + )),
174 Flexible(
175 child: Container(
189 - padding: EdgeInsets.only(left: 8.0),
190 - child: Builder(
191 - builder: (context) =>
192 - PrimaryButton(
193 - onPressed: () {
194 - Clipboard.setData(ClipboardData(
195 - text: walletSeedViewModel
196 - .seed));
197 - Scaffold.of(context)
198 - .showSnackBar(
199 - SnackBar(
200 - content: Text(S
201 - .of(context)
202 - .copied_to_clipboard),
203 - backgroundColor: Colors
204 - .green,
205 - duration:
206 - Duration(
207 - milliseconds: 1500),
208 - ),
209 - );
210 - },
211 - text: S
212 - .of(context)
213 - .copy,
214 - color: Theme
215 - .of(context)
216 - .accentTextTheme
217 - .body2
218 - .color,
219 - textColor: Colors.white)),
220 - ))
176 + padding: EdgeInsets.only(left: 8.0),
177 + child: Builder(
178 + builder: (context) => PrimaryButton(
179 + onPressed: () {
180 + Clipboard.setData(ClipboardData(
181 + text: walletSeedViewModel.seed));
182 + showBar<void>(context,
183 + S.of(context).copied_to_clipboard);
184 + },
185 + text: S.of(context).copy,
186 + color: Theme.of(context)
187 + .accentTextTheme
188 + .body2
189 + .color,
190 + textColor: Colors.white)),
191 + ))
192 ],
193 )
194 ],
lib/src/screens/send/send_page.dart
+16 -14
@@ -1,5 +1,7 @@
1 import 'dart:ui';
2 +import 'package:cake_wallet/entities/transaction_priority.dart';
3 import 'package:cake_wallet/src/widgets/keyboard_done_button.dart';
4 +import 'package:cake_wallet/src/widgets/picker.dart';
5 import 'package:flutter/cupertino.dart';
6 import 'package:flutter/material.dart';
7 import 'package:flutter/services.dart';
@@ -691,19 +693,19 @@ class SendPage extends BasePage {
693 }
694
695 Future<void> _setTransactionPriority(BuildContext context) async {
694 - // final items = TransactionPriority.all;
695 - // final selectedItem = items.indexOf(sendViewModel.transactionPriority);
696 - //
697 - // await showPopUp<void>(
698 - // builder: (_) => Picker(
699 - // items: items,
700 - // selectedAtIndex: selectedItem,
701 - // title: S.of(context).please_select,
702 - // mainAxisAlignment: MainAxisAlignment.center,
703 - // onItemSelected: (TransactionPriority priority) => null,
704 - // // sendViewModel.setTransactionPriority(priority),
705 - // isAlwaysShowScrollThumb: true,
706 - // ),
707 - // context: context);
696 + final items = TransactionPriority.all;
697 + final selectedItem = items.indexOf(sendViewModel.transactionPriority);
698 +
699 + await showPopUp<void>(
700 + builder: (_) => Picker(
701 + items: items,
702 + selectedAtIndex: selectedItem,
703 + title: S.of(context).please_select,
704 + mainAxisAlignment: MainAxisAlignment.center,
705 + onItemSelected: (TransactionPriority priority) =>
706 + sendViewModel.setTransactionPriority(priority),
707 + isAlwaysShowScrollThumb: true,
708 + ),
709 + context: context);
710 }
711 }
lib/src/screens/trade_details/trade_details_page.dart
+2 -8
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 import 'package:flutter/material.dart';
3 import 'package:flutter/cupertino.dart';
4 import 'package:flutter/services.dart';
@@ -68,14 +69,7 @@ class TradeDetailsPage extends BasePage {
69 return GestureDetector(
70 onTap: () {
71 Clipboard.setData(ClipboardData(text: '${item.value}'));
71 - Scaffold.of(context).showSnackBar(
72 - SnackBar(
73 - content:
74 - Text(S.of(context).trade_details_copied(item.title)),
75 - backgroundColor: Colors.green,
76 - duration: Duration(milliseconds: 1500),
77 - ),
78 - );
72 + showBar<void>(context, S.of(context).copied_to_clipboard);
73 },
74 child: StandartListRow(
75 title: '${item.title}',
lib/src/screens/transaction_details/transaction_details_page.dart
+3 -8
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 import 'package:flutter/material.dart';
3 import 'package:flutter/services.dart';
4 import 'package:cake_wallet/generated/i18n.dart';
@@ -92,14 +93,8 @@ class TransactionDetailsPage extends BasePage {
93 return GestureDetector(
94 onTap: () {
95 Clipboard.setData(ClipboardData(text: item.value));
95 - Scaffold.of(context).showSnackBar(
96 - SnackBar(
97 - content: Text(
98 - S.of(context).transaction_details_copied(item.title)),
99 - backgroundColor: Colors.green,
100 - duration: Duration(milliseconds: 1500),
101 - ),
102 - );
96 + showBar<void>(context,
97 + S.of(context).transaction_details_copied(item.title));
98 },
99 child: StandartListRow(
100 title: '${item.title}:',
lib/src/screens/wallet_keys/wallet_keys_page.dart
+4 -9
@@ -1,3 +1,5 @@
1 +import 'package:cake_wallet/utils/show_bar.dart';
2 +import 'package:flushbar/flushbar.dart';
3 import 'package:flutter/material.dart';
4 import 'package:flutter/cupertino.dart';
5 import 'package:flutter/services.dart';
@@ -41,15 +43,8 @@ class WalletKeysPage extends BasePage {
43 return GestureDetector(
44 onTap: () {
45 Clipboard.setData(ClipboardData(text: item.value));
44 - Scaffold.of(context).showSnackBar(SnackBar(
45 - content: Text(
46 - S.of(context).copied_key_to_clipboard(item.title),
47 - textAlign: TextAlign.center,
48 - style: TextStyle(color: Colors.white),
49 - ),
50 - backgroundColor: Colors.green,
51 - duration: Duration(seconds: 1),
52 - ));
46 + showBar<void>(context,
47 + S.of(context).copied_key_to_clipboard(item.title));
48 },
49 child: StandartListRow(
50 title: item.title + ':',
lib/src/screens/wallet_list/wallet_list_page.dart
+119 -42
@@ -1,5 +1,8 @@
1 +import 'package:cake_wallet/src/screens/auth/auth_page.dart';
2 import 'package:cake_wallet/src/screens/wallet_list/widgets/wallet_menu_alert.dart';
3 +import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
4 import 'package:cake_wallet/utils/show_pop_up.dart';
5 +import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
6 import 'package:flutter/material.dart';
7 import 'package:flutter/cupertino.dart';
8 import 'package:flutter_mobx/flutter_mobx.dart';
@@ -11,6 +14,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
14 import 'package:cake_wallet/src/screens/base_page.dart';
15 import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
16 import 'package:cake_wallet/src/screens/wallet_list/wallet_menu.dart';
17 +import 'package:flutter_slidable/flutter_slidable.dart';
18
19 class WalletListPage extends BasePage {
20 WalletListPage({this.walletListViewModel});
@@ -65,48 +69,61 @@ class WalletListBodyState extends State<WalletListBody> {
69 itemCount: widget.walletListViewModel.wallets.length,
70 itemBuilder: (__, index) {
71 final wallet = widget.walletListViewModel.wallets[index];
68 - final walletMenu = WalletMenu(context, widget.walletListViewModel);
69 - final items =
70 - walletMenu.generateItemsForWalletMenu(wallet.isCurrent);
72 final currentColor = wallet.isCurrent
72 - ? Theme.of(context).accentTextTheme.subtitle.decorationColor
73 + ? Theme.of(context)
74 + .accentTextTheme
75 + .subtitle
76 + .decorationColor
77 : Theme.of(context).backgroundColor;
78 + final row = GestureDetector(
79 + onTap: () async {
80 + if (wallet.isCurrent) {
81 + return;
82 + }
83
75 - return GestureDetector(
76 - onTap: () {
77 - showPopUp<void>(
78 - context: context,
79 - builder: (dialogContext) {
80 - return WalletMenuAlert(
81 - wallet: wallet,
82 - walletMenu: walletMenu,
83 - items: items);
84 - }
85 - );
86 - },
87 - child: Container(
88 - height: tileHeight,
89 - width: double.infinity,
90 - child: Row(
91 - children: <Widget>[
92 - Container(
93 - height: tileHeight,
94 - width: 4,
95 - decoration: BoxDecoration(
96 - borderRadius: BorderRadius.only(
97 - topRight: Radius.circular(4),
98 - bottomRight: Radius.circular(4)),
99 - color: currentColor
84 + final confirmed = await showPopUp<bool>(
85 + context: context,
86 + builder: (dialogContext) {
87 + // FIXME:
88 + return AlertWithTwoActions(
89 + alertTitle: 'Change current wallet',
90 + alertContent:
91 + 'Do you want to change current wallet to ${wallet.name} ?',
92 + leftButtonText: S.of(context).cancel,
93 + rightButtonText: S.of(context).change,
94 + actionLeftButton: () =>
95 + Navigator.of(context).pop(false),
96 + actionRightButton: () =>
97 + Navigator.of(context).pop(true));
98 + }) ?? false;
99 +
100 + if (confirmed) {
101 + await _loadWallet(wallet);
102 + }
103 + },
104 + child: Container(
105 + height: tileHeight,
106 + width: double.infinity,
107 + child: Row(
108 + children: <Widget>[
109 + Container(
110 + height: tileHeight,
111 + width: 4,
112 + decoration: BoxDecoration(
113 + borderRadius: BorderRadius.only(
114 + topRight: Radius.circular(4),
115 + bottomRight: Radius.circular(4)),
116 + color: currentColor),
117 ),
101 - ),
102 - Expanded(
118 + Expanded(
119 child: Container(
120 height: tileHeight,
121 padding: EdgeInsets.only(left: 20, right: 20),
122 color: Theme.of(context).backgroundColor,
123 alignment: Alignment.centerLeft,
124 child: Row(
109 - crossAxisAlignment: CrossAxisAlignment.center,
125 + crossAxisAlignment:
126 + CrossAxisAlignment.center,
127 children: <Widget>[
128 _imageFor(type: wallet.type),
129 SizedBox(width: 10),
@@ -115,17 +132,33 @@ class WalletListBodyState extends State<WalletListBody> {
132 style: TextStyle(
133 fontSize: 22,
134 fontWeight: FontWeight.w600,
118 - color: Theme.of(context).primaryTextTheme.title.color
119 - ),
135 + color: Theme.of(context)
136 + .primaryTextTheme
137 + .title
138 + .color),
139 )
140 ],
141 ),
142 ),
124 - ),
125 - ],
126 - ),
127 - )
128 - );
143 + ),
144 + ],
145 + ),
146 + ));
147 +
148 + return wallet.isCurrent
149 + ? row
150 + : Slidable(
151 + key: Key('${wallet.key}'),
152 + actionPane: SlidableDrawerActionPane(),
153 + child: row,
154 + secondaryActions: <Widget>[
155 + IconSlideAction(
156 + caption: S.of(context).delete,
157 + color: Colors.red,
158 + icon: CupertinoIcons.delete,
159 + onTap: () async => _removeWallet(wallet),
160 + )
161 + ]);
162 }),
163 ),
164 ),
@@ -136,12 +169,13 @@ class WalletListBodyState extends State<WalletListBody> {
169 image: newWalletImage,
170 text: S.of(context).wallet_list_create_new_wallet,
171 color: Theme.of(context).accentTextTheme.subtitle.decorationColor,
139 - textColor: Theme.of(context).accentTextTheme.headline.decorationColor,
172 + textColor:
173 + Theme.of(context).accentTextTheme.headline.decorationColor,
174 ),
175 SizedBox(height: 10.0),
176 PrimaryImageButton(
143 - onPressed: () => Navigator.of(context)
144 - .pushNamed(Routes.restoreWalletType),
177 + onPressed: () =>
178 + Navigator.of(context).pushNamed(Routes.restoreWalletType),
179 image: restoreWalletImage,
180 text: S.of(context).wallet_list_restore_wallet,
181 color: Theme.of(context).accentTextTheme.caption.color,
@@ -160,4 +194,47 @@ class WalletListBodyState extends State<WalletListBody> {
194 return null;
195 }
196 }
197 +
198 + Future<void> _loadWallet(WalletListItem wallet) async {
199 + await Navigator.of(context).pushNamed(Routes.auth, arguments:
200 + (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
201 + if (!isAuthenticatedSuccessfully) {
202 + return;
203 + }
204 +
205 + try {
206 + auth.changeProcessText(
207 + S.of(context).wallet_list_loading_wallet(wallet.name));
208 + await widget.walletListViewModel.loadWallet(wallet);
209 + auth.hideProgressText();
210 + auth.close();
211 + Navigator.of(context).pop();
212 + } catch (e) {
213 + auth.changeProcessText(S
214 + .of(context)
215 + .wallet_list_failed_to_load(wallet.name, e.toString()));
216 + }
217 + });
218 + }
219 +
220 + Future<void> _removeWallet(WalletListItem wallet) async {
221 + await Navigator.of(context).pushNamed(Routes.auth, arguments:
222 + (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
223 + if (!isAuthenticatedSuccessfully) {
224 + return;
225 + }
226 +
227 + try {
228 + auth.changeProcessText(
229 + S.of(context).wallet_list_removing_wallet(wallet.name));
230 + await widget.walletListViewModel.remove(wallet);
231 + } catch (e) {
232 + auth.changeProcessText(S
233 + .of(context)
234 + .wallet_list_failed_to_remove(wallet.name, e.toString()));
235 + }
236 +
237 + auth.close();
238 + });
239 + }
240 }
lib/src/widgets/address_text_field.dart
+2 -2
@@ -2,7 +2,7 @@ import 'package:flutter/services.dart';
2 import 'package:flutter/material.dart';
3 import 'package:cake_wallet/routes.dart';
4 import 'package:cake_wallet/generated/i18n.dart';
5 -import 'package:cake_wallet/entities/contact.dart';
5 +import 'package:cake_wallet/entities/contact_record.dart';
6 import 'package:cake_wallet/entities/qr_scanner.dart';
7
8 enum AddressTextFieldOption { paste, qrCode, addressBook }
@@ -212,7 +212,7 @@ class AddressTextField extends StatelessWidget {
212 final contact = await Navigator.of(context, rootNavigator: true)
213 .pushNamed(Routes.pickerAddressBook);
214
215 - if (contact is Contact && contact.address != null) {
215 + if (contact is ContactRecord && contact.address != null) {
216 controller.text = contact.address;
217 }
218 }
lib/utils/mobx.dart
+7 -1
@@ -124,10 +124,16 @@ extension HiveBindable<T extends Keyable> on ObservableList<T> {
124 listen().listen((event) => dest.acceptEntityChange(event));
125
126 void acceptBoxChange(BoxEvent event, {T transformed}) {
127 + print('---------------------');
128 + print('event.key: ${event.key}; event.deleted: ${event.deleted};');
129 if (event.deleted) {
128 - removeWhere((el) => el.keyIndex == event.key);
130 + removeWhere((el) {
131 + print('el.keyIndex ${el.keyIndex}');
132 + return el.keyIndex == event.key; });
133 }
134
135 + print('---------------------');
136 +
137 final dynamic value = transformed ?? event.value;
138
139 if (value is T) {
lib/utils/show_bar.dart new
+47
@@ -0,0 +1,47 @@
1 +import 'package:flushbar/flushbar.dart';
2 +import 'package:flutter/cupertino.dart';
3 +import 'package:flutter/material.dart';
4 +
5 +Future<T> showBar<T>(BuildContext context, String text,
6 + {bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) {
7 + final bar = Flushbar<T>(
8 + boxShadows: [
9 + BoxShadow(
10 + color: Colors.black.withOpacity(0.09),
11 + blurRadius: 8,
12 + offset: Offset(0, 2))
13 + ],
14 + backgroundColor: isDark ? Colors.black : Colors.white,
15 + borderRadius: 35,
16 + margin: EdgeInsets.all(50),
17 + messageText: Text(text,
18 + textAlign: TextAlign.center,
19 + style: TextStyle(color: isDark ? Colors.white : Colors.black)),
20 + duration: duration,
21 + isDismissible: isDismissible,
22 + flushbarPosition: FlushbarPosition.TOP,
23 + flushbarStyle: FlushbarStyle.FLOATING);
24 +
25 + return bar.show(context);
26 +}
27 +
28 +Flushbar<T> createBar<T>(String text,
29 + {bool isDark = false, Duration duration = const Duration(seconds: 1), bool isDismissible = true}) {
30 + return Flushbar<T>(
31 + boxShadows: [
32 + BoxShadow(
33 + color: Colors.black.withOpacity(0.09),
34 + blurRadius: 8,
35 + offset: Offset(0, 2))
36 + ],
37 + backgroundColor: isDark ? Colors.black : Colors.white,
38 + borderRadius: 35,
39 + margin: EdgeInsets.all(50),
40 + messageText: Text(text,
41 + textAlign: TextAlign.center,
42 + style: TextStyle(color: isDark ? Colors.white : Colors.black)),
43 + duration: duration,
44 + isDismissible: isDismissible,
45 + flushbarPosition: FlushbarPosition.TOP,
46 + flushbarStyle: FlushbarStyle.FLOATING);
47 +}
lib/view_model/send/send_view_model.dart
+8 -3
@@ -50,14 +50,15 @@ abstract class SendViewModelBase with Store {
50 @observable
51 bool sendAll;
52
53 + @computed
54 + double get estimatedFee =>
55 + _wallet.calculateEstimatedFee(_settingsStore.transactionPriority);
56 +
57 FiatCurrency get fiat => _settingsStore.fiatCurrency;
58
59 TransactionPriority get transactionPriority =>
60 _settingsStore.transactionPriority;
61
58 - double get estimatedFee =>
59 - _wallet.calculateEstimatedFee(_settingsStore.transactionPriority);
60 -
62 CryptoCurrency get currency => _wallet.currency;
63
64 Validator get amountValidator => AmountValidator(type: _wallet.type);
@@ -139,6 +140,10 @@ abstract class SendViewModelBase with Store {
140 _updateCryptoAmount();
141 }
142
143 + @action
144 + void setTransactionPriority(TransactionPriority priority) =>
145 + _settingsStore.transactionPriority = priority;
146 +
147 @action
148 void _updateFiatAmount() {
149 try {
lib/view_model/wallet_address_list/wallet_address_list_view_model.dart
+4 -3
@@ -109,9 +109,6 @@ abstract class WalletAddressListViewModelBase with Store {
109 return addressList;
110 }
111
112 - set address(WalletAddressListItem address) => null;
113 - // _wallet.address = address.address;
114 -
112 bool hasAccounts;
113
114 WalletBase _wallet;
@@ -129,6 +126,10 @@ abstract class WalletAddressListViewModelBase with Store {
126 return null;
127 }
128
129 + @action
130 + void setAddress(WalletAddressListItem address) =>
131 + _wallet.address = address.address;
132 +
133 void _init() {
134 _baseItems = [];
135
lib/view_model/wallet_list/wallet_list_view_model.dart
+1
@@ -31,6 +31,7 @@ abstract class WalletListViewModelBase with Store {
31 await _keyService.getWalletPassword(walletName: wallet.name);
32 final walletService = getIt.get<WalletService>(param1: wallet.type);
33 _appStore.wallet = await walletService.openWallet(wallet.name, password);
34 + _updateList();
35 }
36
37 @action
pubspec.lock
+7
@@ -358,6 +358,13 @@ packages:
358 url: "https://pub.dartlang.org"
359 source: hosted
360 version: "0.10.11"
361 + flushbar:
362 + dependency: "direct main"
363 + description:
364 + name: flushbar
365 + url: "https://pub.dartlang.org"
366 + source: hosted
367 + version: "1.10.4"
368 flutter:
369 dependency: "direct main"
370 description: flutter
pubspec.yaml
+1
@@ -65,6 +65,7 @@ dependencies:
65 get_it: ^4.0.2
66 connectivity: ^0.4.9+2
67 keyboard_actions: ^3.3.0
68 + flushbar: ^1.10.4
69
70 dev_dependencies:
71 flutter_test: