ElPointerProxyHandler class
在小部件树中较高层级创建一个代理事件小部件,它会代理后代 ElPointerProxy 的命中测试, 解决 hitTestSelf 被剔除的事件命中问题:https://github.com/flutter/flutter/issues/75747
注意:不要无脑将所有代理小部件都指向根节点,因为命中测试执行频率非常高,在桌面端,鼠标只要放在上面即使不进行任何操作, 每秒钟都会重复执行几十上百次 hitTest 方法,这也是为什么 Flutter 官方死活不愿意修复此问题, 甚至觉得添加一个 bool 判断都会影响性能。
请尽可能在局部需要的地方添加代理,可以在根节点添加,只是不要全部指向根节点就行。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ElPointerProxyHandler
- Available extensions
Constructors
- ElPointerProxyHandler({Key? key, String? debugName, required Widget child})
-
const
Properties
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ElPointerProxyHandler> -
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