How to get an event when PrefDialog "save" is pressed?
Closed this issue ยท 9 comments
Currently, the onPop() is called when the dialog is opened. If we want to do something when "Save" is pressed, what is the simplest way?
I have tried adding a TextButton to "submit" widget, and using its onPressed callback to achieve the same, but then I don't get the new value submitted, and I have to close the dialog myself by Navigator.pop().
Any ideas?
Edit: Adding a tappable widget to the "submit" widget also prevents the saving of new data to the settings in the dialog.
I just added onSubmit
and onDismiss
callbacks to the PrefDialogButton
class.
Test that and let me know if it works for you.
Thank you for the response.
That would be great, but I don't see these parameters in my version 2.3.0:
(new) PrefDialogButton PrefDialogButton({Widget? title, required PrefDialog dialog, Widget? subtitle, Widget? leading, Widget? trailing, void Function()? onPop, bool barrierDismissible = true})
Am I mission anything?
I see the code... v2.4.0 in latest commit!
How do I use that? direct git reference in pubspec.yaml or wait for you to publish on pub.dev?
Yes, please try it first with a direct git ref, then I'll publish it.
Perfect! works like a charm!
Thanks a zillion for the quick fix!
Flutter champions are the best! ๐ฏ ๐ฅ ๐
Don't hesitate to Buy Me A Coffee.
Yes, please try it first with a direct git ref, then I'll publish it.
Hi, can you please publish the recent version so I can lock my pubspec?
Done.
Thank you ๐