Commit ef004ae9 authored by Hans Muller's avatar Hans Muller Committed by GitHub

New Heroes (#8112)

parent cd3fd475
...@@ -81,7 +81,6 @@ class StockSymbolPage extends StatelessWidget { ...@@ -81,7 +81,6 @@ class StockSymbolPage extends StatelessWidget {
stock: stock, stock: stock,
arrow: new Hero( arrow: new Hero(
tag: stock, tag: stock,
turns: 2,
child: new StockArrow(percentChange: stock.percentChange) child: new StockArrow(percentChange: stock.percentChange)
) )
) )
......
...@@ -357,4 +357,36 @@ void main() { ...@@ -357,4 +357,36 @@ void main() {
// TODO(ianh): once https://github.com/flutter/flutter/issues/5631 is fixed, remove this line: // TODO(ianh): once https://github.com/flutter/flutter/issues/5631 is fixed, remove this line:
await tester.pump(const Duration(hours: 1)); await tester.pump(const Duration(hours: 1));
}); });
testWidgets('One route, two heroes, same tag, throws', (WidgetTester tester) async {
await tester.pumpWidget(new MaterialApp(
home: new Material(
child: new ListView(
children: <Widget>[
new Hero(tag: 'a', child: new Text('a')),
new Hero(tag: 'a', child: new Text('a too')),
new Builder(
builder: (BuildContext context) {
return new FlatButton(
child: new Text('push'),
onPressed: () {
Navigator.push(context, new PageRouteBuilder<Null>(
pageBuilder: (BuildContext context, Animation<double> _, Animation<double> __) {
return new Text('fail');
},
));
},
);
},
),
],
),
),
));
await tester.tap(find.text('push'));
await tester.pump();
expect(tester.takeException(), isFlutterError);
});
} }
...@@ -148,6 +148,7 @@ void main() { ...@@ -148,6 +148,7 @@ void main() {
expect(find.text('X'), findsNothing); expect(find.text('X'), findsNothing);
expect(find.text('Y'), findsOneWidget); expect(find.text('Y'), findsOneWidget);
await tester.pump();
await tester.pump(); await tester.pump();
expect(find.text('X'), findsOneWidget); expect(find.text('X'), findsOneWidget);
expect(find.text('Y'), findsOneWidget); expect(find.text('Y'), findsOneWidget);
......
...@@ -132,6 +132,8 @@ void main() { ...@@ -132,6 +132,8 @@ void main() {
navigator.pop(); navigator.pop();
expect(state(), equals('E')); // transition 1<-2 is at 1.0, just reversed expect(state(), equals('E')); // transition 1<-2 is at 1.0, just reversed
await tester.pump(); await tester.pump();
await tester.pump();
expect(state(), equals('BDE')); // transition 1<-2 is at 1.0 expect(state(), equals('BDE')); // transition 1<-2 is at 1.0
await tester.pump(kFourTenthsOfTheTransitionDuration); await tester.pump(kFourTenthsOfTheTransitionDuration);
......
...@@ -113,6 +113,7 @@ void main() { ...@@ -113,6 +113,7 @@ void main() {
expect(Navigator.canPop(containerKey2.currentContext), isTrue); expect(Navigator.canPop(containerKey2.currentContext), isTrue);
Navigator.pop(containerKey2.currentContext); Navigator.pop(containerKey2.currentContext);
await tester.pump(); await tester.pump();
await tester.pump();
expect(find.text('Home'), isOnstage); expect(find.text('Home'), isOnstage);
expect(find.text('Settings'), isOnstage); expect(find.text('Settings'), isOnstage);
......
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