This makes it easier for apps to control whether an IgnorePointer

widget is actively ignoring or not by changing a boolean instead of
the tree structure. ignoring defaults to true.
This commit is contained in:
Alex Fandrianto
2015-09-03 17:45:44 -07:00
parent bc169671c8
commit dde3dd9121
2 changed files with 13 additions and 4 deletions

View File

@@ -671,8 +671,10 @@ class RenderCustomPaint extends RenderProxyBox {
}
class RenderIgnorePointer extends RenderProxyBox {
RenderIgnorePointer({ RenderBox child }) : super(child);
RenderIgnorePointer({ RenderBox child, bool ignoring: true }) : super(child);
bool ignoring;
bool hitTest(HitTestResult result, { Point position }) {
return false;
return ignoring ? false : super.hitTest(result, position: position);
}
}

View File

@@ -899,8 +899,15 @@ class WidgetToRenderBoxAdapter extends LeafRenderObjectWrapper {
// EVENT HANDLING
class IgnorePointer extends OneChildRenderObjectWrapper {
IgnorePointer({ Key key, Widget child })
IgnorePointer({ Key key, Widget child, this.ignoring })
: super(key: key, child: child);
RenderIgnorePointer createNode() => new RenderIgnorePointer();
final bool ignoring;
RenderIgnorePointer createNode() => new RenderIgnorePointer(ignoring: ignoring);
RenderIgnorePointer get renderObject => super.renderObject;
void syncRenderObject(Widget old) {
super.syncRenderObject(old);
renderObject.ignoring = ignoring;
}
}