DrawerScaffold class

An extended Scaffold with Drawer, mainly for making Drawer openable when PageView or TabBarView is overscrolled horizontally, and customizing more drawer drag triggers.

Inheritance

Constructors

DrawerScaffold({Key? key, required Widget body, Widget? drawer, Widget? endDrawer, bool drawerEnableOverscrollGesture = true, bool endDrawerEnableOverscrollGesture = true, CustomScrollPhysicsController? physicsController, void onPhysicsControllerChanged()?, bool checkPhysicsControllerForOverscroll = false, bool implicitlyOverscrollableBody = false, bool implicitlyOverscrollableScaffold = false, ScrollPhysics? implicitPageViewScrollPhysics, bool drawerEnableOpenDragGesture = true, bool endDrawerEnableOpenDragGesture = true, double? drawerEdgeDragWidth, double? endDrawerEdgeDragWidth, List<DrawerDragTrigger>? drawerExtraDragTriggers, List<DrawerDragTrigger>? endDrawerExtraDragTriggers, DragStartBehavior drawerDragStartBehavior = DragStartBehavior.start, Color? drawerScrimColor, DrawerCallback? onDrawerChanged, DrawerCallback? onEndDrawerChanged, Color? testColorForDrawerDragArea, Color? testColorForEndDrawerDragArea, Color? testColorForDrawerDragTriggers, Color? testColorForEndDrawerDragTriggers, PreferredSizeWidget? appBar, Widget? floatingActionButton, FloatingActionButtonLocation? floatingActionButtonLocation, FloatingActionButtonAnimator? floatingActionButtonAnimator, List<Widget>? persistentFooterButtons, Widget? bottomNavigationBar, Widget? bottomSheet, Color? backgroundColor, bool? resizeToAvoidBottomInset, bool primary = true, bool extendBody = false, bool extendBodyBehindAppBar = false, String? restorationId})
const

Properties

appBar PreferredSizeWidget?
final
backgroundColor Color?
final
body Widget
The body of this Scaffold. PageView or TabBarView in body will listened its scroll event, which will be used to control Drawer's opening.
final
bottomNavigationBar Widget?
final
bottomSheet Widget?
final
checkPhysicsControllerForOverscroll bool
The flag to decide whether to enable overscroll gesture for opening drawer and endDrawer or not, by checking given physicsController. Usually this field should be used when using nested DrawerScaffold, which can be use to synchronize drawer open state.
final
drawer Widget?
The drawer of this Scaffold, it will also be passed to origin Scaffold.
final
drawerDragStartBehavior DragStartBehavior
Mirrors to Scaffold.drawerDragStartBehavior.
final
drawerEdgeDragWidth double?
Mirrors to Scaffold.drawerEdgeDragWidth and for drawer. This field only works when drawerEnableOpenDragGesture is true.
final
drawerEnableOpenDragGesture bool
The flag to enable drag gesture to open drawer. This flag influences not only edge horizontal dragging (with drawerEdgeDragWidth), but also drawerExtraDragTriggers.
final
drawerEnableOverscrollGesture bool
The flag to enable PageView or TabBarView's overscroll gesture to open drawer. Note that this behavior is never related to drawerEnableOpenDragGesture.
final
drawerExtraDragTriggers List<DrawerDragTrigger>?
The extra DrawerDragTrigger for drawer, which can be used to enable more spaces to respond drag gesture for opening drawer, when drawerEnableOpenDragGesture is true.
final
drawerScrimColor Color?
Mirrors to Scaffold.drawerScrimColor.
final
endDrawer Widget?
The end drawer of this Scaffold, it will also be passed to origin Scaffold.
final
endDrawerEdgeDragWidth double?
Mirrors to Scaffold.drawerEdgeDragWidth but for endDrawer. This field only works when endDrawerEnableOpenDragGesture is true.
final
endDrawerEnableOpenDragGesture bool
The flag to enable drag gesture to open endDrawer. This flag influences not only edge horizontal dragging (with endDrawerEdgeDragWidth), but also endDrawerExtraDragTriggers.
final
endDrawerEnableOverscrollGesture bool
The flag to enable PageView or TabBarView's overscroll gesture to open endDrawer. Note that this behavior is never related to endDrawerEnableOpenDragGesture.
final
endDrawerExtraDragTriggers List<DrawerDragTrigger>?
The extra DrawerDragTrigger for endDrawer, which can be used to enable more spaces to respond drag gesture for opening endDrawer, when endDrawerEnableOpenDragGesture is true.
final
extendBody bool
final
extendBodyBehindAppBar bool
final
floatingActionButton Widget?
final
floatingActionButtonAnimator FloatingActionButtonAnimator?
final
floatingActionButtonLocation FloatingActionButtonLocation?
final
hashCode int
The hash code for this object.
no setterinherited
implicitlyOverscrollableBody bool
The flag to wrap implicit PageView to the whole body to make it be overscrollable, and make the drawer be openable when scrolling the body, defaults to false. Note that the priority of implicitlyOverscrollableScaffold is higher than this field.
final
implicitlyOverscrollableScaffold bool
The flag to wrap implicit PageView to the whole scaffold to make it be overscrollable, and make the drawer be openable when scrolling the scaffold, defaults to false. Note that the priority of this field is higher than implicitlyOverscrollableBody.
final
implicitPageViewScrollPhysics ScrollPhysics?
The scroll physics for implicit PageView, defaults to AlwaysScrollableScrollPhysics. Note that it is recommended to set this to the default value, or CustomScrollPhysics.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDrawerChanged DrawerCallback?
Mirrors to Scaffold.onDrawerChanged.
final
onEndDrawerChanged DrawerCallback?
Mirrors to Scaffold.onEndDrawerChanged.
final
onPhysicsControllerChanged → (void Function()?)
The callback that will be invoked when something in physicsController changed.
final
persistentFooterButtons List<Widget>?
final
physicsController CustomScrollPhysicsController?
The CustomScrollPhysicsController used in body. This controller is used to refine PageView or TabBarView's scroll physics when drawer is opening when and only when drawerEnableOverscrollGesture or endDrawerEnableOverscrollGesture is true.
final
primary bool
final
resizeToAvoidBottomInset bool?
final
restorationId String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
testColorForDrawerDragArea Color?
The color for testing drawer's drag area in DrawerController, default to null.
final
testColorForDrawerDragTriggers Color?
The color for testing drawer's drag triggers in DrawerScaffold, default to null.
final
testColorForEndDrawerDragArea Color?
The color for testing end drawer's drag area in DrawerController, default to null.
final
testColorForEndDrawerDragTriggers Color?
The color for testing end drawer's drag triggers in DrawerScaffold, default to null.
final

Methods

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

of(BuildContext context) DrawerScaffoldState?
Finds the DrawerScaffoldState from the closest instance of this class the encloses the given context.