Skip to content

Widget constructors expect children in inconsistent ways #241

Description

@FlutterIssues

Issue by ianloic
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.

Activity

  1. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    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 name child too? Maybe children?

  2. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    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.

  3. tvolkert commented on Nov 30, 2015

    @tvolkert
    Contributor

    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.

  4. modified the milestone: on Dec 16, 2015
  5. self-assigned this
    on Jan 11, 2016
  6. abarth commented on Jan 11, 2016

    @abarth
    Contributor

    Will do.

  7. added a commit that references this issue on Jan 11, 2016
    0567664
  8. github-actions commented on Aug 17, 2021

    @github-actions

    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 -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

c: contributor-productivityTeam-specific productivity, code health, technical debt.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions