AbdullahChauhan / custom-dropdown

Custom dropdown widget allows to add highly customizable dropdown widget in your projects. Features includes Search on list data, Network search, Multi-selection and many more.
https://pub.dev/packages/animated_custom_dropdown
BSD 3-Clause "New" or "Revised" License
158 stars 73 forks source link

Fix: onChanged not invoked after first invocation #76

Closed ravindrabarthwal closed 5 months ago

ravindrabarthwal commented 6 months ago

In the custom_dropdown.dart, the didUpdateWidget method changes the selectedItemNotifier and selectedItemsNotifier to a new instance when the widget configuration is inconsistent.

This causes two problems, first if the end user supplied the controller then it will be overriden. Secondly, new instance is not required, and even if created should have attached the listeners to the the new instance.

This commit solves the problem by updating the earlier instance of the notifier to the new value via SchedulerBinding. Also, the two examples have been changed to use the stateful widget, which solves the current problem.

karniv00l commented 5 months ago

Indeed, 3.1.0 is broken, and this PR fixes it, thanks!

AbdullahChauhan commented 5 months ago

Hey @ravindrabarthwal Thanks for the PR. Start reviewing this... @karniv00l Thanks for confirming!