oi-narendra / multiselect-dropdown

Streamlined Flutter widget for versatile multi-selection with extensive customization.
https://pub.dev/packages/multi_dropdown
GNU General Public License v3.0
73 stars 83 forks source link

Overlay Exception #126

Closed Alrfati-HazemY closed 3 months ago

Alrfati-HazemY commented 3 months ago

I’m using Bloc state management, where I’ve defined the following controller final gender = MultiSelectController<int>() in the cubit. And I have a page with a multi-step form, and I use this controller in the first step, which works fine. However, when I click the button to proceed to the second step, I destroy the first widget and display the second using BlocBuilder. If I then click the back button to return to the first widget, I encounter the following error:

Exception caught by foundation library package:flutter/src/widgets/overlay.dart': Failed assertion: line 1550 pos 14: '_zOrderIndex != null': is not true.

Maybe the solution will be the same as for the previous issue before the migration to V3. PR-12

TheFe91 commented 3 months ago

I've got the same issue, but using GetX as state manager. The Multidropdown is inside a Drawer, and as soon as it rebuilds I get the error mentioned above

moinkhan780 commented 3 months ago

Same for me.

Blankeye-zero commented 3 months ago

I believe this happens because of the same controller being reassigned to the newly created MultiSelectDropDown widget after being destroyed or reinserted into the widget tree.

When I do this, the error doesn't happen

controller: MultiSelectController<Benefactor>()

instead of assigning the controller as a final variable, I create them on the fly. The error disappears, but the options are limited as I cant use the controller in other parts of the code

edit: I get the dropdowncontroller disposed error if I do that; above is bs. Dont mind that;