Skip to content

Conversation

@nate-thegrate
Copy link
Contributor

@nate-thegrate nate-thegrate commented Jan 16, 2024

This pull request is based on issue #136139 (it's a continuation of #139048 and #139882, this time focusing on the packages/flutter/lib/src/cupertino/ directory.)

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 Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • 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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@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 "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository f: routes Navigator, Router, and related APIs. labels Jan 16, 2024
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Thank you for doing this cleanup! I'm convinced this is more readable, and you saved 58 lines in the process.

Have you requested a test exemption?

@nate-thegrate
Copy link
Contributor Author

LGTM 👍

Thank you for doing this cleanup! I'm convinced this is more readable, and you saved 58 lines in the process.

Have you requested a test exemption?

@justinmc Thank you very much!

I originally had a massive PR that implemented switch expressions throughout the entire repo, but it was recommended that I break it up into multiple smaller ones that are easier to review.

This is the third PR I've made; #139048 and #139882 didn't need a test exemption, so IMO we're good to merge this one as well.

@nate-thegrate
Copy link
Contributor Author

Sweet, all tests have passed!

@justinmc could you add the "autosubmit" label when you have a chance?

default:
offAxisFraction = 0.5 * textDirectionFactor;
}
final double offAxisFraction = switch (i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The switch expression won't be able to provide exhaustiveness feedback for int values anyways. Consider using the ternary operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

(I just did some other refactoring here too; hopefully it all looks good.)

@justinmc justinmc merged commit 497f912 into flutter:master Jan 25, 2024
@nate-thegrate nate-thegrate deleted the switch-expressions-3 branch January 25, 2024 23:58
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
auto-submit bot pushed a commit that referenced this pull request Jan 29, 2024
…142279)

This PR is the fourth step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591)

This one is covering files in `packages/flutter/lib/src/foundation/` and `packages/flutter/lib/src/material/`.  
The `material/` directory is pretty big though, so for now I just did the files that start with `a`, `b`, and `c`.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 29, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 29, 2024
Manual roll requested by [email protected]

flutter/flutter@a8efa77...2f6fdf2

2024-01-26 [email protected] Start renaming by adding a new `bringup: true` as an Android emulator. (flutter/flutter#142257)
2024-01-26 [email protected] Instrument ImageInfo. (flutter/flutter#141411)
2024-01-26 [email protected] Fix `SegmentedButton` default size and default tappable size (flutter/flutter#142243)
2024-01-26 [email protected] Update name for android_defines_test. (flutter/flutter#142273)
2024-01-26 [email protected] Enable native compilation for windows-arm64 (flutter/flutter#141930)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions)" (flutter/flutter#142274)
2024-01-25 [email protected] Run a few mac tests only on arm. (flutter/flutter#142188)
2024-01-25 [email protected] fix Ink not updating on TextField newline (flutter/flutter#140700)
2024-01-25 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 3.1.4 to 3.1.5 (flutter/flutter#142259)
2024-01-25 [email protected] Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions) (flutter/flutter#142264)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reverts "Rename `integration_tests/external_ui` but do not touch anything else..."" (flutter/flutter#142268)
2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Rename `integration_tests/external_ui` but do not touch anything else..." (flutter/flutter#142265)
2024-01-25 [email protected] Roll Flutter Engine from b2167a93c1a0 to 4b145d041560 (3 revisions) (flutter/flutter#142256)
2024-01-25 [email protected] Implementing `switch` expressions in the `cupertino/` directory (flutter/flutter#141591)
2024-01-25 [email protected] Rename `integration_tests/external_ui` but do not touch anything else... (flutter/flutter#142238)
2024-01-25 [email protected] Roll Flutter Engine from 55eefd5bd255 to b2167a93c1a0 (2 revisions) (flutter/flutter#142252)
2024-01-25 [email protected] Roll Flutter Engine from 3b4779324b44 to 55eefd5bd255 (6 revisions) (flutter/flutter#142245)
2024-01-25 [email protected] Fix incorrect zh-cn translation for Look Up Label in selection controls (flutter/flutter#142158)
2024-01-25 [email protected] PopScope example improvements (flutter/flutter#142163)
2024-01-25 [email protected] Roll Flutter Engine from 1d3f16b0d62e to 3b4779324b44 (1 revision) (flutter/flutter#142225)
2024-01-25 [email protected] Roll Packages from 8fbdf65 to 21b5abb (6 revisions) (flutter/flutter#142224)
2024-01-25 [email protected] Don't show legacy welcome message when analytics are disabled (flutter/flutter#140956)
2024-01-25 [email protected] Roll Flutter Engine from 7c4ed15cb271 to 1d3f16b0d62e (1 revision) (flutter/flutter#142223)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
auto-submit bot pushed a commit that referenced this pull request Feb 1, 2024
This PR is step 5 in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279)

The current focus is on `packages/flutter/lib/src/material/`.  
The previous PR covered files in this directory starting with `a`, `b`, and `c`; this pull request is for `d` through `m`.
auto-submit bot pushed a commit that referenced this pull request Feb 9, 2024
This PR is the 6�ʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634)

The current focus is on `packages/flutter/lib/src/material/`. The previous 2 PRs covered files in this directory starting with letters `a-m`; this one takes care of everything else.
auto-submit bot pushed a commit that referenced this pull request Feb 13, 2024
This PR is the 7�ʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634, #142793)

This pull request covers everything in `packages/flutter/lib/src/widgets/`. Most of it should be really straightforward, but there was some refactoring in the `getOffsetToReveal()` function in `two_dimensional_viewport.dart`. I'll add some comments to describe those changes.
auto-submit bot pushed a commit that referenced this pull request Feb 16, 2024
…143496)

This PR is the 8�ʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634, #142793, #143293)

I did a pass through all of `packages/flutter/lib/src/` and found a whole bunch of `switch` statements to improve: most of them were really simple, but many involved some thorough refactoring.

This pull request is just the complicated stuff. � I'll make comments to describe the changes, and then in the future there will be another PR (and it'll be much easier to review than this one).
auto-submit bot pushed a commit that referenced this pull request Feb 20, 2024
…143634)

This PR is the 9�ʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634, #142793, #143293, #143496)

I did a pass through all of `packages/flutter/lib/src/` and found an abundance of `switch` statements to improve. Whereas #143496 focused on in-depth refactoring, this PR is full of simple, straightforward changes. (I ended up making some more complicated changes in `rendering/` and will file those separately after this PR is done.)
auto-submit bot pushed a commit that referenced this pull request Mar 29, 2024
This pull request is step 12 in the journey to make this entire repository more readable.

(previous PRs: #139048, #139882, #141591, #142279, #142634, #142793, #143293, #143496, #143634, #143812, #144580)

We're getting close to the end! �
@nate-thegrate nate-thegrate added the refactor Improving readability/efficiency without behavioral changes label Jul 12, 2024
@nate-thegrate nate-thegrate added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App f: cupertino flutter/packages/flutter/cupertino repository f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels. refactor Improving readability/efficiency without behavioral changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants