OpenContainer<T extends Object?> class

A container that grows to fill the screen to reveal new content when tapped.

While the container is closed, it shows the Widget returned by closedBuilder. When the container is tapped it grows to fill the entire size of the surrounding Navigator while fading out the widget returned by closedBuilder and fading in the widget returned by openBuilder. When the container is closed again via the callback provided to openBuilder or via Android's back button, the animation is reversed: The container shrinks back to its original size while the widget returned by openBuilder is faded out and the widget returned by closedBuilder is faded back in.

By default, the container is in the closed state. During the transition from closed to open and vice versa the widgets returned by the openBuilder and closedBuilder exist in the tree at the same time. Therefore, the widgets returned by these builders cannot include the same global key.

T refers to the type of data returned by the route when the container is closed. This value can be accessed in the onClosed function.

See also:

Inheritance
Annotations

Constructors

OpenContainer({Key? key, Color closedColor = Colors.white, Color openColor = Colors.white, Color? middleColor, double closedElevation = 1.0, double openElevation = 4.0, ShapeBorder closedShape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))), ShapeBorder openShape = const RoundedRectangleBorder(), ClosedCallback<T?>? onClosed, required CloseContainerBuilder closedBuilder, required OpenContainerBuilder<T> openBuilder, bool tappable = true, Duration transitionDuration = const Duration(milliseconds: 300), ContainerTransitionType transitionType = ContainerTransitionType.fade, bool useRootNavigator = false, RouteSettings? routeSettings, Clip clipBehavior = Clip.antiAlias})
Creates an OpenContainer.
const

Properties

clipBehavior Clip
The closedBuilder will be clipped (or not) according to this option.
final
closedBuilder CloseContainerBuilder
Called to obtain the child for the container in the closed state.
final
closedColor Color
Background color of the container while it is closed.
final
closedElevation double
Elevation of the container while it is closed.
final
closedShape ShapeBorder
Shape of the container while it is closed.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
middleColor Color?
The color to use for the background color during the transition with ContainerTransitionType.fadeThrough.
final
onClosed ClosedCallback<T?>?
Called when the container was popped and has returned to the closed state.
final
openBuilder OpenContainerBuilder<T>
Called to obtain the child for the container in the open state.
final
openColor Color
Background color of the container while it is open.
final
openElevation double
Elevation of the container while it is open.
final
openShape ShapeBorder
Shape of the container while it is open.
final
routeSettings RouteSettings?
Provides additional data to the openBuilder route pushed by the Navigator.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tappable bool
Whether the entire closed container can be tapped to open it.
final
transitionDuration Duration
The time it will take to animate the container from its closed to its open state and vice versa.
final
transitionType ContainerTransitionType
The type of fade transition that the container will use for its incoming and outgoing widgets.
final
useRootNavigator bool
The useRootNavigator argument is used to determine whether to push the route for openBuilder to the Navigator furthest from or nearest to the given context.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<OpenContainer<T?>>
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.
inherited
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