ElDrawer class

Element UI 抽屉组件。

提示:建议在每个路由页面单独设置 ElOverlay,否则弹窗会覆盖新跳转的页面。

Inheritance
Available extensions

Constructors

ElDrawer({Key? key, dynamic show, Object? overlayId, bool keepAlive = true, VoidCallback? onInsert, VoidCallback? onRemove, ValueChanged<bool?>? onChanged, required Widget overlayBuilder(BuildContext context), Widget? child, bool? enabledDragFeedback, double? dragShowThreshold, double? dragHideThreshold, bool? enabledDrag, double? maxPrimarySize, AxisDirection direction = AxisDirection.left, Color? modalColor, bool ignoreModalPointer = false})
const

Properties

builder Widget Function(BuildContext context, ElPopupState<ElPopup> state)
构建代理子组件
finalinherited
child Widget?
final
direction AxisDirection
抽屉打开方向,支持上下左右 4 种方向
final
dragHideThreshold double?
触发拖拽隐藏阈值,默认 0.5
final
dragShowThreshold double?
触发拖拽显示阈值,如果小于 1.0,则以百分比计算,否则以实际像素计算,默认 0.5
final
duration Duration?
弹出层的过渡时间,默认 El.duration
finalinherited
enabledDrag bool?
启用拖拽关闭抽屉,若为 null,移动端将默认为 true,桌面端则为 false
final
enabledDragFeedback bool?
是否开启拖拽抽屉触发关闭阈值震动提醒
final
hashCode int
The hash code for this object.
no setterinherited
ignoreModalPointer bool
忽略模态框指针事件
final
keepAlive bool
关闭弹出层时是否保留状态
finalinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxPrimarySize double?
抽屉展开方向的最大尺寸,如果取值范围是:0.0 ~ 1.0,则按百分比决定抽屉尺寸,否则以正常像素决定抽屉尺寸; 默认情况下,垂直展开 maxPrimarySize 将为 0.5,水平展开则为 300.0。
final
modalColor Color?
模态框背景颜色
final
modelType ElModelValueType
双向绑定类型
finalinherited
modelValue → dynamic
支持基础数据类型和响应式变量,如果变量类型为 ValueNotifier, 则无需监听 onChanged 方法手动更新 UI。以 ElSwitch 组件为例:
finalinherited
onChanged ValueChanged<bool?>?
变量更新通知方法
finalinherited
onInsert VoidCallback?
插入弹出层回调
finalinherited
onRemove VoidCallback?
移除弹出层回调
finalinherited
overlayBuilder Widget Function(BuildContext context)
构建弹出层小部件
finalinherited
overlayId Object?
指定弹出层的 id 标识,默认为当前 State 的 hashCode,如果弹出层的 State 生命周期不稳定, 你应当指定弹出层的 id 标识,这样可以避免一些意外的 bug。
finalinherited
overlayState ElOverlayState?
将弹出层直接挂载到指定的 ElOverlay 实例上
finalinherited
preventBack bool
是否拦截物理返回(仅限安卓)
finalinherited
rootOverlay bool
将弹出层挂载到顶级 ElOverlay 实例上
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
show → dynamic
手动控制弹出层的显示隐藏(支持双向绑定)
finalinherited
transitionBuilder Widget Function(BuildContext context, Widget child)
构建弹出层动画
finalinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ElDrawer>
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
noScrollbarBehavior(BuildContext context, {Key? key, bool? overscroll, bool enabled = true}) Widget

Available on Widget, provided by the FlutterWidgetExt extension

不使用祖先提供的默认滚动条,当使用自定义滚动条时请添加此扩展方法,防止与祖先提供的默认滚动条重叠
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, int wrapWidth = 65}) 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 Properties

springDescription SpringDescription
抽屉动画由 spring 驱动,此对象定义了抽屉的质量与动量,你可以在 main 方法中修改它调整抽屉的动画曲线, 官方提供的 Drawer 参数分别为 1.0、500.0
getter/setter pair

Static Methods

createBoxConstraints({required bool isVertical, required Size drawerMaxSize}) BoxConstraints
创建抽屉盒子约束
createSimulation({required AnimationController controller, double velocity = 1.0}) Simulation
创建抽屉物理动画