Skip to content

Replace empty Container with const SizedBox - #108672

Merged
auto-submit[bot] merged 13 commits into
flutter:masterfrom
tgucio:use-const-sizedbox
Aug 19, 2022
Merged

auto-submit[bot] merged 13 commits into
flutter:masterfrom
tgucio:use-const-sizedbox

Conversation

@tgucio

@tgucio tgucio commented Jul 30, 2022 •

Copy link
Copy Markdown
Contributor

This PR replaces the use of Container() for empty widgets with const SizedBox() or SizedBox.shrink() in a couple of places so new instances aren't created in each build.

Also changes SizedBox.shrink(width: 0.0, height: 0.0) to SizedBox.shrink().

Test exempt: minor optimisation only.

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.

@flutter-dashboard flutter-dashboard Bot added a: text input Entering text in a text field or keyboard related problems p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Jul 30, 2022
@flutter-dashboard

Copy link
Copy Markdown

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.

@tgucio tgucio changed the title Replace empty Container() with const SizedBox.shrink() Replace empty Container with const SizedBox Jul 30, 2022
@Hixie

Hixie commented Aug 8, 2022

Copy link
Copy Markdown
Contributor

test-exempt: code refactor with no semantic change

@tgucio

tgucio commented Aug 10, 2022 •

Copy link
Copy Markdown
Contributor Author

/cc @a14n based on dart-archive/linter#2049 :)

@justinmc justinmc 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 👍

Thanks for cleaning this up!

Comment thread packages/flutter/lib/src/cupertino/refresh.dart Outdated
Comment thread packages/flutter/test/material/ink_paint_test.dart Outdated

@Renzo-Olivares Renzo-Olivares 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

@Renzo-Olivares Renzo-Olivares added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2022
@auto-submit
auto-submit Bot merged commit 75ee440 into flutter:master Aug 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 19, 2022
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 framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants