Skip to content

Conversation

@omar-hanafy
Copy link
Contributor

@omar-hanafy omar-hanafy commented Sep 22, 2022

I used the shell route example in my app. I noticed that when I navigate to a sub route of a specific BottomNavigationBarItem route e.g "/c/details/, the _calculateSelectedIndex returns the default index -> 0. That's because in if statement we use location == "BottomNavigationBarItem Location", which returns false in all cases if the location = /c/details. I did change location == "location" to location.startsWith("location"), so the _calculateSelectedIndex determine the selected index based on the first route of the location not the exact one.

before:

after:

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

… index in long URIs.

I used shell route example in my own app and liked it, thanks to flutter engineers and contributors. I noticed that when I navigate to a sub route of a specific BottomNavigationBarItem route e.g "/c/details/, the _calculateSelectedIndex returns the default index -> 0. That's because in if statement we use location == "BottomNavigationBarItem Location", which returns false in all cases if the location =  /c/details.
I did change location == "location" to location.startsWith("location"), so the _calculateSelectedIndex determine the selected index based on the first route of the location not the exact one.
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla
Copy link

google-cla bot commented Sep 22, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@chunhtai chunhtai requested a review from johnpryan September 22, 2022 21:46
@johnpryan
Copy link
Contributor

@omar-hanafy it looks like you need to update the pubspec and CHANGELOG, even though this is only changing a sample

@omar-hanafy
Copy link
Contributor Author

@johnpryan I updated the pubspec and CHANGELOG if there is anything left I did not do just let me know.

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

I didn't see the changelog and version bump in the diff.

…ple test (shell_route_test.dart) added in example/test to make sure every route including c/details can display the right content.
@omar-hanafy
Copy link
Contributor Author

I didn't see the changelog and version bump in the diff.

I added a change log and diff before, but when i tried to merge there was a conflict and i did not accept my changes.
Should i update the changelog and version bump again?

@chunhtai
Copy link
Contributor

yes, please do so

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2022
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@auto-submit auto-submit bot merged commit a5e2bf1 into flutter:main Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App needs tests p: go_router

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants