From faaddd0f9b1f7ef0a373c676389c7ea8479095aa Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 12 Jun 2024 11:33:57 +0100 Subject: [PATCH] fixed filter chip colors, border and alignment --- example/macos/Podfile.lock | 2 +- lib/src/components/chips/chip.dart | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 66e9c6e8..4d2c877c 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -33,7 +33,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 diff --git a/lib/src/components/chips/chip.dart b/lib/src/components/chips/chip.dart index 8f181d8d..33c63c16 100644 --- a/lib/src/components/chips/chip.dart +++ b/lib/src/components/chips/chip.dart @@ -154,7 +154,10 @@ class _ZetaChipState extends State { return colors.surfaceDisabled; } if (selected) { - return colors.cool.shade90; + if (states.contains(WidgetState.hovered)) { + return colors.borderHover; + } + return colors.surfaceDefaultInverse; } if (states.contains(WidgetState.pressed) || isDragging) { return colors.surfaceSelected; @@ -168,7 +171,11 @@ class _ZetaChipState extends State { border: Border.fromBorderSide( BorderSide( color: _controller.value.contains(WidgetState.focused) ? colors.blue.shade50 : colors.borderDefault, - width: _controller.value.contains(WidgetState.focused) ? ZetaSpacingBase.x0_5 : 1, + width: _controller.value.contains(WidgetState.focused) + ? ZetaSpacingBase.x0_5 + : !selected + ? 1 + : 0, ), ), ), @@ -179,7 +186,7 @@ class _ZetaChipState extends State { AnimatedContainer( duration: Durations.short1, width: iconSize, - child: (widget.selected! + child: (selected ? Icon( widget.rounded ? ZetaIcons.check_mark_round : ZetaIcons.check_mark_sharp, color: widget.selected! ? colors.iconInverse : Colors.transparent, @@ -188,7 +195,7 @@ class _ZetaChipState extends State { ) else if (widget.leading != null) _renderLeading(foregroundColor), - if ((widget.selected != null && widget.selected!) || widget.leading != null) + if ((widget.selected != null && selected) || widget.leading != null) const SizedBox.square(dimension: ZetaSpacing.small), Text( widget.label,