Move Material page animations to Material layer.

PageRoute is now MaterialPageRoute.

This also changes the following:

- Now the HeroController is a Navigator observer, rather than a feature
  of HeroPageRoutes, which are gone. This means heroes can work between
  any kind of ModalRoute now.

- ModalPageRoute is moved from modal_barrier.dart to routes.dart.

- It allows routes to opt-out of their modal barrier being a shortcut to
  popping the route.

- Features of PageRoute that aren't Material-specific get promoted to
  ModalRoute features: storage, the subtree key, offstageness...

The AnimatedModalBarrier is still a ModalRoute feature.
This commit is contained in:
Hixie
2015-11-06 11:48:55 -08:00
parent 8bc9e1b8a2
commit 309d25d4bb
15 changed files with 301 additions and 272 deletions

View File

@@ -37,8 +37,8 @@ void main() {
// Tap on the the bottom sheet itself to dismiss it
tester.tap(tester.findText('BottomSheet'));
tester.pump(); // bottom sheet dismiss animation starts
tester.pump(new Duration(seconds: 1)); // animation done
tester.pump(new Duration(seconds: 1)); // rebuild frame
tester.pump(new Duration(seconds: 1)); // last frame of animation (sheet is entirely off-screen, but still present)
tester.pump(new Duration(seconds: 1)); // frame after the animation (sheet has been removed)
expect(showBottomSheetThenCalled, isTrue);
expect(tester.findText('BottomSheet'), isNull);

View File

@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/animation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:test/test.dart';
import 'widget_tester.dart';
@@ -36,9 +36,9 @@ void main() {
key: navigatorKey,
onGenerateRoute: (NamedRouteSettings settings) {
if (settings.name == '/')
return new PageRoute(builder: (_) => new Container(child: new ThePositiveNumbers()));
return new MaterialPageRoute(builder: (_) => new Container(child: new ThePositiveNumbers()));
else if (settings.name == '/second')
return new PageRoute(builder: (_) => new Container(child: new ThePositiveNumbers()));
return new MaterialPageRoute(builder: (_) => new Container(child: new ThePositiveNumbers()));
return null;
}
));