darioielardi / flutter_speed_dial

Flutter plugin to implement a Material Design Speed Dial
https://pub.dev/packages/flutter_speed_dial
MIT License
410 stars 177 forks source link

Change the dispose order and dispose the overlayEntry first #299

Closed bobekos closed 1 year ago

bobekos commented 1 year ago

I had the same problems as described in ticket #297. After I changed the order of the dispose function by disposing the entry overlay first, the error does not appear anymore.

Due to the error described in the ticket, the background was not cleared properly for an app running in profile/release mode. So the background was still drawed also when the user has pop/push another page.

Also working with ValueNotifier led to the same error.

I think maybe it has something to do with the order how the overlays are inserted. So we can see here:

if (widget.renderOverlay) Overlay.of(context)!.insert(backgroundOverlay!);
Overlay.of(context)!.insert(overlayEntry!);

So the insert method (if below and above attributes are null) insert the overlay always on top. In this case first the backgroundOverlay and then the entryOverlay.

I think the dispose order should be then from the top stack so at first the entry and then the background. And this was not the case.

prateekmedia commented 1 year ago

Does it work?

bobekos commented 1 year ago

@prateekmedia

Yeah after the change the error no longer appears. Of course I don't know if these changes have any side effects but I couldn't find any problems.

bobekos commented 1 year ago

290 should also been fixed by this PR