ElPopup class

基于 ElOverlay 实现的弹出层小部件,构建的浮层由 ElOverlay 绘制,显示、隐藏弹窗支持状态保留

Inheritance
Implementers
Available extensions

Constructors

ElPopup({Key? key, ValueChanged<bool?>? onChanged, dynamic show, Duration? duration, Object? overlayId, ElOverlayState? overlayState, bool rootOverlay = false, bool keepAlive = false, bool preventBack = false, VoidCallback? onInsert, VoidCallback? onRemove, required Widget transitionBuilder(BuildContext context, Widget child), required Widget overlayBuilder(BuildContext context), required Widget builder(BuildContext context, ElPopupState<ElPopup> state)})
const

Properties

builder Widget Function(BuildContext context, ElPopupState<ElPopup> state)
构建代理子组件
final
duration Duration?
弹出层的过渡时间,默认 El.duration
final
hashCode int
The hash code for this object.
no setterinherited
keepAlive bool
关闭弹出层时是否保留状态
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
modelType ElModelValueType
双向绑定类型
finalinherited
modelValue → dynamic
支持基础数据类型和响应式变量,如果变量类型为 ValueNotifier, 则无需监听 onChanged 方法手动更新 UI。以 ElSwitch 组件为例:
finalinherited
onChanged ValueChanged<bool?>?
变量更新通知方法
finalinherited
onInsert VoidCallback?
插入弹出层回调
final
onRemove VoidCallback?
移除弹出层回调
final
overlayBuilder Widget Function(BuildContext context)
构建弹出层小部件
final
overlayId Object?
指定弹出层的 id 标识,默认为当前 State 的 hashCode,如果弹出层的 State 生命周期不稳定, 你应当指定弹出层的 id 标识,这样可以避免一些意外的 bug。
final
overlayState ElOverlayState?
将弹出层直接挂载到指定的 ElOverlay 实例上
final
preventBack bool
是否拦截物理返回(仅限安卓)
final
rootOverlay bool
将弹出层挂载到顶级 ElOverlay 实例上
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
show → dynamic
手动控制弹出层的显示隐藏(支持双向绑定)
final
transitionBuilder Widget Function(BuildContext context, Widget child)
构建弹出层动画
final

Methods

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

of(BuildContext context) ElPopupState<ElPopup>
访问弹出层实例对象,只能在 transitionBuilderoverlayBuilder 中访问