Problem to solve
When working with dialogs implemented as overlays, it would be neat to be able to register a callback on the overlays manager to for example play/pause the game when certain overlays are added.
To do that now you have to make wrappers around add/remove/toggle/setActive and make sure you call those and not Game.overlays directly through your app.
Proposal
Add a addListener() function to OverlayManager, that allow registering a method that will be called whenever the list of active overlays changes.
More information
On one hand it would be nice to get context in the callback, but I think it is better to follow the overall pattern in Flutter to not provide any context to the listener so it is easier in the future to extend cases it gets triggered and leave it up to the user to detect what changed or just re-compute other states based on overlays state.
Other
Problem to solve
When working with dialogs implemented as overlays, it would be neat to be able to register a callback on the overlays manager to for example play/pause the game when certain overlays are added.
To do that now you have to make wrappers around add/remove/toggle/setActive and make sure you call those and not Game.overlays directly through your app.
Proposal
Add a addListener() function to OverlayManager, that allow registering a method that will be called whenever the list of active overlays changes.
More information
On one hand it would be nice to get context in the callback, but I think it is better to follow the overall pattern in Flutter to not provide any context to the listener so it is easier in the future to extend cases it gets triggered and leave it up to the user to detect what changed or just re-compute other states based on overlays state.
Other