From 572d9288480cfee6c7f69bdc6c66604b03f3c033 Mon Sep 17 00:00:00 2001 From: Serhii Date: Fri, 22 Sep 2023 18:09:30 +0300 Subject: [PATCH] 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 --- lib/src/screens/nodes/widgets/node_form.dart | 9 +++ lib/src/widgets/check_box_picker.dart | 71 +++++++++++--------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/lib/src/screens/nodes/widgets/node_form.dart b/lib/src/screens/nodes/widgets/node_form.dart index 91974fce5..ab8dcafdf 100644 --- a/lib/src/screens/nodes/widgets/node_form.dart +++ b/lib/src/screens/nodes/widgets/node_form.dart @@ -132,6 +132,9 @@ class NodeForm extends StatelessWidget { Observer( builder: (_) => StandardCheckbox( value: nodeViewModel.useSSL, + gradientBackground: true, + borderColor: Theme.of(context).dividerColor, + iconColor: Colors.white, onChanged: (value) => nodeViewModel.useSSL = value, caption: S.of(context).use_ssl, ), @@ -148,6 +151,9 @@ class NodeForm extends StatelessWidget { Observer( builder: (_) => StandardCheckbox( value: nodeViewModel.trusted, + gradientBackground: true, + borderColor: Theme.of(context).dividerColor, + iconColor: Colors.white, onChanged: (value) => nodeViewModel.trusted = value, caption: S.of(context).trusted, ), @@ -166,6 +172,9 @@ class NodeForm extends StatelessWidget { children: [ StandardCheckbox( value: nodeViewModel.useSocksProxy, + gradientBackground: true, + borderColor: Theme.of(context).dividerColor, + iconColor: Colors.white, onChanged: (value) { if (!value) { _socksAddressController.text = ''; diff --git a/lib/src/widgets/check_box_picker.dart b/lib/src/widgets/check_box_picker.dart index 30f81e981..71bfa7ee9 100644 --- a/lib/src/widgets/check_box_picker.dart +++ b/lib/src/widgets/check_box_picker.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/src/widgets/standard_checkbox.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart'; @@ -101,7 +102,7 @@ class CheckBoxPickerState extends State { height: 1, ) : const SizedBox(), - itemCount: items == null || items.isEmpty ? 0 : items.length, + itemCount: items.isEmpty ? 0 : items.length, itemBuilder: (context, index) => buildItem(index), ), ); @@ -112,41 +113,51 @@ class CheckBoxPickerState extends State { return GestureDetector( onTap: () { - Navigator.of(context).pop(); + if (item.isDisabled) { + return; + } + + bool newValue = !item.value; + item.value = newValue; + widget.onChanged(index, newValue); + setState(() {}); }, child: Container( height: 55, color: Theme.of(context).dialogTheme.backgroundColor, padding: EdgeInsets.only(left: 24, right: 24), - child: CheckboxListTile( - value: item.value, - activeColor: item.value - ? Palette.blueCraiola - : Theme.of(context).extension()!.checkboxBackgroundColor, - checkColor: Colors.white, - title: widget.displayItem?.call(item) ?? - Text( - item.title, - style: TextStyle( - fontSize: 14, - fontFamily: 'Lato', - fontWeight: FontWeight.w600, - color: item.isDisabled - ? Colors.grey.withOpacity(0.5) - : Theme.of(context).extension()!.titleColor, - decoration: TextDecoration.none, - ), - ), - onChanged: (bool? value) { - if (value == null) { - return; - } + child: Row( + children: [ + StandardCheckbox( + value: item.value, + gradientBackground: true, + borderColor: Theme.of(context).dividerColor, + iconColor: Colors.white, + onChanged: (bool? value) { + if (value == null || item.isDisabled) { + return; + } - item.value = value; - widget.onChanged(index, value); - setState(() {}); - }, - controlAffinity: ListTileControlAffinity.leading, + item.value = value; + widget.onChanged(index, value); + setState(() {}); + }, + ), + SizedBox(width: 16), + widget.displayItem?.call(item) ?? + Text( + item.title, + style: TextStyle( + fontSize: 14, + fontFamily: 'Lato', + fontWeight: FontWeight.w600, + color: item.isDisabled + ? Colors.grey.withOpacity(0.5) + : Theme.of(context).extension()!.titleColor, + decoration: TextDecoration.none, + ), + ) + ], ), ), );