CAKE-345 | fixed bug on send_card.dart and fixed addresses for transaction details
OleksandrSobol committed
Aug 11, 2021 at 17:23 UTC
f84c7c9a1c1bc919a121fde5b8709f294e291732
2 files changed
+331
-327
lib/src/screens/send/widgets/send_card.dart
+330
-326
@@ -80,227 +80,55 @@ class SendCardState extends State<SendCard>
80
)
81
]),
82
child: Container(
83
- height: sendViewModel.isElectrumWallet ? 470 : 445,
84
- decoration: BoxDecoration(
85
- borderRadius: BorderRadius.only(
86
- bottomLeft: Radius.circular(24),
87
- bottomRight: Radius.circular(24)),
88
- gradient: LinearGradient(colors: [
89
- Theme.of(context).primaryTextTheme.subhead.color,
90
- Theme.of(context)
91
- .primaryTextTheme
92
- .subhead
93
- .decorationColor,
94
- ], begin: Alignment.topLeft, end: Alignment.bottomRight),
95
- ),
96
- child: Padding(
97
- padding: EdgeInsets.fromLTRB(24, 80, 24, 32),
98
- child: SingleChildScrollView(
99
- child: Column(
100
- mainAxisSize: MainAxisSize.min,
101
- children: <Widget>[
102
- AddressTextField(
103
- focusNode: addressFocusNode,
104
- controller: addressController,
105
- onURIScanned: (uri) {
106
- var address = '';
107
- var amount = '';
108
-
109
- if (uri != null) {
110
- address = uri.path;
111
- amount = uri.queryParameters['tx_amount'] ??
112
- uri.queryParameters['amount'];
113
- } else {
114
- address = uri.toString();
115
- }
116
-
117
- addressController.text = address;
118
- cryptoAmountController.text = amount;
119
- },
120
- options: [
121
- AddressTextFieldOption.paste,
122
- AddressTextFieldOption.qrCode,
123
- AddressTextFieldOption.addressBook
124
- ],
125
- buttonColor: Theme.of(context)
126
- .primaryTextTheme
127
- .display1
128
- .color,
129
- borderColor: Theme.of(context)
130
- .primaryTextTheme
131
- .headline
132
- .color,
133
- textStyle: TextStyle(
134
- fontSize: 14,
135
- fontWeight: FontWeight.w500,
136
- color: Colors.white),
137
- hintStyle: TextStyle(
138
- fontSize: 14,
139
- fontWeight: FontWeight.w500,
140
- color: Theme.of(context)
141
- .primaryTextTheme
142
- .headline
143
- .decorationColor),
144
- onPushPasteButton: (context) async {
145
- final parsedAddress =
146
- await output.applyOpenaliasOrUnstoppableDomains();
147
- showAddressAlert(context, parsedAddress);
148
- },
149
- validator: sendViewModel.addressValidator,
150
- ),
151
- Observer(
152
- builder: (_) => Padding(
153
- padding: const EdgeInsets.only(top: 20),
154
- child: Stack(
155
- children: [
156
- BaseTextFormField(
157
- focusNode: cryptoAmountFocus,
158
- controller: cryptoAmountController,
159
- keyboardType:
160
- TextInputType.numberWithOptions(
161
- signed: false, decimal: true),
162
- prefixIcon: Padding(
163
- padding: EdgeInsets.only(top: 9),
164
- child: Text(
165
- sendViewModel.currency.title +
166
- ':',
167
- style: TextStyle(
168
- fontSize: 16,
169
- fontWeight: FontWeight.w600,
170
- color: Colors.white,
171
- )),
172
- ),
173
- suffixIcon: SizedBox(
174
- width: prefixIconWidth,
175
- ),
176
- hintText: '0.0000',
177
- borderColor: Theme.of(context)
178
- .primaryTextTheme
179
- .headline
180
- .color,
181
- textStyle: TextStyle(
182
- fontSize: 14,
183
- fontWeight: FontWeight.w500,
184
- color: Colors.white),
185
- placeholderTextStyle: TextStyle(
186
- color: Theme.of(context)
187
- .primaryTextTheme
188
- .headline
189
- .decorationColor,
190
- fontWeight: FontWeight.w500,
191
- fontSize: 14),
192
- validator: output.sendAll
193
- ? sendViewModel.allAmountValidator
194
- : sendViewModel
195
- .amountValidator),
196
- if (!sendViewModel.isBatchSending) Positioned(
197
- top: 2,
198
- right: 0,
199
- child: Container(
200
- width: prefixIconWidth,
201
- height: prefixIconHeight,
202
- child: InkWell(
203
- onTap: () async =>
204
- output.setSendAll(),
205
- child: Container(
206
- decoration: BoxDecoration(
207
- color: Theme.of(context)
208
- .primaryTextTheme
209
- .display1
210
- .color,
211
- borderRadius:
212
- BorderRadius.all(
213
- Radius.circular(6))),
214
- child: Center(
215
- child: Text(
216
- S.of(context).all,
217
- textAlign:
218
- TextAlign.center,
219
- style: TextStyle(
220
- fontSize: 12,
221
- fontWeight:
222
- FontWeight.bold,
223
- color:
224
- Theme.of(context)
225
- .primaryTextTheme
226
- .display1
227
- .decorationColor))),
228
- ))))])
229
- )),
230
- Observer(
231
- builder: (_) => Padding(
232
- padding: EdgeInsets.only(top: 10),
233
- child: Row(
234
- mainAxisSize: MainAxisSize.max,
235
- mainAxisAlignment:
236
- MainAxisAlignment.spaceBetween,
237
- children: <Widget>[
238
- Expanded(
239
- child: Text(
240
- S.of(context).available_balance +
241
- ':',
242
- style: TextStyle(
243
- fontSize: 12,
244
- fontWeight: FontWeight.w600,
245
- color: Theme.of(context)
246
- .primaryTextTheme
247
- .headline
248
- .decorationColor),
249
- )),
250
- Text(
251
- sendViewModel.balance,
252
- style: TextStyle(
253
- fontSize: 12,
254
- fontWeight: FontWeight.w600,
255
- color: Theme.of(context)
256
- .primaryTextTheme
257
- .headline
258
- .decorationColor),
259
- )
260
- ],
261
- ),
262
- )),
263
- Padding(
264
- padding: const EdgeInsets.only(top: 20),
265
- child: BaseTextFormField(
266
- focusNode: fiatAmountFocus,
267
- controller: fiatAmountController,
268
- keyboardType:
269
- TextInputType.numberWithOptions(
270
- signed: false, decimal: true),
271
- prefixIcon: Padding(
272
- padding: EdgeInsets.only(top: 9),
273
- child:
274
- Text(sendViewModel.fiat.title + ':',
275
- style: TextStyle(
276
- fontSize: 16,
277
- fontWeight: FontWeight.w600,
278
- color: Colors.white,
279
- )),
280
- ),
281
- hintText: '0.00',
282
- borderColor: Theme.of(context)
283
- .primaryTextTheme
284
- .headline
285
- .color,
286
- textStyle: TextStyle(
287
- fontSize: 14,
288
- fontWeight: FontWeight.w500,
289
- color: Colors.white),
290
- placeholderTextStyle: TextStyle(
291
- color: Theme.of(context)
292
- .primaryTextTheme
293
- .headline
294
- .decorationColor,
295
- fontWeight: FontWeight.w500,
296
- fontSize: 14),
297
- )),
298
- Padding(
299
- padding: EdgeInsets.only(top: 20),
300
- child: BaseTextFormField(
301
- controller: noteController,
302
- keyboardType: TextInputType.multiline,
303
- maxLines: null,
83
+ height: 0,
84
+ color: Theme.of(context).backgroundColor,
85
+ child: Container(
86
+ height: sendViewModel.isElectrumWallet ? 470 : 445,
87
+ decoration: BoxDecoration(
88
+ borderRadius: BorderRadius.only(
89
+ bottomLeft: Radius.circular(24),
90
+ bottomRight: Radius.circular(24)),
91
+ gradient: LinearGradient(colors: [
92
+ Theme.of(context).primaryTextTheme.subhead.color,
93
+ Theme.of(context)
94
+ .primaryTextTheme
95
+ .subhead
96
+ .decorationColor,
97
+ ], begin: Alignment.topLeft, end: Alignment.bottomRight),
98
+ ),
99
+ child: Padding(
100
+ padding: EdgeInsets.fromLTRB(24, 80, 24, 32),
101
+ child: SingleChildScrollView(
102
+ child: Column(
103
+ mainAxisSize: MainAxisSize.min,
104
+ children: <Widget>[
105
+ AddressTextField(
106
+ focusNode: addressFocusNode,
107
+ controller: addressController,
108
+ onURIScanned: (uri) {
109
+ var address = '';
110
+ var amount = '';
111
+
112
+ if (uri != null) {
113
+ address = uri.path;
114
+ amount = uri.queryParameters['tx_amount'] ??
115
+ uri.queryParameters['amount'];
116
+ } else {
117
+ address = uri.toString();
118
+ }
119
+
120
+ addressController.text = address;
121
+ cryptoAmountController.text = amount;
122
+ },
123
+ options: [
124
+ AddressTextFieldOption.paste,
125
+ AddressTextFieldOption.qrCode,
126
+ AddressTextFieldOption.addressBook
127
+ ],
128
+ buttonColor: Theme.of(context)
129
+ .primaryTextTheme
130
+ .display1
131
+ .color,
132
borderColor: Theme.of(context)
133
.primaryTextTheme
134
.headline
@@ -309,128 +137,304 @@ class SendCardState extends State<SendCard>
137
fontSize: 14,
138
fontWeight: FontWeight.w500,
139
color: Colors.white),
312
- hintText: S.of(context).note_optional,
313
- placeholderTextStyle: TextStyle(
140
+ hintStyle: TextStyle(
141
fontSize: 14,
142
fontWeight: FontWeight.w500,
143
color: Theme.of(context)
144
.primaryTextTheme
145
.headline
146
.decorationColor),
147
+ onPushPasteButton: (context) async {
148
+ final parsedAddress =
149
+ await output.applyOpenaliasOrUnstoppableDomains();
150
+ showAddressAlert(context, parsedAddress);
151
+ },
152
+ validator: sendViewModel.addressValidator,
153
),
321
- ),
322
- Observer(
323
- builder: (_) => GestureDetector(
324
- onTap: () =>
325
- _setTransactionPriority(context),
326
- child: Container(
327
- padding: EdgeInsets.only(top: 24),
154
+ Observer(
155
+ builder: (_) => Padding(
156
+ padding: const EdgeInsets.only(top: 20),
157
+ child: Stack(
158
+ children: [
159
+ BaseTextFormField(
160
+ focusNode: cryptoAmountFocus,
161
+ controller: cryptoAmountController,
162
+ keyboardType:
163
+ TextInputType.numberWithOptions(
164
+ signed: false, decimal: true),
165
+ prefixIcon: Padding(
166
+ padding: EdgeInsets.only(top: 9),
167
+ child: Text(
168
+ sendViewModel.currency.title +
169
+ ':',
170
+ style: TextStyle(
171
+ fontSize: 16,
172
+ fontWeight: FontWeight.w600,
173
+ color: Colors.white,
174
+ )),
175
+ ),
176
+ suffixIcon: SizedBox(
177
+ width: prefixIconWidth,
178
+ ),
179
+ hintText: '0.0000',
180
+ borderColor: Theme.of(context)
181
+ .primaryTextTheme
182
+ .headline
183
+ .color,
184
+ textStyle: TextStyle(
185
+ fontSize: 14,
186
+ fontWeight: FontWeight.w500,
187
+ color: Colors.white),
188
+ placeholderTextStyle: TextStyle(
189
+ color: Theme.of(context)
190
+ .primaryTextTheme
191
+ .headline
192
+ .decorationColor,
193
+ fontWeight: FontWeight.w500,
194
+ fontSize: 14),
195
+ validator: output.sendAll
196
+ ? sendViewModel.allAmountValidator
197
+ : sendViewModel
198
+ .amountValidator),
199
+ if (!sendViewModel.isBatchSending) Positioned(
200
+ top: 2,
201
+ right: 0,
202
+ child: Container(
203
+ width: prefixIconWidth,
204
+ height: prefixIconHeight,
205
+ child: InkWell(
206
+ onTap: () async =>
207
+ output.setSendAll(),
208
+ child: Container(
209
+ decoration: BoxDecoration(
210
+ color: Theme.of(context)
211
+ .primaryTextTheme
212
+ .display1
213
+ .color,
214
+ borderRadius:
215
+ BorderRadius.all(
216
+ Radius.circular(6))),
217
+ child: Center(
218
+ child: Text(
219
+ S.of(context).all,
220
+ textAlign:
221
+ TextAlign.center,
222
+ style: TextStyle(
223
+ fontSize: 12,
224
+ fontWeight:
225
+ FontWeight.bold,
226
+ color:
227
+ Theme.of(context)
228
+ .primaryTextTheme
229
+ .display1
230
+ .decorationColor))),
231
+ ))))])
232
+ )),
233
+ Observer(
234
+ builder: (_) => Padding(
235
+ padding: EdgeInsets.only(top: 10),
236
child: Row(
237
+ mainAxisSize: MainAxisSize.max,
238
mainAxisAlignment:
239
MainAxisAlignment.spaceBetween,
331
- crossAxisAlignment: CrossAxisAlignment.start,
240
children: <Widget>[
241
+ Expanded(
242
+ child: Text(
243
+ S.of(context).available_balance +
244
+ ':',
245
+ style: TextStyle(
246
+ fontSize: 12,
247
+ fontWeight: FontWeight.w600,
248
+ color: Theme.of(context)
249
+ .primaryTextTheme
250
+ .headline
251
+ .decorationColor),
252
+ )),
253
Text(
334
- S
335
- .of(context)
336
- .send_estimated_fee,
337
- style: TextStyle(
338
- fontSize: 12,
339
- fontWeight:
340
- FontWeight.w500,
341
- //color: Theme.of(context).primaryTextTheme.display2.color,
342
- color: Colors.white)),
343
- Container(
344
- child: Row(
345
- crossAxisAlignment: CrossAxisAlignment.start,
346
- children: <Widget>[
347
- Column(
348
- mainAxisAlignment: MainAxisAlignment.start,
349
- crossAxisAlignment: CrossAxisAlignment.end,
350
- children: [
351
- Text(
352
- output
353
- .estimatedFee
354
- .toString() +
355
- ' ' +
356
- sendViewModel
357
- .currency.title,
358
- style: TextStyle(
359
- fontSize: 12,
360
- fontWeight:
361
- FontWeight.w600,
362
- //color: Theme.of(context).primaryTextTheme.display2.color,
363
- color:
364
- Colors.white)),
365
- Padding(
366
- padding:
367
- EdgeInsets.only(top: 5),
368
- child: Text(
369
- output
370
- .estimatedFeeFiatAmount
371
- + ' ' +
372
- sendViewModel
373
- .fiat.title,
374
- style: TextStyle(
375
- fontSize: 12,
376
- fontWeight:
377
- FontWeight.w600,
378
- color: Theme
379
- .of(context)
380
- .primaryTextTheme
381
- .headline
382
- .decorationColor))
383
- ),
384
- ],
385
- ),
386
- Padding(
387
- padding: EdgeInsets.only(
388
- top: 2,
389
- left: 5),
390
- child: Icon(
391
- Icons.arrow_forward_ios,
392
- size: 12,
393
- color: Colors.white,
394
- ),
395
- )
396
- ],
397
- ),
254
+ sendViewModel.balance,
255
+ style: TextStyle(
256
+ fontSize: 12,
257
+ fontWeight: FontWeight.w600,
258
+ color: Theme.of(context)
259
+ .primaryTextTheme
260
+ .headline
261
+ .decorationColor),
262
)
263
],
264
),
401
- ),
402
- )),
403
- if (sendViewModel.isElectrumWallet) Padding(
404
- padding: EdgeInsets.only(top: 6),
405
- child: GestureDetector(
406
- onTap: () => Navigator.of(context)
407
- .pushNamed(Routes.unspentCoinsList),
265
+ )),
266
+ Padding(
267
+ padding: const EdgeInsets.only(top: 20),
268
+ child: BaseTextFormField(
269
+ focusNode: fiatAmountFocus,
270
+ controller: fiatAmountController,
271
+ keyboardType:
272
+ TextInputType.numberWithOptions(
273
+ signed: false, decimal: true),
274
+ prefixIcon: Padding(
275
+ padding: EdgeInsets.only(top: 9),
276
+ child:
277
+ Text(sendViewModel.fiat.title + ':',
278
+ style: TextStyle(
279
+ fontSize: 16,
280
+ fontWeight: FontWeight.w600,
281
+ color: Colors.white,
282
+ )),
283
+ ),
284
+ hintText: '0.00',
285
+ borderColor: Theme.of(context)
286
+ .primaryTextTheme
287
+ .headline
288
+ .color,
289
+ textStyle: TextStyle(
290
+ fontSize: 14,
291
+ fontWeight: FontWeight.w500,
292
+ color: Colors.white),
293
+ placeholderTextStyle: TextStyle(
294
+ color: Theme.of(context)
295
+ .primaryTextTheme
296
+ .headline
297
+ .decorationColor,
298
+ fontWeight: FontWeight.w500,
299
+ fontSize: 14),
300
+ )),
301
+ Padding(
302
+ padding: EdgeInsets.only(top: 20),
303
+ child: BaseTextFormField(
304
+ controller: noteController,
305
+ keyboardType: TextInputType.multiline,
306
+ maxLines: null,
307
+ borderColor: Theme.of(context)
308
+ .primaryTextTheme
309
+ .headline
310
+ .color,
311
+ textStyle: TextStyle(
312
+ fontSize: 14,
313
+ fontWeight: FontWeight.w500,
314
+ color: Colors.white),
315
+ hintText: S.of(context).note_optional,
316
+ placeholderTextStyle: TextStyle(
317
+ fontSize: 14,
318
+ fontWeight: FontWeight.w500,
319
+ color: Theme.of(context)
320
+ .primaryTextTheme
321
+ .headline
322
+ .decorationColor),
323
+ ),
324
+ ),
325
+ Observer(
326
+ builder: (_) => GestureDetector(
327
+ onTap: () =>
328
+ _setTransactionPriority(context),
329
child: Container(
409
- color: Colors.transparent,
410
- child: Row(
411
- mainAxisAlignment:
412
- MainAxisAlignment.spaceBetween,
413
- children: [
414
- Text(
415
- S.of(context).coin_control,
416
- style: TextStyle(
417
- fontSize: 12,
418
- fontWeight: FontWeight.w600,
419
- color: Colors.white)),
420
- Icon(
421
- Icons.arrow_forward_ios,
422
- size: 12,
423
- color: Colors.white,
424
- )
425
- ],
426
- )
427
- )
428
- )
429
- )
430
- ],
431
- )
330
+ padding: EdgeInsets.only(top: 24),
331
+ child: Row(
332
+ mainAxisAlignment:
333
+ MainAxisAlignment.spaceBetween,
334
+ crossAxisAlignment: CrossAxisAlignment.start,
335
+ children: <Widget>[
336
+ Text(
337
+ S
338
+ .of(context)
339
+ .send_estimated_fee,
340
+ style: TextStyle(
341
+ fontSize: 12,
342
+ fontWeight:
343
+ FontWeight.w500,
344
+ //color: Theme.of(context).primaryTextTheme.display2.color,
345
+ color: Colors.white)),
346
+ Container(
347
+ child: Row(
348
+ crossAxisAlignment: CrossAxisAlignment.start,
349
+ children: <Widget>[
350
+ Column(
351
+ mainAxisAlignment: MainAxisAlignment.start,
352
+ crossAxisAlignment: CrossAxisAlignment.end,
353
+ children: [
354
+ Text(
355
+ output
356
+ .estimatedFee
357
+ .toString() +
358
+ ' ' +
359
+ sendViewModel
360
+ .currency.title,
361
+ style: TextStyle(
362
+ fontSize: 12,
363
+ fontWeight:
364
+ FontWeight.w600,
365
+ //color: Theme.of(context).primaryTextTheme.display2.color,
366
+ color:
367
+ Colors.white)),
368
+ Padding(
369
+ padding:
370
+ EdgeInsets.only(top: 5),
371
+ child: Text(
372
+ output
373
+ .estimatedFeeFiatAmount
374
+ + ' ' +
375
+ sendViewModel
376
+ .fiat.title,
377
+ style: TextStyle(
378
+ fontSize: 12,
379
+ fontWeight:
380
+ FontWeight.w600,
381
+ color: Theme
382
+ .of(context)
383
+ .primaryTextTheme
384
+ .headline
385
+ .decorationColor))
386
+ ),
387
+ ],
388
+ ),
389
+ Padding(
390
+ padding: EdgeInsets.only(
391
+ top: 2,
392
+ left: 5),
393
+ child: Icon(
394
+ Icons.arrow_forward_ios,
395
+ size: 12,
396
+ color: Colors.white,
397
+ ),
398
+ )
399
+ ],
400
+ ),
401
+ )
402
+ ],
403
+ ),
404
+ ),
405
+ )),
406
+ if (sendViewModel.isElectrumWallet) Padding(
407
+ padding: EdgeInsets.only(top: 6),
408
+ child: GestureDetector(
409
+ onTap: () => Navigator.of(context)
410
+ .pushNamed(Routes.unspentCoinsList),
411
+ child: Container(
412
+ color: Colors.transparent,
413
+ child: Row(
414
+ mainAxisAlignment:
415
+ MainAxisAlignment.spaceBetween,
416
+ children: [
417
+ Text(
418
+ S.of(context).coin_control,
419
+ style: TextStyle(
420
+ fontSize: 12,
421
+ fontWeight: FontWeight.w600,
422
+ color: Colors.white)),
423
+ Icon(
424
+ Icons.arrow_forward_ios,
425
+ size: 12,
426
+ color: Colors.white,
427
+ )
428
+ ],
429
+ )
430
+ )
431
+ )
432
+ )
433
+ ],
434
+ )
435
+ ),
436
),
433
- ),
437
+ )
438
));
439
}
440
lib/view_model/send/send_view_model.dart
+1
-1
@@ -151,7 +151,7 @@ abstract class SendViewModelBase with Store {
151
@action
152
Future<void> commitTransaction() async {
153
String address = outputs.fold('', (acc, value) {
154
- return acc + value.address + '\n';
154
+ return acc + value.address + '\n\n';
155
});
156
157
address = address.trim();