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 66eea9d690.

* Update check_box_picker.dart
This commit is contained in:
Serhii 2023-09-22 18:09:30 +03:00 committed by GitHub
parent 95ea825728
commit 572d928848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 30 deletions

View file

@ -132,6 +132,9 @@ class NodeForm extends StatelessWidget {
Observer( Observer(
builder: (_) => StandardCheckbox( builder: (_) => StandardCheckbox(
value: nodeViewModel.useSSL, value: nodeViewModel.useSSL,
gradientBackground: true,
borderColor: Theme.of(context).dividerColor,
iconColor: Colors.white,
onChanged: (value) => nodeViewModel.useSSL = value, onChanged: (value) => nodeViewModel.useSSL = value,
caption: S.of(context).use_ssl, caption: S.of(context).use_ssl,
), ),
@ -148,6 +151,9 @@ class NodeForm extends StatelessWidget {
Observer( Observer(
builder: (_) => StandardCheckbox( builder: (_) => StandardCheckbox(
value: nodeViewModel.trusted, value: nodeViewModel.trusted,
gradientBackground: true,
borderColor: Theme.of(context).dividerColor,
iconColor: Colors.white,
onChanged: (value) => nodeViewModel.trusted = value, onChanged: (value) => nodeViewModel.trusted = value,
caption: S.of(context).trusted, caption: S.of(context).trusted,
), ),
@ -166,6 +172,9 @@ class NodeForm extends StatelessWidget {
children: [ children: [
StandardCheckbox( StandardCheckbox(
value: nodeViewModel.useSocksProxy, value: nodeViewModel.useSocksProxy,
gradientBackground: true,
borderColor: Theme.of(context).dividerColor,
iconColor: Colors.white,
onChanged: (value) { onChanged: (value) {
if (!value) { if (!value) {
_socksAddressController.text = ''; _socksAddressController.text = '';

View file

@ -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/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart';
@ -101,7 +102,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
height: 1, height: 1,
) )
: const SizedBox(), : const SizedBox(),
itemCount: items == null || items.isEmpty ? 0 : items.length, itemCount: items.isEmpty ? 0 : items.length,
itemBuilder: (context, index) => buildItem(index), itemBuilder: (context, index) => buildItem(index),
), ),
); );
@ -112,19 +113,38 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pop(); if (item.isDisabled) {
return;
}
bool newValue = !item.value;
item.value = newValue;
widget.onChanged(index, newValue);
setState(() {});
}, },
child: Container( child: Container(
height: 55, height: 55,
color: Theme.of(context).dialogTheme.backgroundColor, color: Theme.of(context).dialogTheme.backgroundColor,
padding: EdgeInsets.only(left: 24, right: 24), padding: EdgeInsets.only(left: 24, right: 24),
child: CheckboxListTile( child: Row(
children: [
StandardCheckbox(
value: item.value, value: item.value,
activeColor: item.value gradientBackground: true,
? Palette.blueCraiola borderColor: Theme.of(context).dividerColor,
: Theme.of(context).extension<FilterTheme>()!.checkboxBackgroundColor, iconColor: Colors.white,
checkColor: Colors.white, onChanged: (bool? value) {
title: widget.displayItem?.call(item) ?? if (value == null || item.isDisabled) {
return;
}
item.value = value;
widget.onChanged(index, value);
setState(() {});
},
),
SizedBox(width: 16),
widget.displayItem?.call(item) ??
Text( Text(
item.title, item.title,
style: TextStyle( style: TextStyle(
@ -136,17 +156,8 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
: Theme.of(context).extension<CakeTextTheme>()!.titleColor, : Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none, decoration: TextDecoration.none,
), ),
), )
onChanged: (bool? value) { ],
if (value == null) {
return;
}
item.value = value;
widget.onChanged(index, value);
setState(() {});
},
controlAffinity: ListTileControlAffinity.leading,
), ),
), ),
); );