Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget state attributes are not updated when widget updates #146

Open
lhengl opened this issue Sep 2, 2024 · 0 comments
Open

Widget state attributes are not updated when widget updates #146

lhengl opened this issue Sep 2, 2024 · 0 comments

Comments

@lhengl
Copy link

lhengl commented Sep 2, 2024

Hi first off, great package.

However, what I noticed is that when I change attributes in the widget, it is not reflected in the UI. This is because the attributes are stored in the state object during initState, so doing a rebuild of the IntroSlider widget will not update the UI. This is not a great user experience when trying to set up the widget for the first time using hot reload to see the changes in the UI.

May I suggest we add a didWidgetUpdate() in the state class or using the widget attributes directly rather than saving them as a state variable? What I noticed is that they are mostly defined as late final anyway, why not just refer to them as widget.attribute?

The workaround has been to use a UniqueKey() to force the widget to re-initialise itself on each refresh - however I feel that this must not be very efficient in the case where we need to change the widget attribute frequently (an example I could think of is when we need to enable/disable navigation based on some validation rules as user inputs data).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant