DrawerController class

Provides interactive behavior for Drawer widgets.

Rarely used directly. Drawer controllers are typically created automatically by Scaffold widgets.

The drawer controller provides the ability to open and close a drawer, either via an animation or via user interaction. When closed, the drawer collapses to a translucent gesture detector that can be used to listen for edge swipes.

See also:

Inheritance

Constructors

DrawerController({GlobalKey<State<StatefulWidget>>? key, required Widget child, required DrawerAlignment alignment, bool isDrawerOpen = false, DrawerCallback? drawerCallback, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Color? scrimColor, double? edgeDragWidth, bool enableOpenDragGesture = true})
Creates a controller for a Drawer.
const

Properties

alignment DrawerAlignment
The alignment of the Drawer.
final
child Widget
The widget below this widget in the tree.
final
dragStartBehavior DragStartBehavior
Determines the way that drag start behavior is handled.
final
drawerCallback DrawerCallback?
Optional callback that is called when a Drawer is opened or closed.
final
edgeDragWidth double?
The width of the area within which a horizontal swipe will open the drawer.
final
enableOpenDragGesture bool
Determines if the Drawer can be opened with a drag gesture.
final
hashCode int
The hash code for this object.
no setterinherited
isDrawerOpen bool
Whether or not the drawer is opened or closed.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrimColor Color?
The color to use for the scrim that obscures the underlying content while a drawer is open.
final

Methods

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

Static Methods

maybeOf(BuildContext context) DrawerController?
The closest instance of DrawerController that encloses the given context, or null if none is found.
of(BuildContext context) DrawerController
The closest instance of DrawerController that encloses the given context.