diff --git a/packages/flutter/lib/src/widgets/heroes.dart b/packages/flutter/lib/src/widgets/heroes.dart index c3ac4303bc..aa7ac7cd61 100644 --- a/packages/flutter/lib/src/widgets/heroes.dart +++ b/packages/flutter/lib/src/widgets/heroes.dart @@ -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 + ) ) ) ); diff --git a/packages/flutter/test/widget/heroes_test.dart b/packages/flutter/test/widget/heroes_test.dart index 5e5fb0227a..029dc4910f 100644 --- a/packages/flutter/test/widget/heroes_test.dart +++ b/packages/flutter/test/widget/heroes_test.dart @@ -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 log = []; + + 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: { + '/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(['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(['bar'])); + }); + }