Dn-a / flutter_tags

With flutter tags you can create selectable or input tags that automatically adapt to the screen width
https://pub.dartlang.org/packages/flutter_tags
MIT License
508 stars 124 forks source link

How to select a single item. #2

Closed monxarat closed 5 years ago

monxarat commented 5 years ago

Hi guys,

How to select a single item.

Dn-a commented 5 years ago

@monxarat be more specific ... are you referring to selectable tags or to Input Tags?

monxarat commented 5 years ago

I have used the selectable tag. I have not found any code handle this issue.

Dn-a commented 5 years ago

Have you tried this? onPressed: (tag){ print(tag.title);// tag object },

monxarat commented 5 years ago

What do you mean? I want Single Selection(same Radiobutton group), not Multiselection(same CheckBox)

Dn-a commented 5 years ago

now it's clearer ... I'll implement this feature in future versions. now you could do something like that: _singleCheck(Tag tag){ _tags.where((tg) => tg.active).forEach((tg) { tg.active=false; } )); setState(){ tag.active=true; } }

// in onPressed method onPressed:(tag){ _singleCheck(tag); }

I have not tried yet...I do not know if it works

Dn-a commented 5 years ago

@monxarat I added this feature in the new version 0.1.7. I await your confirmation to close this issuse

monxarat commented 5 years ago

@Dn-a thank you very much