Skip to content

Add a way to update CupertinoPageRoute.title #175129

@Zekfad

Description

@Zekfad

Use case

CupertinoPageRoute.title (actually CupertinoRouteTransitionMixin.title) is used to report previous title for CupertinoNavigationBar.previousPageTitle and there is no good way to update it from the same page.

Changes are propagated by using CupertinoRouteTransitionMixin.didChangePrevious which is only ever called by Navigator from push/pop/replace/etc. actions (via _flushHistoryUpdates -> _flushRouteAnnouncement).

One can probably use replace but it's explicitly forbidden to replace current route in the docs:

The old route must not be currently visible, as this method skips the animations and therefore the removal would be jarring if it was visible.

Explicitly populating CupertinoNavigationBar.previousPageTitle in a widget tree is a suboptimal solution because you almost never know what was the previous page.

An actual use case is that we have product pages that loads data after page is opened (including title, which is a shimmer animation at the beginning), so we need to propagate this new title back to Route object.

Proposal

Alternatively add some other hook to trigger current route update.

I believe updating Route so that it could broadcast it's state updates to neighboring routes is a more future-proof solution which would add more new possibilities for cross-route interactions.

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 Flutterf: cupertinoflutter/packages/flutter/cupertino repositoryframeworkflutter/packages/flutter repository. See also f: labels.team-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