Commit fcb30719 authored by Hixie's avatar Hixie

Fix crash in Block.

This assert was overzealous. You can update a RawGestureDetector any
time before the semantics phase, it doesn't have to only be during your
child's layout.

This is good because Block has additional PointerListeners between its
GestureDetector and its Viewport.
parent 13b8777f
......@@ -279,22 +279,8 @@ class RawGestureDetectorState extends State<RawGestureDetector> {
/// the gesture detector should be enabled.
void replaceGestureRecognizers(Map<Type, GestureRecognizerFactory> gestures) {
assert(() {
RenderObject renderObject = context.findRenderObject();
if (!config.excludeFromSemantics) {
assert(renderObject is RenderSemanticsGestureHandler);
RenderSemanticsGestureHandler semanticsGestureHandler = renderObject;
renderObject = semanticsGestureHandler.child;
}
assert(renderObject is RenderPointerListener);
RenderPointerListener pointerListener = renderObject;
renderObject = pointerListener.child;
if (!renderObject.debugDoingThisLayout) {
throw new WidgetError(
'replaceGestureRecognizers() can only be called during the layout phase of the GestureDetector\'s nearest descendant RenderObjectWidget.\n'
'In this particular case, that is:\n'
' $renderObject'
);
}
if (!RenderObject.debugDoingLayout)
throw new WidgetError('replaceGestureRecognizers() can only be called during the layout phase.');
return true;
});
_syncAll(gestures);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment