duytq94 / flutter-intro-slider

Simple and configurable app introduction slider for Flutter
https://pub.dartlang.org/packages/intro_slider
MIT License
677 stars 141 forks source link

setState doesn't update the ui #59

Closed ramioooz closed 2 years ago

ramioooz commented 4 years ago

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

dkashkin commented 4 years ago

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 :(

xJon commented 3 years ago

Experiencing the same issue.

BadriBarmaja commented 3 years ago

same issue !!

HadenHiles commented 3 years ago

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.

morphingcoffee commented 2 years ago

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.

duytq94 commented 2 years ago

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