Commit 7fd36910 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Heroes in flight shouldn't be interactive (#5246)

After this patch, they ignore pointers.
parent 326bb212
......@@ -301,9 +301,11 @@ class _HeroQuestState implements HeroHandle {
size: animationArea.size,
child: new RotationTransition(
turns: currentTurns.animate(animation),
child: new RepaintBoundary(
key: key,
child: child
child: new IgnorePointer(
child: new RepaintBoundary(
key: key,
child: child
)
)
)
);
......
......@@ -176,4 +176,75 @@ void main() {
await tester.pump(new Duration(milliseconds: 10));
await tester.pump(new Duration(seconds: 1));
});
testWidgets('Heroes are not interactive', (WidgetTester tester) async {
List<String> log = <String>[];
await tester.pumpWidget(new MaterialApp(
home: new Center(
child: new Hero(
tag: 'foo',
child: new GestureDetector(
onTap: () {
log.add('foo');
},
child: new Container(
width: 100.0,
height: 100.0,
child: new Text('foo')
)
)
)
),
routes: <String, WidgetBuilder>{
'/next': (BuildContext context) {
return new Align(
alignment: FractionalOffset.topLeft,
child: new Hero(
tag: 'foo',
child: new GestureDetector(
onTap: () {
log.add('bar');
},
child: new Container(
width: 100.0,
height: 150.0,
child: new Text('bar')
)
)
)
);
}
}
));
expect(log, isEmpty);
await tester.tap(find.text('foo'));
expect(log, equals(<String>['foo']));
log.clear();
NavigatorState navigator = tester.state(find.byType(Navigator));
navigator.pushNamed('/next');
expect(log, isEmpty);
await tester.tap(find.text('foo'));
expect(log, isEmpty);
await tester.pump(new Duration(milliseconds: 10));
await tester.tap(find.text('foo'));
expect(log, isEmpty);
await tester.tap(find.text('bar'));
expect(log, isEmpty);
await tester.pump(new Duration(milliseconds: 10));
expect(find.text('foo'), findsNothing);
await tester.tap(find.text('bar'));
expect(log, isEmpty);
await tester.pump(new Duration(seconds: 1));
expect(find.text('foo'), findsNothing);
await tester.tap(find.text('bar'));
expect(log, equals(<String>['bar']));
});
}
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