Portal class

The widget where a PortalTarget and its PortalFollower are rendered.

Portal can be considered as a reimplementation of Overlay to allow adding an OverlayEntry (now named PortalTarget) declaratively.

The Portal widget is used in coordination with the PortalTarget widget to show some content above other content. This is similar to Stack in principle, with the difference that a PortalTarget does not have to be a direct child of Portal and can instead be placed anywhere in the widget tree.

In most situations, Portal can be placed directly above MaterialApp:

Portal(
  child: MaterialApp(
  ),
);

This allows an overlay to render above everything including all routes. That can be useful to show a snackbar between pages.

You can optionally add a Portal inside your page:

Portal(
  child: Scaffold(
  ),
)

This way, your modals/snackbars will stop being visible when a new route is pushed.

Inheritance

Constructors

Portal({Key? key, String? debugName, List<PortalLabel> labels = const [PortalLabel.main], required Widget child})
const

Properties

child Widget
final
debugName String?
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labels List<PortalLabel>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _PortalState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited