Skip to content

Commit

Permalink
fixed filter chip colors, border and alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jun 12, 2024
1 parent 526201f commit faaddd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions lib/src/components/chips/chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ class _ZetaChipState extends State<ZetaChip> {
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;
Expand All @@ -168,7 +171,11 @@ class _ZetaChipState extends State<ZetaChip> {
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,
),
),
),
Expand All @@ -179,7 +186,7 @@ class _ZetaChipState extends State<ZetaChip> {
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,
Expand All @@ -188,7 +195,7 @@ class _ZetaChipState extends State<ZetaChip> {
)
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,
Expand Down

0 comments on commit faaddd0

Please sign in to comment.