flutter_portal
1.1.4, released 3 years ago by cjycode.com
Declarative replacement for Flutter's Overlay and OverlayEntry with built-in alignment.
What it does
Provides a declarative way to show floating overlays like tooltips, menus, and dialogs directly inside the widget tree. It handles target alignment, keeps intuitive BuildContext access for themes and providers, and supports easy state restoration.
AI-written summary of version 1.1.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to show contextual menus, tooltips, or dropdowns declaratively
- You want overlay entries to inherit the correct Theme and providers from their intuitive parent context
Skip it when
- You are satisfied with using the imperative built-in Overlay and OverlayEntry classes
Strengths
- Declarative API integrated into the normal widget tree
- Intuitive parent context for theme and provider access
- Built-in alignment support via anchors like Aligned and Filled
Weaknesses
- Requires wrapping the app or route with a Portal widget
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Add the Portal widget near the root of the app, such as above MaterialApp.
PortalTarget(
portalFollower: MyAwesomeOverlayWidget(),
anchor: Aligned.center,
child: MyChildWidget(),
)Alternatives
Packages that do the same job and could replace flutter_portal.
- flutter_anchor
Core widgets for connecting floating overlays and tooltips to anchor widgets.
61Compare
Works with
Packages commonly used together with flutter_portal: ones it builds on, ones built on it, and its own family.
- vector_mathflutter_portal depends on itVector math library for 2D/3D/4D vectors, matrices, quaternions, and geometry.
- stream_chat_flutterBuilt on flutter_portalFull-featured Flutter UI SDK for Stream Chat, providing ready‑made chat widgets and theming.
- flutter_mentionsBuilt on flutter_portalA simple flutter input widget to add @ mentions functionality to your app.
- multi_trigger_autocompleteBuilt on flutter_portalWidget that adds trigger‑based autocomplete to text fields