-
Notifications
You must be signed in to change notification settings - Fork 4k
[go_router] Restore SDK app page adapters #12924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
yazanmg
wants to merge
18
commits into
flutter:main
Choose a base branch
from
yazanmg:fix-go-router-sdk-app-pages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
eb93883
[go_router] Restore SDK app page adapters
yazanmg 42e7aa8
Expand SDK app compatibility regression coverage
yazanmg 77f7ca1
ci: temporarily validate PR 12924 regression
yazanmg 386085d
ci: rerun PR 12924 validation from package root
yazanmg 6d8fbd9
Fix material hero controller regression coverage
yazanmg 635136a
ci: remove temporary PR 12924 validation
yazanmg c84c841
ci: format and revalidate PR 12924
yazanmg 8695da6
Format go_router SDK app compatibility changes
yazanmg b17a01d
ci: run full go_router validation
yazanmg a9625d7
ci: format before full go_router validation
yazanmg 7c109f4
Format and validate go_router SDK app fix
yazanmg 0ba145a
ci: apply PR 12924 review fix
yazanmg 1a8cf0f
ci: fix PR 12924 review validation workflow
yazanmg 5dd1667
Invalidate go_router app-type caches on dependency changes
yazanmg b797b43
Preserve go_router app adapter precedence
yazanmg c5adb91
ci: validate go_router adapter precedence
yazanmg 177c3a3
ci: format before PR 12924 validation
yazanmg 637c5f3
Validate go_router adapter precedence
yazanmg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright 2013 The Flutter Authors | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:cupertino_ui/cupertino_ui.dart' as cupertino_ui; | ||
| import 'package:flutter/cupertino.dart' as flutter_cupertino; | ||
| import 'package:flutter/material.dart' as flutter_material; | ||
| import 'package:flutter/widgets.dart'; | ||
| import 'package:material_ui/material_ui.dart' as material_ui; | ||
|
|
||
| /// The app implementation that contains a go_router Navigator. | ||
| enum AppType { | ||
| /// A MaterialApp from the Flutter SDK. | ||
| sdkMaterial, | ||
|
|
||
| /// A MaterialApp from material_ui. | ||
| materialUi, | ||
|
|
||
| /// A CupertinoApp from the Flutter SDK. | ||
| sdkCupertino, | ||
|
|
||
| /// A CupertinoApp from cupertino_ui. | ||
| cupertinoUi, | ||
| } | ||
|
|
||
| /// Finds the supported app implementation to use for the Navigator. | ||
| /// | ||
| /// Material apps retain precedence over Cupertino apps, matching the existing | ||
| /// go_router adapter selection behavior. Within each app family, the closest | ||
| /// supported implementation is used. | ||
| AppType? appTypeOf(BuildContext context) { | ||
| AppType? nearestCupertino; | ||
| AppType? material; | ||
| context.visitAncestorElements((Element element) { | ||
| final Widget widget = element.widget; | ||
| if (widget is flutter_material.MaterialApp) { | ||
| material = AppType.sdkMaterial; | ||
| return false; | ||
| } | ||
| if (widget is material_ui.MaterialApp) { | ||
| material = AppType.materialUi; | ||
| return false; | ||
| } | ||
| if (nearestCupertino == null) { | ||
| if (widget is flutter_cupertino.CupertinoApp) { | ||
| nearestCupertino = AppType.sdkCupertino; | ||
| } else if (widget is cupertino_ui.CupertinoApp) { | ||
| nearestCupertino = AppType.cupertinoUi; | ||
| } | ||
| } | ||
| return true; | ||
| }); | ||
| return material ?? nearestCupertino; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/go_router/pending_changelogs/sdk_app_compatibility.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| changelog: | | ||
| - Restores SDK MaterialApp and CupertinoApp support when selecting default pages, hero controllers, and error screens, while preserving material_ui and cupertino_ui support. | ||
| version: patch |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.