Member-only story

Flutter Awesome Way To Do Overlays

Fred Grott
2 min readJul 1, 2022

--

What the Google Flutter GDE’s will not tell you is that the Flutter SDK Overlay and OverlayEntry combo sucks, as it’s not declarative, and thus you cannot reliably theme it. I am going to show you instead how to use the Flutter Portal package, which is basically a declarative overlay system.

Flutter Portal

Flutter Portal was started by Remi Rousselet who is the original developer of the Provider package. It’s now kept up-to-date by Fzyzcjy:

Now, let me explain the small API. We have a Portal widget that has a child parameter and can have a PortalTarget and PortalFollower that are rendered. An Anchor tells how the PortalFollower element should be positioned in the layout in relation to the target. A PortalTarget will render its followers in a different part of the widget tree:

Flutter Portal API docs

--

--

Fred Grott
Fred Grott

No responses yet