- 
                Notifications
    You must be signed in to change notification settings 
- Fork 275
feat: add avoid-shrink-wrap-in-lists #918
Conversation
| Dart Code Metrics unused files report of dart_code_metrics. ✅Summary
 | 
| Dart Code Metrics analyze report of dart_code_metrics. ✅Summary
 | 
| Codecov Report
 @@            Coverage Diff             @@
##           master     dart-lang/linter#918      +/-   ##
==========================================
+ Coverage   87.45%   87.52%   +0.06%     
==========================================
  Files         304      306       +2     
  Lines        6266     6300      +34     
==========================================
+ Hits         5480     5514      +34     
  Misses        786      786              
 Continue to review full report at Codecov. 
 | 
| ) != | ||
| null; | ||
|  | ||
| bool _hasParentList(InstanceCreationExpression node) => | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @incendial , awesome work! I took the liberty of reviewing your PR and I think there's one way to make it even better: when we have a list inside another like we're testing, we usually have to wrap them in an Expanded Widget (check the bad case scenario). Because of that, I believe it would be better if we test for that case as well in this rule.
WDYT? Does that make sense to you? Let me know if you need me to make the adjustments for you, I'd be glad to help!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabrielaraujoz hi! Thanks for taking a look. Do you mean that we should first check if the ListView is in the Expanded and then if it's in the Column/Row/ListView?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! If I'd do it, I'd check for both scenarios: if it's parent is an Expanded that has a Column/Row parent and the cases you're currently testing as well.
When working with Column and Row, if you have a widget with unbounded height/width you need to wrap it in a Flexible or Expanded, else you'll have the unbounded height/width exception. I don't believe this is necessary for ListViews tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabrielaraujoz but it looks like wrapping in Expanded is a subset of all cases when a ListView is in the Column/Row, isn't it? Meaning, that the current check already covers it
| Kudos, SonarCloud Quality Gate passed!     | 








What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix
[X] New rule
[ ] Changes an existing rule
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
Implementing https://github.com/dart-lang/linter/issues/3496