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,41 +113,51 @@ 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(
value: item.value, children: [
activeColor: item.value StandardCheckbox(
? Palette.blueCraiola value: item.value,
: Theme.of(context).extension<FilterTheme>()!.checkboxBackgroundColor, gradientBackground: true,
checkColor: Colors.white, borderColor: Theme.of(context).dividerColor,
title: widget.displayItem?.call(item) ?? iconColor: Colors.white,
Text( onChanged: (bool? value) {
item.title, if (value == null || item.isDisabled) {
style: TextStyle( return;
fontSize: 14, }
fontFamily: 'Lato',
fontWeight: FontWeight.w600,
color: item.isDisabled
? Colors.grey.withOpacity(0.5)
: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
),
onChanged: (bool? value) {
if (value == null) {
return;
}
item.value = value; item.value = value;
widget.onChanged(index, value); widget.onChanged(index, value);
setState(() {}); setState(() {});
}, },
controlAffinity: ListTileControlAffinity.leading, ),
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<CakeTextTheme>()!.titleColor,
decoration: TextDecoration.none,
),
)
],
), ),
), ),
); );