C2ChipStyle selectedStyle and hoveredStyle
slavap opened this issue · 2 comments
With upgrading to version 3 I cannot figure out how to make hoveredStyle dynamic - I need to have different hovered color depending on which item I'm hovering on - one color for selected and another for non-selected chips.
Was a bit difficult to figure out this, should be documented better, but here is how you can apply colors to selected, unselected, hovered states for the chip.
ChipsChoice<String>.multiple(
wrapped: true,
mainAxisSize: MainAxisSize.min,
alignment: WrapAlignment.center,
value: ["Milk"],
onChanged: (allergens) {
print("Handle this");
},
choiceCheckmark: true,
choiceStyle: C2ChipStyle.filled(
// When selected
selectedStyle: C2ChipStyle(
checkmarkColor: Colors.white,
backgroundColor: Colors.red.shade900, // Background color
foregroundColor: Colors.white, // Text color
),
// When hovered
hoveredStyle: C2ChipStyle(
checkmarkColor: Colors.white,
backgroundColor: Colors.green.shade900, // Background color
foregroundColor: Colors.white, // Text color
),
// When Not selected
checkmarkColor: Colors.white,
color: Colors.grey.shade200, // Background
foregroundColor: Colors.black, // Text color
),
choiceItems: C2Choice.listFrom(
source: ["Egg", "Milk", "Flour"],
value: (i, v) => v,
label: (i, v) => v,
),
)
Hi everyone,
I'm sorry to announce that I'm no longer maintaining the chips_choice package. It's been a great project, but it's become too difficult to maintain.
In its place, I've released a new package called choice. The combination to smart_select and chips_choice with cleaner, more flexible, and composable API for creating inline or prompted choice widgets with single or multiple selection.
I hope you'll check out choice. I think you'll find it to be a great replacement for chips_choice.
Thanks for your understanding.