Repository navigation
Widget constructors expect children in inconsistent ways #241
Description
Activity
- addedc: contributor-productivityTeam-specific productivity, code health, technical debt.Team-specific productivity, code health, technical debt.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
on Nov 9, 2015 Comment by abarth
Thursday Oct 29, 2015 at 20:48 GMT
Yeah, the pattern we've been using is that if you take one widget as a child, you use the name
child. If you take a list, then you use a positional argument. Are you suggesting that we make the list widgets use the namechildtoo? Maybechildren?Comment by ianloic
Monday Nov 02, 2015 at 18:21 GMT
I don't have a concrete suggestion other than it's a little confusing. Perhaps make the list widgets use children so that I'm forced to be explicit everywhere.
I think we should just always use named arguments for children, since the children argument often takes up many lines of code and usually reads best when it's the last argument passed to a constructor.
Will do.
- added a commit that references this issue
on Jan 11, 2016 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Aug 17, 2021
Thursday Oct 29, 2015 at 20:28 GMT
Originally opened as https://github.com/flutter/engine/issues/1872
Some widgets (eg: Container) require a name
child:argument to specify their children. Others (eg: Flex) take their children as the first argument. This inconsistency is confusing - especially as I switch between different container widgets.