Skip to content

Conversation

@justinmc
Copy link
Contributor

@justinmc justinmc commented Mar 24, 2025

This PR turns on predictive back route transitions by default on supported Android devices.

With #154718, the default (PredictiveBackPageTransitionsBuilder) is the shared element transition. The full screen transition is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: #146788

Depends on: #154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back

@justinmc justinmc self-assigned this Mar 24, 2025
@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Mar 24, 2025
@justinmc justinmc marked this pull request as ready for review May 19, 2025 23:21
@justinmc justinmc requested a review from chunhtai May 19, 2025 23:21
@github-actions github-actions bot added the a: text input Entering text in a text field or keyboard related problems label May 20, 2025
@justinmc justinmc force-pushed the predictive-back-by-default-2 branch from 7aa3be6 to 11b05e4 Compare May 21, 2025 17:18
justinmc added 4 commits May 21, 2025 10:21
And get rid of all instances of _PredictiveBackPageTransition (old
name).
static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders =
<TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: ZoomPageTransitionsBuilder(),
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this be a breaking change? I am not too familiar with the process of changing page transition. so maybe @QuncCccccc can chime in.

An alternative is some how expose the predicitiveback enabled setting to framework side and conditionally return PredictiveBackPageTransitionsBuilder or ZoomPageTransitionsBuilder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually what it does internally:

if (route.popGestureInProgress) {
return _PredictiveBackSharedElementPageTransition(
isDelegatedTransition: true,
animation: animation,
phase: phase,
secondaryAnimation: secondaryAnimation,
startBackEvent: startBackEvent,
currentBackEvent: currentBackEvent,
child: child,
);
}
return const FadeForwardsPageTransitionsBuilder().buildTransitions(
route,
context,
animation,
secondaryAnimation,
child,
);
},
);

So this PR moves us from Zoom to FadeForwards by default, and when doing a predictive back gesture, it will use the _PredictiveBackSharedElement transition by default.

Can you verify that we're good to make FadeForwards the default @QuncCccccc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it will always use that fallback aslong as you don't opt in in the AndroidManifest.xml, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's right.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default to FadeForwards sounds good to me! Thank you!

@chunhtai chunhtai requested a review from QuncCccccc May 22, 2025 19:28
@github-actions github-actions bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels May 22, 2025
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
For flutter#165832, picks up the test
change from zulip/zulip-flutter#1761 that was
bumped in the tests repo in flutter/tests#466.
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
This PR turns on predictive back route transitions by default on
supported Android devices.

With flutter#154718, the default
(PredictiveBackPageTransitionsBuilder) is the [shared element
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition).
The [full screen
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces)
is also available by using
PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated:
https://docs.flutter.dev/platform-integration/android/predictive-back
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
…" (flutter#173809)

<!-- start_original_pr_link -->
Reverts: flutter#165832
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Breaks `Linux_pixel_7pro
embedded_android_views_integration_test`:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview

```txt
[2025-08-14 16:01:17.600761] [STDOUT] stdout: [   +1 ms]   Expecte
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: justinmc
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {QuncCccccc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR turns on predictive back route transitions by default on supported Android devices.

With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
WillBLogical pushed a commit to WillBLogical/packages that referenced this pull request Aug 20, 2025
flutter/flutter@f4334d2...52af7a5

2025-08-15 engine-flutter-autoroll@skia.org Roll Packages from 09533b7 to 5c52c55 (6 revisions) (flutter/flutter#173854)
2025-08-15 engine-flutter-autoroll@skia.org Roll Skia from 46ec77ae3954 to 5654ac32ede0 (1 revision) (flutter/flutter#173848)
2025-08-15 engine-flutter-autoroll@skia.org Roll Skia from 162f47d6b6bd to 46ec77ae3954 (2 revisions) (flutter/flutter#173833)
2025-08-15 engine-flutter-autoroll@skia.org Roll Dart SDK from c7faab270f27 to cc008dc8e7aa (2 revisions) (flutter/flutter#173826)
2025-08-15 engine-flutter-autoroll@skia.org Roll Skia from ad5d04000101 to 162f47d6b6bd (5 revisions) (flutter/flutter#173822)
2025-08-15 jason-simmons@users.noreply.github.com Update the RBE configuration for the recent Clang update (flutter/flutter#173803)
2025-08-15 matanlurey@users.noreply.github.com Stop writing legacy `FLUTTER_ROOT/version` file (by default?) (flutter/flutter#172793)
2025-08-15 matanlurey@users.noreply.github.com Remove `luci_flags.parallel_download_builds` and friends (flutter/flutter#173799)
2025-08-14 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Predictive back route transitions by default (#165832)" (flutter/flutter#173809)
2025-08-14 engine-flutter-autoroll@skia.org Roll Skia from dca5f05fee87 to ad5d04000101 (8 revisions) (flutter/flutter#173798)
2025-08-14 mdebbar@google.com [web] Cleanup usages of deprecated `routeUpdated` message (flutter/flutter#173782)
2025-08-14 ahmedsameha1@gmail.com Make sure that DataTable, DataColumn, DataRow, and DataCell don't crash in 0x0 environment (flutter/flutter#173515)
2025-08-14 ahmedsameha1@gmail.com Make sure that a TableRowInkWell doesn't crash in 0x0 environment (flutter/flutter#173627)
2025-08-14 ahmedsameha1@gmail.com Make sure that a DatePickerDialog doesn't crash in 0x0 environment (flutter/flutter#173677)
2025-08-14 robert.ancell@canonical.com Return result of setting OpenGL contexts back to Flutter (flutter/flutter#173757)
2025-08-14 matanlurey@users.noreply.github.com Read `bin/cache/flutter.version.json` instead of `version` for `flutter_gallery` (flutter/flutter#173797)
2025-08-14 jmccandless@google.com Predictive back route transitions by default (flutter/flutter#165832)
2025-08-14 houssemeddinefadhli81@gmail.com feat: add onLongPressUp callback to InkWell widget (flutter/flutter#173221)
2025-08-14 engine-flutter-autoroll@skia.org Roll Dart SDK from 214a7f829913 to c7faab270f27 (1 revision) (flutter/flutter#173792)
2025-08-14 31859944+LongCatIsLooong@users.noreply.github.com Add error handling for `Element` lifecycle user callbacks (flutter/flutter#173148)
2025-08-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from I1TfNmsqTp7t3rO8e... to zWRpLglb48zC1vZLv... (flutter/flutter#173784)
2025-08-14 jhy03261997@gmail.com [Range slider] Tap on active range,  the thumb closest to the mouse cursor should move to the cursor position. (flutter/flutter#173725)
2025-08-14 engine-flutter-autoroll@skia.org Roll Packages from 6cb9113 to 09533b7 (4 revisions) (flutter/flutter#173789)
2025-08-14 ttankkeo112@gmail.com Implements the Android native stretch effect as a fragment shader (Impeller-only). (flutter/flutter#169293)
2025-08-14 matanlurey@users.noreply.github.com Sync `CHANGELOG.md` (3.35 -> `master`) (flutter/flutter#173790)
2025-08-14 victorsanniay@gmail.com [VPAT][A11y] Announce Autocomplete search results status (flutter/flutter#173480)
2025-08-14 bruno.leroux@gmail.com Fix InputDecorator label padding (flutter/flutter#173344)
2025-08-14 edwinzn9@gmail.com Fix default minimumSize in dropdownMenu when maximumSize is null (flutter/flutter#169438)
2025-08-14 matanlurey@users.noreply.github.com Thread sub-builders for every engine-uploading builder (flutter/flutter#173742)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
This PR turns on predictive back route transitions by default on
supported Android devices.

With flutter#154718, the default
(PredictiveBackPageTransitionsBuilder) is the [shared element
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition).
The [full screen
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces)
is also available by using
PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated:
https://docs.flutter.dev/platform-integration/android/predictive-back
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
…" (flutter#173809)

<!-- start_original_pr_link -->
Reverts: flutter#165832
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Breaks `Linux_pixel_7pro
embedded_android_views_integration_test`:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview

```txt
[2025-08-14 16:01:17.600761] [STDOUT] stdout: [   +1 ms]   Expecte
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: justinmc
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {QuncCccccc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR turns on predictive back route transitions by default on supported Android devices.

With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
This PR turns on predictive back route transitions by default on
supported Android devices.

With flutter#154718, the default
(PredictiveBackPageTransitionsBuilder) is the [shared element
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition).
The [full screen
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces)
is also available by using
PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated:
https://docs.flutter.dev/platform-integration/android/predictive-back
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
…" (flutter#173809)

<!-- start_original_pr_link -->
Reverts: flutter#165832
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Breaks `Linux_pixel_7pro
embedded_android_views_integration_test`:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview

```txt
[2025-08-14 16:01:17.600761] [STDOUT] stdout: [   +1 ms]   Expecte
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: justinmc
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {QuncCccccc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR turns on predictive back route transitions by default on supported Android devices.

With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 22, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
We need a robust way to get the duration of a route transition in tests,
so that tests can remain independent of the type of route transition and
its duration.

With this PR, this will be the canonical way to pump until a page
transition has finished:

```dart
testWidgets('example', (WidgetTester tester) async {
  final TransitionDurationObserver observer = TransitionDurationObserver();

  await tester.pumpWidget(
    MaterialApp(
      navigatorObservers: <NavigatorObserver>[observer],
      onGenerateRoute: (RouteSettings settings) { ... },
    ),
  );

  expect(find.text('Page 1'), findsOneWidget);
  expect(find.text('Page 2'), findsNothing);

  // Pump through the whole transition.
  await tester.tap(find.text('Next'));
  await observer.pumpPastTransition(tester);

  expect(find.text('Page 1'), findsNothing);
  expect(find.text('Page 2'), findsOneWidget);

  // Or, pump through part of a transition with the duration.
  await tester.tap(find.text('Back'));
  await tester.pump(observer.transitionDuration ~/ 2);

  expect(find.text('Page 1'), findsOneWidget);
  expect(find.text('Page 2'), findsOneWidget);
});
```

This was spun out of flutter#165832,
where updating the default route transition and its duration broke tests
in the framework, in customer tests, and in Google tests.

FYI @chrisbobbe

---------

Co-authored-by: Jing Shao <87506348+jingshao-code@users.noreply.github.com>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
For flutter#165832, picks up the test
change from zulip/zulip-flutter#1761 that was
bumped in the tests repo in flutter/tests#466.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
This PR turns on predictive back route transitions by default on
supported Android devices.

With flutter#154718, the default
(PredictiveBackPageTransitionsBuilder) is the [shared element
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition).
The [full screen
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces)
is also available by using
PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated:
https://docs.flutter.dev/platform-integration/android/predictive-back
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
…" (flutter#173809)

<!-- start_original_pr_link -->
Reverts: flutter#165832
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Breaks `Linux_pixel_7pro
embedded_android_views_integration_test`:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview

```txt
[2025-08-14 16:01:17.600761] [STDOUT] stdout: [   +1 ms]   Expecte
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: justinmc
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {QuncCccccc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR turns on predictive back route transitions by default on supported Android devices.

With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
For flutter#165832, picks up the test
change from zulip/zulip-flutter#1761 that was
bumped in the tests repo in flutter/tests#466.
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
This PR turns on predictive back route transitions by default on
supported Android devices.

With flutter#154718, the default
(PredictiveBackPageTransitionsBuilder) is the [shared element
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition).
The [full screen
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces)
is also available by using
PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated:
https://docs.flutter.dev/platform-integration/android/predictive-back
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
…" (flutter#173809)

<!-- start_original_pr_link -->
Reverts: flutter#165832
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Breaks `Linux_pixel_7pro
embedded_android_views_integration_test`:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview

```txt
[2025-08-14 16:01:17.600761] [STDOUT] stdout: [   +1 ms]   Expecte
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: justinmc
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {QuncCccccc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR turns on predictive back route transitions by default on supported Android devices.

With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 12, 2025
parlough added a commit to flutter/website that referenced this pull request Nov 12, 2025
This PR spawned out of
flutter/flutter#165832 (comment).
That PR will change the default page transition and turn on predictive
back by default. While there is no API breakage, users may encounter
test breakages in tests that indirectly depend on the default page
transition and/or its duration. Several of these kinds of breakages were
encountered in flutter/flutter#165832 in the
framework tests, customer tests, and Google tests.

This PR should explain:

 * What predictive back is.
 * How to make sure an app supports predictive back.
 * What the new Fade Fowards page transition looks like.
 * How to manually change the page transition back to the old one.
* How to write tests that don't depend on the page transition and its
duration.

_Issues fixed by this PR (if any):_ n/a

_PRs or commits this PR depends on (if any):_
flutter/flutter#165832

## Presubmit checklist

- [x] If you are unwilling, or unable, to sign the CLA, even for a
_tiny_, one-word PR, please file an issue instead of a PR.
- [x] If this PR is not meant to land until a future stable release,
mark it as draft with an explanation.
- [x] This PR follows the [Google Developer Documentation Style
Guidelines](https://developers.google.com/style)—for example, it doesn't
use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first-person
pronouns).
- [x] This PR uses [semantic line
breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks)
  of 80 characters or fewer.

---------

Co-authored-by: Shams Zakhour <44418985+sfshaza2@users.noreply.github.com>
Co-authored-by: Parker Lougheed <parlough@gmail.com>
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
We need a robust way to get the duration of a route transition in tests,
so that tests can remain independent of the type of route transition and
its duration.

With this PR, this will be the canonical way to pump until a page
transition has finished:

```dart
testWidgets('example', (WidgetTester tester) async {
  final TransitionDurationObserver observer = TransitionDurationObserver();

  await tester.pumpWidget(
    MaterialApp(
      navigatorObservers: <NavigatorObserver>[observer],
      onGenerateRoute: (RouteSettings settings) { ... },
    ),
  );

  expect(find.text('Page 1'), findsOneWidget);
  expect(find.text('Page 2'), findsNothing);

  // Pump through the whole transition.
  await tester.tap(find.text('Next'));
  await observer.pumpPastTransition(tester);

  expect(find.text('Page 1'), findsNothing);
  expect(find.text('Page 2'), findsOneWidget);

  // Or, pump through part of a transition with the duration.
  await tester.tap(find.text('Back'));
  await tester.pump(observer.transitionDuration ~/ 2);

  expect(find.text('Page 1'), findsOneWidget);
  expect(find.text('Page 2'), findsOneWidget);
});
```

This was spun out of flutter#165832,
where updating the default route transition and its duration broke tests
in the framework, in customer tests, and in Google tests.

FYI @chrisbobbe

---------

Co-authored-by: Jing Shao <87506348+jingshao-code@users.noreply.github.com>
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
For flutter#165832, picks up the test
change from zulip/zulip-flutter#1761 that was
bumped in the tests repo in flutter/tests#466.
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
This PR turns on predictive back route transitions by default on
supported Android devices.

With flutter#154718, the default
(PredictiveBackPageTransitionsBuilder) is the [shared element
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition).
The [full screen
transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces)
is also available by using
PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated:
https://docs.flutter.dev/platform-integration/android/predictive-back
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…" (flutter#173809)

<!-- start_original_pr_link -->
Reverts: flutter#165832
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Breaks `Linux_pixel_7pro
embedded_android_views_integration_test`:

-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview
-
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview

```txt
[2025-08-14 16:01:17.600761] [STDOUT] stdout: [   +1 ms]   Expecte
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: justinmc
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {QuncCccccc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
This PR turns on predictive back route transitions by default on supported Android devices.

With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder.

Original PR: flutter#146788

Depends on: flutter#154718

When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back
<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: material design flutter/packages/flutter/material repository. f: routes Navigator, Router, and related APIs. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.