ElEvent class

ElListener 的基础上再进行一层封装,使其支持单击、双击、三击、右键、长按、悬停等功能, 该小部件不参与手势竞技场,使用它相当于直接使用 Listener 监听原始指针, 相互嵌套会产生事件冒泡,要阻止冒泡可以插入 ElStopPropagation 小部件

Inheritance
Available extensions

Constructors

ElEvent({Key? key, Widget? child, HitTestBehavior? behavior, bool? disabled, PointerDownEventListener? onPointerDown, PointerUpEventListener? onPointerUp, PointerMoveEventListener? onPointerMove, PointerPanZoomStartEventListener? onPointerPanZoomStart, PointerPanZoomUpdateEventListener? onPointerPanZoomUpdate, PointerPanZoomEndEventListener? onPointerPanZoomEnd, PointerSignalEventListener? onPointerSignal, VoidCallback? onCancel, bool? ignoreStatus, bool? ignoreHover, bool? delayTapForDouble, int? activeThrottle, bool? feedback, MouseCursor? cursor, MouseCursor? disabledCursor, PointerEnterEventListener? onEnter, PointerExitEventListener? onExit, PointerHoverEventListener? onHover, VoidCallback? onActivate, VoidCallback? onTap, GestureTapDownCallback? onTapDown, GestureTapUpCallback? onTapUp, VoidCallback? onDoubleTap, VoidCallback? onTripleTap, GestureTapDownCallback? onLongPress, LongPressGestureRecognizer? longPressGestureRecognizer, VoidCallback? onSecondaryTap, GestureTapDownCallback? onSecondaryTapDown, GestureTapUpCallback? onSecondaryTapUp, VoidCallback? onTertiaryTap, GestureTapDownCallback? onTertiaryTapDown, GestureTapUpCallback? onTertiaryTapUp, VoidCallback? onForwardTap, VoidCallback? onBackTap})
const

Properties

activeThrottle int?
给键盘事件回调 onActivate 添加节流时间
final
behavior HitTestBehavior
命中测试行为,默认:HitTestBehavior.deferToChild,事件命中的三个行为有以下特征:
finalinherited
builder TransitionBuilder?
finalinherited
child Widget?
finalinherited
cursor MouseCursor?
鼠标悬停光标样式
final
delayTapForDouble bool?
如果存在双击事件,是否延迟 onTap 的执行,若触发了双击事件,那么 onTap 将不会触发, 将该属性设置为 true 将与 GestureDetector 的双击事件逻辑一致,默认 false,
final
disabled bool
是否禁用事件,此属性相当于嵌套一个 IgnorePointer 小部件,它会忽略自身以及后代所有指针事件
finalinherited
disabledCursor MouseCursor?
指针被禁用时悬停光标样式
final
feedback bool?
是否启用长按反馈,在移动端默认为 true
final
hashCode int
The hash code for this object.
no setterinherited
ignoreHover bool?
是否忽略悬停小部件,若为 true 将不会构建 MouseRegion 小部件
final
ignoreStatus bool?
是否忽略交互状态,若为 true 将不会注入 hasHover、hasTap 变量
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
longPressGestureRecognizer LongPressGestureRecognizer?
自定义长按手势(适用于需要监听更多长按相关的事件,但不要在自定义对象上监听 onLongPress 事件,它会被 onLongPress 覆盖)
final
onActivate VoidCallback?
监听按键激活事件,若此事件不为 null,将会构建 Actions 小部件, 它会捕获后代 Focus 聚焦事件,当得到焦点时,按下 enter 键将触发此回调
final
onBackTap VoidCallback?
点击了鼠标后退按钮(只响应最内层的事件)
final
onCancel VoidCallback?
通用的指针取消事件
finalinherited
onDoubleTap VoidCallback?
主指针双击事件,只有当主指针快速点击 2 次时才触发
final
onEnter PointerEnterEventListener?
鼠标进入事件
final
onExit PointerExitEventListener?
鼠标离开事件
final
onForwardTap VoidCallback?
点击了鼠标前进按钮(只响应最内层的事件)
final
onHover PointerHoverEventListener?
原始指针悬停事件
finalinherited
onLongPress GestureTapDownCallback?
长按事件,只有当主指针按下一段时间后才触发,当长按触发时 onTap 不会执行,但 onTapUp 依然会执行(只响应最内层的事件)
final
onPointerDown PointerDownEventListener?
原始指针按下事件
finalinherited
onPointerMove PointerMoveEventListener?
原始指针移动事件
finalinherited
onPointerPanZoomEnd PointerPanZoomEndEventListener?
finalinherited
onPointerPanZoomStart PointerPanZoomStartEventListener?
这三个事件用于监听平移、缩放
finalinherited
onPointerPanZoomUpdate PointerPanZoomUpdateEventListener?
finalinherited
onPointerSignal PointerSignalEventListener?
鼠标滚轮事件
finalinherited
onPointerUp PointerUpEventListener?
原始指针抬起事件
finalinherited
onSecondaryTap VoidCallback?
设备第二个按钮指针事件,通常对应鼠标右键事件(只响应最内层的事件)
final
onSecondaryTapDown GestureTapDownCallback?
final
onSecondaryTapUp GestureTapUpCallback?
final
onTap VoidCallback?
主指针点击事件(支持事件冒泡)
final
onTapDown GestureTapDownCallback?
主指针按下事件,它存在 1 毫秒延迟(支持事件冒泡)
final
onTapUp GestureTapUpCallback?
主指针抬起事件,它会在指定延迟后触发:tapUpDelay(支持事件冒泡)
final
onTertiaryTap VoidCallback?
设备第三个按钮指针事件,通常对应鼠标中间按钮事件(只响应最内层的事件)
final
onTertiaryTapDown GestureTapDownCallback?
final
onTertiaryTapUp GestureTapUpCallback?
final
onTripleTap VoidCallback?
在主指针触发了双击后,在短时间内再次点击将触发三击事件,注意 onDoubleTap 不能为空,否则永远不会触发三击事件
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() RenderObjectElement
RenderObjectWidgets always inflate to a RenderObjectElement subclass.
override
createRenderObject(BuildContext context) RenderObject
Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.
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
didUnmountRenderObject(covariant RenderObject renderObject) → void
This method is called when a RenderObject that was previously associated with this widget is removed from the render tree. The provided RenderObject will be of the same type as the one created by this widget's createRenderObject method.
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
updateRenderObject(BuildContext context, covariant RenderObject renderObject) → void
Copies the configuration described by this RenderObjectWidget to the given RenderObject, which will be of the same type as returned by this object's createRenderObject.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

hasHover(BuildContext context) bool
从当前上下文获取悬停状态
hasTap(BuildContext context) bool
从当前上下文获取点击状态