Skip to content

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented May 7, 2024

migration guide for flutter/flutter#137792

Presubmit checklist

@flutter-website-bot
Copy link
Collaborator

flutter-website-bot commented May 7, 2024

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

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

Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

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.
Copy link
Member

@parlough parlough May 8, 2024

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
Contributor

Choose a reason for hiding this comment

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

good point

@chunhtai
Copy link
Contributor Author

chunhtai commented May 8, 2024

all done

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

@sfshaza2 sfshaza2 left a comment

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
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(),
),

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