Commit 3b577c53 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Clear the pointer absorbing flag after temporarily setting it while popping a route (#5036)

Fixes https://github.com/flutter/flutter/issues/4910
parent 76ea70a1
......@@ -492,7 +492,9 @@ class NavigatorState extends State<Navigator> {
// This mechanism is far from perfect. See the issue below for more details:
// https://github.com/flutter/flutter/issues/4770
RenderAbsorbPointer absorber = _overlayKey.currentContext?.ancestorRenderObjectOfType(const TypeMatcher<RenderAbsorbPointer>());
absorber?.absorbing = true;
setState(() {
absorber?.absorbing = true;
});
for (int pointer in _activePointers.toList())
WidgetsBinding.instance.cancelPointer(pointer);
}
......
......@@ -124,4 +124,54 @@ void main() {
await gesture.up();
});
testWidgets('Drawer navigator back button', (WidgetTester tester) async {
GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
bool buttonPressed = false;
await tester.pumpWidget(
new MaterialApp(
home: new Builder(
builder: (BuildContext context) {
return new Scaffold(
key: scaffoldKey,
drawer: new Drawer(
child: new Block(
children: <Widget>[
new Text('drawer'),
new FlatButton(
child: new Text('close'),
onPressed: () => Navigator.pop(context)
),
]
)
),
body: new Container(
child: new FlatButton(
child: new Text('button'),
onPressed: () { buttonPressed = true; }
)
)
);
}
)
)
);
// Open the drawer.
scaffoldKey.currentState.openDrawer();
await tester.pump(); // drawer should be starting to animate in
expect(find.text('drawer'), findsOneWidget);
// Tap the close button to pop the drawer route.
await tester.pump(new Duration(milliseconds: 100));
await tester.tap(find.text('close'));
await tester.pump();
await tester.pump(new Duration(seconds: 1));
expect(find.text('drawer'), findsNothing);
// Confirm that a button in the scaffold body is still clickable.
await tester.tap(find.text('button'));
expect(buttonPressed, equals(true));
});
}
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