flutter-intro-slider icon indicating copy to clipboard operation
flutter-intro-slider copied to clipboard

setState doesn't update the ui

Open ramioooz opened this issue 5 years ago • 5 comments

Hello developer,

thank you for the nice package your developed,

I created some intro slides following your tutorial, in the first slide I have a DropdownButton I use to change my app language. on value change of the drop down button I call setState to rebuild the slide with new changes applied to it.

but the problem is now matter how I tried, setState never update the UI. I don't know why. I hope you have a fix for that.

Thank you

ramioooz avatar Jan 01 '20 23:01 ramioooz

Same problem here! I added a SwitchListTile to one of my intro slides, the onChanged even works but when I call setState inside my onChanged event handler, the widget fails to reflect the new status of the slider :(

dkashkin avatar Oct 01 '20 02:10 dkashkin

Experiencing the same issue.

xJon avatar Jan 20 '21 18:01 xJon

same issue !!

BadriBarmaja avatar Feb 22 '21 20:02 BadriBarmaja

Has anyone found a viable solution for this issue? I'm trying to let my users set their theme mode (light vs dark) in one of my slides. Without the ability to use state variables pretty much any method I try to visually show them which theme is active won't work.

HadenHiles avatar May 19 '21 13:05 HadenHiles

Had a similar case as @HadenHiles as I'm trying to instantly showcase colour theming of the app.

I have a workaround that works for me just because I present theming options for the users on the very first Slide. It may not suit everyone and it's not a long-term solution everyone should adopt.

However, I needed to add a Key parameter to IntroSlider so that I could instruct Flutter to rebuild the whole IntroSlider from scratch. Workaround gist here

@duytq94 if there was no technical reason to exclude key from the constructor, it could be a trivial addition for those making use of it.

morphingcoffee avatar Nov 24 '21 22:11 morphingcoffee

Thanks @morphingcoffee Currently, we using key to make setState work Screen Shot 2022-09-22 at 5 38 49 PM

duytq94 avatar Sep 22 '22 10:09 duytq94