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
Data not being updated in stateful widget. #4
Comments
Hello, In most of my libraries, I try to make use of Flutter's cache system. I hope I am doing it right but I am not 100% sure 😃 Most probably, that's the problem. I can recommend two things which I believe can fix this problem:
|
Mate u just Blow it 😁😁❤❤💥💥💥💥💥 the option N.1 solved the problem and the next one taught me something new in flutter world 😁 Note:
|
I am glad to have helped. Let me know if you have any other questions. |
well sadly I'm facing another issue for onPress() methods. as I send some data to onPressed() method, the next time I update the data and call the onPress() it returns the first-time-received value. the following sample may be more clear: `
no matter how many times I send new data. the onPress() will always return the first option. |
Yes this is actually a problem I also had and I did make some revisions to the code to fix it but I haven't updated the library on Github or Pubdev yet. Until I do, can you try making your SpringButton a Stateful Widget? I think that should solve the problem. |
actually it is in stful widget rn. what do you mean exactly? |
What I mean is, use a Stateful Widget that returns only the SpringButton. At the moment, your SpringButton might be a part of a Stateful Widget with a larger widget tree and it is possible that Flutter stops rebuilding the widget before arriving to the SpringButton itself. At least, this is my understanding of Flutter. So two things you can try: ` class _MySpringButtonState extends State {
I know neither of these are ideal solutions but until I release an update, you can use these so your development isn't halted. Then you can simply replace them. |
aha now i get it. well both solutions made it laggy on android 4.4 to 6 ... |
Thats weird, I can understand the second solution causing a lag but the first one should have been fine. Anyway, I will leave this issue open and notify you when I release an update to fix the problem 👍🏻 |
actually I was testing on emulators. maybe on real device it would work fine. any ways i would be glad to help you on this if you're busy .. |
Well I already have a version that is almost ready but of course feel free to commit, I would appreciate it. |
Hello. Any update? |
Hello and I'm sorry, I have been very busy these days. |
Hello and thanks for your time. |
Hi again. I released a prerelease version coded 1.0.14-beta which is available both on GitHub and at https://pub.dev/packages/spring_button/versions#dev. I believe it fixes the problem. However, additionally, I tested and saw that simply adding the line
to your code where SpringButtons are generated also works. So you can solve your issue however you prefer. |
Thanks a lot for your time. Thank you again. 💖💖💖 |
No problem! Let me know if you need any more help and remember the "key" property of Flutter, its very useful😉 |
Yes guess I have to keep learning it in schedule. Actually I was using a key for animations and didnt know how to use 2 keys at same time. |
first of all Thanks for the great Library
when trying to change its data after button pressed nothing happens in the UI. onPress() works correctly and changes the data I want (I can see it is changed using print()) but in the UI the button stays the same as it was since the beginning. or maybe im not using the library properly...
heres the code:
the
options
is the data coming from the database and after each click should change but what happens is that data updates inoptions
but nothing happens in UI.The text was updated successfully, but these errors were encountered: