CAKE-227 | applied null to subname for btc wallet in the dashboard_view_model.dart; deleted isDrawBottom from trade_details_page.dart, transaction_details_page.dart, standart_list_row.dart, textfield_list_row.dart; applied SectionStandardList to trade_details_page.dart and transaction_details_page.dart
OleksandrSobol committed
Jan 6, 2021 at 15:34 UTC
53c12d7bc098cbeb1a452d09c20de0c825bf8076
5 files changed
+126
-182
lib/src/screens/trade_details/trade_details_page.dart
+13
-22
@@ -1,3 +1,4 @@
1
+import 'package:cake_wallet/src/widgets/standard_list.dart';
2
import 'package:cake_wallet/utils/show_bar.dart';
3
import 'package:cake_wallet/view_model/trade_details_view_model.dart';
4
import 'package:flutter/material.dart';
@@ -18,35 +19,25 @@ class TradeDetailsPage extends BasePage {
19
20
@override
21
Widget body(BuildContext context) {
21
- return Container(child: Observer(builder: (_) {
22
- return ListView.separated(
23
- separatorBuilder: (_, __) => Container(
24
- height: 1,
25
- padding: EdgeInsets.only(left: 24),
26
- color: Theme.of(context).backgroundColor,
27
- child: Container(
28
- height: 1,
29
- color: Theme.of(context)
30
- .primaryTextTheme
31
- .title
32
- .backgroundColor)),
33
- itemCount: tradeDetailsViewModel.items.length,
34
- itemBuilder: (BuildContext context, int index) {
22
+ return Observer(builder: (_) {
23
+ return SectionStandardList(
24
+ sectionCount: 1,
25
+ itemCounter: (int _) => tradeDetailsViewModel.items.length,
26
+ itemBuilder: (_, __, index) {
27
final item = tradeDetailsViewModel.items[index];
36
- final isDrawBottom =
37
- index == tradeDetailsViewModel.items.length - 1 ? true : false;
28
29
return GestureDetector(
30
onTap: () {
31
Clipboard.setData(ClipboardData(text: '${item.value}'));
42
- showBar<void>(context, S.of(context).copied_to_clipboard);
32
+ showBar<void>(context, S
33
+ .of(context)
34
+ .copied_to_clipboard);
35
},
36
child: StandartListRow(
45
- title: '${item.title}',
46
- value: '${item.value}',
47
- isDrawBottom: isDrawBottom,
37
+ title: '${item.title}',
38
+ value: '${item.value}'
39
));
40
});
50
- }));
41
+ });
42
}
52
-}
43
+}
\ No newline at end of file
lib/src/screens/transaction_details/transaction_details_page.dart
+27
-42
@@ -1,5 +1,6 @@
1
import 'package:cake_wallet/src/screens/transaction_details/textfield_list_item.dart';
2
import 'package:cake_wallet/src/screens/transaction_details/widgets/textfield_list_row.dart';
3
+import 'package:cake_wallet/src/widgets/standard_list.dart';
4
import 'package:cake_wallet/utils/show_bar.dart';
5
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
6
import 'package:flutter/material.dart';
@@ -19,50 +20,34 @@ class TransactionDetailsPage extends BasePage {
20
21
@override
22
Widget body(BuildContext context) {
22
- return Container(
23
- child: ListView.separated(
24
- separatorBuilder: (context, index) => Container(
25
- height: 1,
26
- padding: EdgeInsets.only(left: 24),
27
- color: Theme.of(context).backgroundColor,
28
- child: Container(
29
- height: 1,
30
- color:
31
- Theme.of(context).primaryTextTheme.title.backgroundColor,
32
- ),
33
- ),
34
- itemCount: transactionDetailsViewModel.items.length,
35
- itemBuilder: (context, index) {
36
- final item = transactionDetailsViewModel.items[index];
37
- final isDrawBottom =
38
- index == transactionDetailsViewModel.items.length - 1
39
- ? true : false;
23
+ return SectionStandardList(
24
+ sectionCount: 1,
25
+ itemCounter: (int _) => transactionDetailsViewModel.items.length,
26
+ itemBuilder: (_, __, index) {
27
+ final item = transactionDetailsViewModel.items[index];
28
41
- if (item is StandartListItem) {
42
- return GestureDetector(
43
- onTap: () {
44
- Clipboard.setData(ClipboardData(text: item.value));
45
- showBar<void>(context,
46
- S.of(context).transaction_details_copied(item.title));
47
- },
48
- child: StandartListRow(
49
- title: '${item.title}:',
50
- value: item.value,
51
- isDrawBottom: isDrawBottom),
52
- );
53
- }
29
+ if (item is StandartListItem) {
30
+ return GestureDetector(
31
+ onTap: () {
32
+ Clipboard.setData(ClipboardData(text: item.value));
33
+ showBar<void>(context,
34
+ S.of(context).transaction_details_copied(item.title));
35
+ },
36
+ child: StandartListRow(
37
+ title: '${item.title}:',
38
+ value: item.value),
39
+ );
40
+ }
41
55
- if (item is TextFieldListItem) {
56
- return TextFieldListRow(
57
- title: item.title,
58
- value: item.value,
59
- onSubmitted: item.onSubmitted,
60
- isDrawBottom: isDrawBottom,
61
- );
62
- }
42
+ if (item is TextFieldListItem) {
43
+ return TextFieldListRow(
44
+ title: item.title,
45
+ value: item.value,
46
+ onSubmitted: item.onSubmitted,
47
+ );
48
+ }
49
64
- return null;
65
- }),
66
- );
50
+ return null;
51
+ });
52
}
53
}
lib/src/screens/transaction_details/widgets/textfield_list_row.dart
+40
-57
@@ -8,8 +8,7 @@ class TextFieldListRow extends StatelessWidget {
8
this.value,
9
this.titleFontSize = 14,
10
this.valueFontSize = 16,
11
- this.onSubmitted,
12
- this.isDrawBottom = false}) {
11
+ this.onSubmitted}) {
12
13
_textController = TextEditingController();
14
_textController.text = value;
@@ -20,69 +19,53 @@ class TextFieldListRow extends StatelessWidget {
19
final double titleFontSize;
20
final double valueFontSize;
21
final Function(String value) onSubmitted;
23
- final bool isDrawBottom;
22
23
TextEditingController _textController;
24
25
@override
26
Widget build(BuildContext context) {
29
- return Column(
30
- children: <Widget>[
31
- Container(
32
- width: double.infinity,
33
- color: Theme.of(context).backgroundColor,
34
- child: Padding(
35
- padding:
36
- const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
37
- child: Column(
38
- crossAxisAlignment: CrossAxisAlignment.start,
39
- children: <Widget>[
40
- Text(title,
41
- style: TextStyle(
42
- fontSize: titleFontSize,
43
- fontWeight: FontWeight.w500,
44
- color: Theme.of(context)
45
- .primaryTextTheme.overline.color),
46
- textAlign: TextAlign.left),
47
- TextField(
48
- controller: _textController,
49
- keyboardType: TextInputType.multiline,
50
- textInputAction: TextInputAction.done,
51
- maxLines: null,
52
- textAlign: TextAlign.start,
53
- style: TextStyle(
27
+ return Container(
28
+ width: double.infinity,
29
+ color: Theme.of(context).backgroundColor,
30
+ child: Padding(
31
+ padding:
32
+ const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
33
+ child: Column(
34
+ crossAxisAlignment: CrossAxisAlignment.start,
35
+ children: <Widget>[
36
+ Text(title,
37
+ style: TextStyle(
38
+ fontSize: titleFontSize,
39
+ fontWeight: FontWeight.w500,
40
+ color: Theme.of(context)
41
+ .primaryTextTheme.overline.color),
42
+ textAlign: TextAlign.left),
43
+ TextField(
44
+ controller: _textController,
45
+ keyboardType: TextInputType.multiline,
46
+ textInputAction: TextInputAction.done,
47
+ maxLines: null,
48
+ textAlign: TextAlign.start,
49
+ style: TextStyle(
50
+ fontSize: valueFontSize,
51
+ fontWeight: FontWeight.w500,
52
+ color: Theme.of(context)
53
+ .primaryTextTheme.title.color),
54
+ decoration: InputDecoration(
55
+ isDense: true,
56
+ contentPadding: EdgeInsets.only(top: 12, bottom: 0),
57
+ hintText: S.of(context).enter_your_note,
58
+ hintStyle: TextStyle(
59
fontSize: valueFontSize,
60
fontWeight: FontWeight.w500,
61
color: Theme.of(context)
57
- .primaryTextTheme.title.color),
58
- decoration: InputDecoration(
59
- isDense: true,
60
- contentPadding: EdgeInsets.only(top: 12, bottom: 0),
61
- hintText: S.of(context).enter_your_note,
62
- hintStyle: TextStyle(
63
- fontSize: valueFontSize,
64
- fontWeight: FontWeight.w500,
65
- color: Theme.of(context)
66
- .primaryTextTheme.overline.color),
67
- border: InputBorder.none
68
- ),
69
- onSubmitted: (value) => onSubmitted.call(value),
70
- )
71
- ]),
72
- ),
73
- ),
74
- isDrawBottom
75
- ? Container(
76
- height: 1,
77
- padding: EdgeInsets.only(left: 24),
78
- color: Theme.of(context).backgroundColor,
79
- child: Container(
80
- height: 1,
81
- color: Theme.of(context).primaryTextTheme.title.backgroundColor,
82
- ),
83
- )
84
- : Offstage(),
85
- ],
62
+ .primaryTextTheme.overline.color),
63
+ border: InputBorder.none
64
+ ),
65
+ onSubmitted: (value) => onSubmitted.call(value),
66
+ )
67
+ ]),
68
+ ),
69
);
70
}
71
}
lib/src/widgets/standart_list_row.dart
+44
-61
@@ -7,77 +7,60 @@ class StandartListRow extends StatelessWidget {
7
this.value,
8
this.titleFontSize = 14,
9
this.valueFontSize = 16,
10
- this.image,
11
- this.isDrawBottom = false});
10
+ this.image});
11
12
final String title;
13
final String value;
14
final double titleFontSize;
15
final double valueFontSize;
16
final Image image;
18
- final bool isDrawBottom;
17
18
@override
19
Widget build(BuildContext context) {
22
- return Column(
23
- children: <Widget>[
24
- Container(
25
- width: double.infinity,
26
- color: Theme.of(context).backgroundColor,
27
- child: Padding(
28
- padding:
29
- const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
30
- child: Column(
31
- crossAxisAlignment: CrossAxisAlignment.start,
32
- children: <Widget>[
33
- Text(title,
34
- style: TextStyle(
35
- fontSize: titleFontSize,
36
- fontWeight: FontWeight.w500,
37
- color:
38
- Theme.of(context).primaryTextTheme.overline.color),
39
- textAlign: TextAlign.left),
40
- Padding(
41
- padding: const EdgeInsets.only(top: 12),
42
- child: Row(
43
- mainAxisSize: MainAxisSize.max,
44
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
45
- crossAxisAlignment: CrossAxisAlignment.start,
46
- children: <Widget>[
47
- Expanded(
48
- child: Text(value,
49
- style: TextStyle(
50
- fontSize: valueFontSize,
51
- fontWeight: FontWeight.w500,
52
- color: Theme.of(context)
53
- .primaryTextTheme
54
- .title
55
- .color)),
56
- ),
57
- image != null
58
- ? Padding(
59
- padding: EdgeInsets.only(left: 24),
60
- child: image,
61
- )
62
- : Offstage()
63
- ],
20
+ return Container(
21
+ width: double.infinity,
22
+ color: Theme.of(context).backgroundColor,
23
+ child: Padding(
24
+ padding:
25
+ const EdgeInsets.only(left: 24, top: 16, bottom: 16, right: 24),
26
+ child: Column(
27
+ crossAxisAlignment: CrossAxisAlignment.start,
28
+ children: <Widget>[
29
+ Text(title,
30
+ style: TextStyle(
31
+ fontSize: titleFontSize,
32
+ fontWeight: FontWeight.w500,
33
+ color:
34
+ Theme.of(context).primaryTextTheme.overline.color),
35
+ textAlign: TextAlign.left),
36
+ Padding(
37
+ padding: const EdgeInsets.only(top: 12),
38
+ child: Row(
39
+ mainAxisSize: MainAxisSize.max,
40
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
41
+ crossAxisAlignment: CrossAxisAlignment.start,
42
+ children: <Widget>[
43
+ Expanded(
44
+ child: Text(value,
45
+ style: TextStyle(
46
+ fontSize: valueFontSize,
47
+ fontWeight: FontWeight.w500,
48
+ color: Theme.of(context)
49
+ .primaryTextTheme
50
+ .title
51
+ .color)),
52
),
65
- )
66
- ]),
67
- ),
68
- ),
69
- isDrawBottom
70
- ? Container(
71
- height: 1,
72
- padding: EdgeInsets.only(left: 24),
73
- color: Theme.of(context).backgroundColor,
74
- child: Container(
75
- height: 1,
76
- color: Theme.of(context).primaryTextTheme.title.backgroundColor,
77
- ),
78
- )
79
- : Offstage(),
80
- ],
53
+ image != null
54
+ ? Padding(
55
+ padding: EdgeInsets.only(left: 24),
56
+ child: image,
57
+ )
58
+ : Offstage()
59
+ ],
60
+ ),
61
+ )
62
+ ]),
63
+ ),
64
);
65
}
66
}
lib/view_model/dashboard/dashboard_view_model.dart
+2
@@ -231,6 +231,8 @@ abstract class DashboardViewModelBase with Store {
231
232
_onMoneroTransactionsUpdate(wallet);
233
} else {
234
+ subname = null;
235
+
236
transactions.clear();
237
238
transactions.addAll(wallet.transactionHistory.transactions.values.map(