website icon indicating copy to clipboard operation
website copied to clipboard

Predictive back docs should be updated when made default

Open justinmc opened this issue 5 months ago • 1 comments

Page URL

https://docs.flutter.dev/platform-integration/android/predictive-back

Page source

https://github.com/flutter/website/blob/main/src/content/platform-integration/android/predictive-back.md

Describe the problem

Predictive back currently requires some setup, but soon it will be turned on by default (https://github.com/flutter/flutter/pull/165832) and that will change. When that PR lands, these docs will need to be updated.

Expected fix

Configure your device
- You need to enable Developer Mode and set a flag on your device, so you can't yet expect predictive back to - work on most users' Android devices. If you want to try it out on your own device though, make sure it's running API 33 or higher, and then in Settings => System => Developer options, make sure the switch is enabled next to Predictive back animations.
+ Devices running Android 16 and above require no configuration.
+ Devices running Android 13, 14, and 15 must enable Developer Mode and set the "Predictive back animations" flag in Settings => System => Developer.
+ Devices running older versions of Android are not supported and will fall back to the [Fade Forwards transition](https://main-api.flutter.dev/flutter/material/FadeForwardsPageTransitionsBuilder-class.html).

- Set up your app
- The predictive back route transitions are currently not enabled by default, so for now you'll need to enable them manually in your app. Typically, you do this by setting them in your theme:
+ The predictive back route transition (`PredictiveBackPageTransitionsBuilder`) is the default on Android Flutter apps, so if you haven't customized your app's route transitions, you'll get predictive back out of the box. 

- MaterialApp(
-   theme: ThemeData(
-     pageTransitionsTheme: const PageTransitionsTheme(
-       builders: <TargetPlatform, PageTransitionsBuilder>{
-         // Set the predictive back transitions for Android.
-         TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
-       },
-     ),
-   ),
-   ...
- ),

Additional context

No response

I would like to fix this problem.

  • [ ] I will try and fix this problem on docs.flutter.dev.

justinmc avatar Jul 11 '25 22:07 justinmc

Thanks so much, @justinmc! If this is a breaking change, we should also have an entry in the breaking change docs. https://docs.flutter.dev/release/breaking-changes

sfshaza2 avatar Jul 15 '25 18:07 sfshaza2