NikhilVadoliya/FlutterAnimatedButton

Need a way to toggle between selected or unselected programmatically without user interaction

kkbear1985 opened this issue · 6 comments

Is your feature request related to a problem? Please describe.
need it to implement a feature such that only 1 of multiple animated button is selected

Describe the solution you'd like
either expose the selected state by widget key or provide a toggle function for calling

Hey @kkbear1985 , Thanks for your suggestion. I will add one parameter in Widget.

Hey @kkbear1985 , I have implement this enhancement in plugin and upload it. please update package version

@NikhilVadoliya work perfectly, thanks very much

@NikhilVadoliya work perfectly, thanks very much

How did you do it? I used isSelected but I don't know how to implement select only one like shown in the app screenshot in readme in pub. dev

Hey @kkbear1985 , I have implement this enhancement in plugin and upload it. please update package version

How did you do it? I used isSelected but I don't know how to implement select only one like shown in the app screenshot in readme in pub. dev

Hey @marc-walton , Let go with 4 button with single selection

  • First you need to create four bool variable isSelected1, isSelected2, isSelected3 and isSelected4 and assign to each animatedButton.
  • Now, when user press on button1 then call setState method with set other three variable false ( isSelected2, isSelected3 and isSelected4) and isSelected1 is true.
  • Same do for other three button on press