Skip to content

Add migration guide for page apis - #10523

Merged
sfshaza2 merged 3 commits into
flutter:mainfrom
chunhtai:page-apis-re
May 9, 2024
Merged

sfshaza2 merged 3 commits into
flutter:mainfrom
chunhtai:page-apis-re

Conversation

@chunhtai

@chunhtai chunhtai commented May 7, 2024

Copy link
Copy Markdown
Contributor

migration guide for flutter/flutter#137792

Presubmit checklist

@flutter-website-bot

flutter-website-bot commented May 7, 2024 •

Copy link
Copy Markdown
Collaborator

Visit the preview URL for this PR (updated for commit 594455f):

https://flutter-docs-prod--pr10523-page-apis-re-iomugcxy.web.app

@sfshaza2 sfshaza2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add this breaking change to the index file?

Comment on lines +2 to +4
title: Navigator's page APIs breaking change
description: >
Changes to Navigator's page APIs.

@parlough parlough May 8, 2024 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add a word or two to be more specific here, as the mentioned APIs could have other breaking changes in the future. Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good point

@chunhtai

chunhtai commented May 8, 2024

Copy link
Copy Markdown
Contributor Author

all done

@chunhtai
chunhtai requested review from parlough and sfshaza2 May 8, 2024 18:16

@sfshaza2 sfshaza2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@sfshaza2
sfshaza2 merged commit dba6a15 into flutter:main May 9, 2024
auto-submit Bot pushed a commit to flutter/flutter that referenced this pull request May 13, 2024
fixes #137458

Chagnes:
1. Navigator.pop will always pop page based route
2. add a onDidRemovePage callback to replace onPopPage
3. Page.canPop and Page.onPopInvoked mirrors the PopScope, but in Page class.

migration guide flutter/website#10523
@aliyazdi75

Copy link
Copy Markdown
Contributor

Hi @chunhtai,

Since this api is deperecated, I think it's better to mention to use onPopInvoked to use the result, something like this:

class CustomAppPage<T> extends Page<T> {
  const CustomAppPage({
    super.key,
    super.onPopInvoked,
    required this.child,
  });

  final Widget child;
}

CustomAppPage(
    key: ValueKey(route),
    onPopInvoked: (didPop, result) =>
        _routerState.popResult.complete(result),
    child: CustomPage(),
),

chunhtai added a commit to chunhtai/packages that referenced this pull request Jun 12, 2026
fixes flutter/flutter#137458

Chagnes:
1. Navigator.pop will always pop page based route
2. add a onDidRemovePage callback to replace onPopPage
3. Page.canPop and Page.onPopInvoked mirrors the PopScope, but in Page class.

migration guide flutter/website#10523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants