Skip to content

Android predictive back route transitionsΒ #131961

Closed
@justinmc

Description

@justinmc

Is there an existing issue for this?

Use case

Flutter recently added support for Android's predictive back feature (#109513) in #120385 and flutter/engine#39208. However, that only works when exiting a Flutter app, and not between routes within a Flutter app.

Proposal

Flutter should support route transitions that allow the user to peek behind the current route while performing a back gesture and cancel the route pop if desired.

This can't be done entirely in the framework if we want to show Android's back arrow too. Flutter can't draw the back arrow with 100% accuracy because it is customizable by the system color theme, and the colors used for the arrow are not currently exposed via API.

We should be able to use the onBackAnimationCallback API to get information about the back gesture as it happens and update the route transition animation.

Screenshot 2023-08-04 at 2 52 57 PM

Requirements

  1. Route transitions should look like the spec (see video below).
  2. Canceling the gesture and committing the gesture should both work.
  3. The native back button should be shown during the gesture.
  4. The route transition should integrate well with Flutter's existing route transition infrastructure.
  5. Should be the default behavior for Android apps that enable predictive back? But should not interfere with other platforms and older versions of Android where the engine API isn't supported.
  6. Stretch goal: if possible, vertically dragging during the gesture should wiggle the animation vertically as it seems to do on native. This seems to require having Flutter track the gesture as well as native.
Spec animation
predictive-back-video-1-calendar-event-example.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions