CW-442-Update-exchange-selector-checkboxes-with-checkboxes-from-transactions-filter-screen (#1074)

* Update checkboxes * fix exchange provider selector * checkbox picker refactoring * Revert "checkbox picker refactoring" This reverts commit 66eea9d69033d497c740331fa42daee338df3b31. * Update check_box_picker.dart

Serhii committed Sep 22, 2023 at 18:09 UTC 572d9288480cfee6c7f69bdc6c66604b03f3c033
2 files changed +50 -30
lib/src/screens/nodes/widgets/node_form.dart
+9
@@ -132,6 +132,9 @@ class NodeForm extends StatelessWidget {
132 Observer(
133 builder: (_) => StandardCheckbox(
134 value: nodeViewModel.useSSL,
135 + gradientBackground: true,
136 + borderColor: Theme.of(context).dividerColor,
137 + iconColor: Colors.white,
138 onChanged: (value) => nodeViewModel.useSSL = value,
139 caption: S.of(context).use_ssl,
140 ),
@@ -148,6 +151,9 @@ class NodeForm extends StatelessWidget {
151 Observer(
152 builder: (_) => StandardCheckbox(
153 value: nodeViewModel.trusted,
154 + gradientBackground: true,
155 + borderColor: Theme.of(context).dividerColor,
156 + iconColor: Colors.white,
157 onChanged: (value) => nodeViewModel.trusted = value,
158 caption: S.of(context).trusted,
159 ),
@@ -166,6 +172,9 @@ class NodeForm extends StatelessWidget {
172 children: [
173 StandardCheckbox(
174 value: nodeViewModel.useSocksProxy,
175 + gradientBackground: true,
176 + borderColor: Theme.of(context).dividerColor,
177 + iconColor: Colors.white,
178 onChanged: (value) {
179 if (!value) {
180 _socksAddressController.text = '';
lib/src/widgets/check_box_picker.dart
+41 -30
@@ -1,3 +1,4 @@
1 +import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
2 import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
3 import 'package:cake_wallet/palette.dart';
4 import 'package:cake_wallet/utils/responsive_layout_util.dart';
@@ -101,7 +102,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
102 height: 1,
103 )
104 : const SizedBox(),
104 - itemCount: items == null || items.isEmpty ? 0 : items.length,
105 + itemCount: items.isEmpty ? 0 : items.length,
106 itemBuilder: (context, index) => buildItem(index),
107 ),
108 );
@@ -112,41 +113,51 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
113
114 return GestureDetector(
115 onTap: () {
115 - Navigator.of(context).pop();
116 + if (item.isDisabled) {
117 + return;
118 + }
119 +
120 + bool newValue = !item.value;
121 + item.value = newValue;
122 + widget.onChanged(index, newValue);
123 + setState(() {});
124 },
125 child: Container(
126 height: 55,
127 color: Theme.of(context).dialogTheme.backgroundColor,
128 padding: EdgeInsets.only(left: 24, right: 24),
121 - child: CheckboxListTile(
122 - value: item.value,
123 - activeColor: item.value
124 - ? Palette.blueCraiola
125 - : Theme.of(context).extension<FilterTheme>()!.checkboxBackgroundColor,
126 - checkColor: Colors.white,
127 - title: widget.displayItem?.call(item) ??
128 - Text(
129 - item.title,
130 - style: TextStyle(
131 - fontSize: 14,
132 - fontFamily: 'Lato',
133 - fontWeight: FontWeight.w600,
134 - color: item.isDisabled
135 - ? Colors.grey.withOpacity(0.5)
136 - : Theme.of(context).extension<CakeTextTheme>()!.titleColor,
137 - decoration: TextDecoration.none,
138 - ),
139 - ),
140 - onChanged: (bool? value) {
141 - if (value == null) {
142 - return;
143 - }
129 + child: Row(
130 + children: [
131 + StandardCheckbox(
132 + value: item.value,
133 + gradientBackground: true,
134 + borderColor: Theme.of(context).dividerColor,
135 + iconColor: Colors.white,
136 + onChanged: (bool? value) {
137 + if (value == null || item.isDisabled) {
138 + return;
139 + }
140
145 - item.value = value;
146 - widget.onChanged(index, value);
147 - setState(() {});
148 - },
149 - controlAffinity: ListTileControlAffinity.leading,
141 + item.value = value;
142 + widget.onChanged(index, value);
143 + setState(() {});
144 + },
145 + ),
146 + SizedBox(width: 16),
147 + widget.displayItem?.call(item) ??
148 + Text(
149 + item.title,
150 + style: TextStyle(
151 + fontSize: 14,
152 + fontFamily: 'Lato',
153 + fontWeight: FontWeight.w600,
154 + color: item.isDisabled
155 + ? Colors.grey.withOpacity(0.5)
156 + : Theme.of(context).extension<CakeTextTheme>()!.titleColor,
157 + decoration: TextDecoration.none,
158 + ),
159 + )
160 + ],
161 ),
162 ),
163 );