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
Conditional value change #33
Conversation
Allows to set the widget's value conditionally
Add public parameter "value"
I am glad you liked this library. One of my main focus was in providing a simple approach to creating settings screen without losing focus on what to add for setting instead of how to add it. Regarding this pull request, I am glad you found a way to add the confirmation in between value change events. I might be using a different approach to it, but the end goal is same more or less. I'll try to include your contribution to it as much as possible. I am really glad you liked & helped improving this library. I am hoping to see more contributions from developers like you in future. |
https://github.com/GAM3RG33K/flutter_settings_screens/tree/feature_confirm_on_change You can give your input in this branch for the same feature. I have made this branch very quickly so that I can get your feedback on this, if you find anything to improve on let me know. I know there's much to improve in this feature which I will do eventually, but with your help it might get done quickly. |
Hey, I've looked into the branch and changes you proposed. I think we have different ideas about the problem in mind. Even though the additional dialog adds a conditional value by adding a dialog the user has to manually accept/deny, you don't want to use a dialog after the user either accepted/denied the OS dialog. The current switch always switches from We ran into our problem by setting the shared preferences key's value to Now I'll describe the behavior/feature we are looking for: To support this behavior, I can think of three solutions:
I've got some time to spare in mid-February and will give it a go |
That's totally different than what I though this would be. Thanks for explaning but just to be sure the End goal for your condition is to always prefer the given value for some widgets, right? Can you give me a small working example with some explanation in this use case? I just want to understand the complete use case before moving forward or else I might end up adding some random feature again. 😛 |
Right! So that if something got triggered in the onChange that basically says "No, don't change the setting to true", depending on how the user reacts, the setting does not change. A possible API for that could be:
The API of "use the return value of onChange" is just one option. It could also be a separate handler. Or, as in this PR, a value attribute set externally (but I personally think that's a bit less clean). This would really be helpful! :) |
Firstly, thank you for the package! It has been a great help at the beginning of our project.
In a later phase of our project, we've stumbled upon a missing feature conditional changing of the widget's value. To be more precise, we use a
SwitchSettingsTile
to manage in-app permissions including the initial request for these permissions.After a user hits the switch we ask him for his permission for the feature and based on the result of the request we want to adjust the widget's value. Currently, when the user denies the permission, the
SwitchSettingsTile
's value still changes fromfalse
(initial value) totrue
even though the user declines these permissions.As a suggested solution, we have added an optional
value
parameter to some widgets where conditional value changes could become handy. This way we can handle the state from within the parent widget.We are unsure if the suggested solution fits your intentions for the package and the coding style you've used. We'd appreciate it if you would take the time to review the PR and if desired propose a solution that is ok with you.