Skip to content
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

feat: Add avoid_consecutive_sliver_to_box_adapter rule #29

Merged
merged 5 commits into from
Jul 29, 2024

Conversation

naipaka
Copy link
Contributor

@naipaka naipaka commented Jul 29, 2024

๐Ÿ”— Related Issues

  • None

๐Ÿ™Œ What's Done

  • Add avoid sliver to box adapter

โœ๏ธ What's Not Done

  • None

๐Ÿ–ผ๏ธ Image Differences

CleanShot 2024-07-29 at 12 25 06

๐Ÿคผ Desired Review Method

  • Correction Commit
  • Pair programming

Note

It is possible that a reviewer's will may cause a method to be implemented that is not selected.

๐Ÿ“ Additional Notes

Pre-launch Checklist

  • I have reviewed my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I updated/added relevant documentation (doc comments with ///).

@naipaka naipaka changed the title feat: Add avoid sliver to box adapter feat: Add avoid SliverToBoxAdapter rule Jul 29, 2024
@naipaka naipaka marked this pull request as ready for review July 29, 2024 03:28
@naipaka naipaka requested a review from a team as a code owner July 29, 2024 03:28
@naipaka naipaka requested review from k-nkmr and removed request for a team July 29, 2024 03:28
@naipaka naipaka changed the title feat: Add avoid SliverToBoxAdapter rule feat: Add avoid_sliver_to_box_adapter rule Jul 29, 2024
Copy link
Contributor

@k-nkmr k-nkmr left a comment

Choose a reason for hiding this comment

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

LGTM

@riscait
Copy link
Member

riscait commented Jul 29, 2024

badge
I was wondering if a SliverToBoxAdapter would be sufficient for elements such as a heading string in the sense of using a TextWidget in a Column?
With this rule in place, this...

SliverToBoxAdapter(child: HEADER_WIDGET),
SliverList.builder(itemBuilder: LOTS_OF_CONTENTS)

This...

SliverList.list(children: [HEADER_WIDGET]),
SliverList.builder(itemBuilder: LOTS_OF_CONTENTS)

Do I need to write it like this?
I asked if I could write the above!

If the data is drawn all at once, it is the same as when columns are used, so I thought there would not be much of a performance problem unless it is used to display a large amount of data.
I am concerned about the fact that SliverList must be used even though it is not a List.

@riscait
Copy link
Member

riscait commented Jul 29, 2024

Instead, would a rule like "do not use Column as a child of SliverToBoxAdapter" be a good idea?

Base automatically changed from add-avoid-shrink-wrap-in-list-view to main July 29, 2024 05:29
@naipaka naipaka force-pushed the add-avoid-sliver-to-box-adapter branch from 1df3918 to 0475751 Compare July 29, 2024 08:35
@naipaka naipaka changed the title feat: Add avoid_sliver_to_box_adapter rule feat: Add avoid_consecutive_sliver_to_box_adapter rule Jul 29, 2024
@naipaka
Copy link
Contributor Author

naipaka commented Jul 29, 2024

@riscait
Thank you for your valuable input!
Based on the feedback and discussion, I have modified it to issue a warning if SliverToBoxAdapter is used consecutively!

Please review and confirm ๐Ÿ™‡โ€โ™‚๏ธ

When SliverToBoxAdapter is consecutive:
CleanShot 2024-07-29 at 17 36 53

When SliverToBoxAdapter is consecutive and wrapped in SliverPadding:
CleanShot 2024-07-29 at 17 37 03

When SliverToBoxAdapter is not consecutive:
CleanShot 2024-07-29 at 17 37 10

@naipaka naipaka requested a review from riscait July 29, 2024 08:41
Copy link
Member

@riscait riscait left a comment

Choose a reason for hiding this comment

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

LGTM
Excellent response! Perfect, thank you!

@naipaka naipaka merged commit 8a22122 into main Jul 29, 2024
1 check passed
@naipaka naipaka deleted the add-avoid-sliver-to-box-adapter branch July 29, 2024 09:34
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.

3 participants