Enable fading animation during page transitions. (#21394)

The average frame time of page transitions on Moto G4 is now very
close to 16ms (the last 10 measurements on our dashboard are
between 15.5ms to 16.7ms and half of them are below 16ms).

It is now much faster than when we disabled it (which was at about
35ms). So I think that we should be able to enable it by default.
I'll leave the flag there until we implement the retained rendering
to bring the frame time comfortably below 16ms.

See https://github.com/flutter/flutter/issues/13736
This commit is contained in:
liyuqian 2018-09-06 09:26:52 -07:00 committed by GitHub
parent 3e7f8b8bb5
commit 6c4b38b707
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 4 additions and 19 deletions

View File

@ -1 +1 @@
1a999092d10a22bc700214b257cd4890c5800078
157b8cebd10c8f8308540ded5dadae502febd48d

View File

@ -14,8 +14,5 @@ void main() {
// Temporary debugging hook for https://github.com/flutter/flutter/issues/17888
debugInstrumentationEnabled = true;
// Overriding https://github.com/flutter/flutter/issues/13736 for better
// visual effect at the cost of performance.
MaterialPageRoute.debugEnableFadingRoutes = true; // ignore: deprecated_member_use
runApp(const GalleryApp());
}

View File

@ -10,6 +10,5 @@ void main() {
enableFlutterDriverExtension();
// As in lib/main.dart: overriding https://github.com/flutter/flutter/issues/13736
// for better visual effect at the cost of performance.
MaterialPageRoute.debugEnableFadingRoutes = true; // ignore: deprecated_member_use
runApp(const GalleryApp(testMode: true));
}

View File

@ -21,6 +21,5 @@ void main() {
enableFlutterDriverExtension(handler: _handleMessages);
// As in lib/main.dart: overriding https://github.com/flutter/flutter/issues/13736
// for better visual effect at the cost of performance.
MaterialPageRoute.debugEnableFadingRoutes = true; // ignore: deprecated_member_use
runApp(const GalleryApp(testMode: true));
}

View File

@ -28,7 +28,6 @@ class LifecycleObserver extends WidgetsBindingObserver {
}
Future<void> main() async {
MaterialPageRoute.debugEnableFadingRoutes = true; // ignore: deprecated_member_use
runApp(const GalleryApp());
await endOfAnimation();
await new Future<Null>.delayed(const Duration(milliseconds: 50));

View File

@ -23,7 +23,6 @@ Rect boundsFor(WidgetController controller, Finder item) {
}
Future<void> main() async {
MaterialPageRoute.debugEnableFadingRoutes = true; // ignore: deprecated_member_use
final Completer<void> ready = new Completer<void>();
runApp(new GestureDetector(
onTap: () {

View File

@ -87,14 +87,6 @@ class MaterialPageRoute<T> extends PageRoute<T> {
assert(opaque);
}
/// Turns on the fading of routes during page transitions.
///
/// This is currently disabled by default because of performance issues on
/// low-end phones. Eventually these issues will be resolved and this flag
/// will be removed.
@Deprecated('This flag will eventually be removed once the performance issues are resolved. See: https://github.com/flutter/flutter/issues/13736')
static bool debugEnableFadingRoutes = false;
/// Builds the primary contents of the route.
final WidgetBuilder builder;
@ -175,7 +167,7 @@ class MaterialPageRoute<T> extends PageRoute<T> {
return new _MountainViewPageTransition(
routeAnimation: animation,
child: child,
fade: debugEnableFadingRoutes, // ignore: deprecated_member_use
fade: true,
);
}
}

View File

@ -40,7 +40,7 @@ void main() {
// Animation begins 3/4 of the way up the page.
expect(widget2TopLeft.dy < widget2Size.height / 4.0, true);
// Animation starts with page 2 being near transparent.
expect(widget2Opacity.opacity.value < 0.01, MaterialPageRoute.debugEnableFadingRoutes); // ignore: deprecated_member_use
expect(widget2Opacity.opacity.value < 0.01, true);
await tester.pump(const Duration(milliseconds: 300));
@ -59,7 +59,7 @@ void main() {
// Page 2 starts to move down.
expect(widget1TopLeft.dy < widget2TopLeft.dy, true);
// Page 2 starts to lose opacity.
expect(widget2Opacity.opacity.value < 1.0, MaterialPageRoute.debugEnableFadingRoutes); // ignore: deprecated_member_use
expect(widget2Opacity.opacity.value < 1.0, true);
await tester.pump(const Duration(milliseconds: 300));