Heroes in flight shouldn't be interactive (#5246)
After this patch, they ignore pointers.
This commit is contained in:
parent
326bb21278
commit
7fd3691076
@ -301,9 +301,11 @@ class _HeroQuestState implements HeroHandle {
|
|||||||
size: animationArea.size,
|
size: animationArea.size,
|
||||||
child: new RotationTransition(
|
child: new RotationTransition(
|
||||||
turns: currentTurns.animate(animation),
|
turns: currentTurns.animate(animation),
|
||||||
child: new RepaintBoundary(
|
child: new IgnorePointer(
|
||||||
key: key,
|
child: new RepaintBoundary(
|
||||||
child: child
|
key: key,
|
||||||
|
child: child
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -176,4 +176,75 @@ void main() {
|
|||||||
await tester.pump(new Duration(milliseconds: 10));
|
await tester.pump(new Duration(milliseconds: 10));
|
||||||
await tester.pump(new Duration(seconds: 1));
|
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']));
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user