Skip to content

Need to rationalise the names of the *Input* and *Field* classes #7031

Closed

Description

@Hixie

As of today:

InputField is not an Input and is not a FormField. It contains a RawInput.
InputContainer is not an Input and is not a Container.
Input builds an InputContainer containing an InputField.
InputFormField extends FormField and builds an Input.

This is very confusing. We should rationalise these names.

See also #7017 about documenting all this better.

cc @HansMuller, @mpcomplete, @abarth

Activity

  1. HansMuller commented on Nov 28, 2016

    @HansMuller
    Contributor

    Also, per #6733 (comment), in the Material spec and in many GUI toolkits, Input is called TextField.

  2. mpcomplete commented on Dec 8, 2016

    @mpcomplete
    Contributor

    Proposal:

    Input => TextField (to match Material spec)
    InputContainer => TextFieldDecorator
    InputField => TextFieldEditable
    InputFormField => TextFormField

    Let's decide on this soon. The longer we wait, the more people we will break.

  3. Hixie commented on Dec 9, 2016

    @Hixie
    ContributorAuthor

    InputContainer/TextFieldDecorator isn't just about Inputs/TextFields. How about something like ControlLabel or something for that one?

    Form uses FormFields. TextField and FormField sound like they'd be related, but aren't in this model.

    I like that today InputFormField is a FormField.

    I do like the TextField name, that makes sense to me. We could find another term for FormField, maybe FormControl? then you can have TextFieldControl for the version of TextField that is a Control. Or TextFieldFormControl but that's a bit long.

    RawInput could be RawTextField. Today's InputField is between TextField and RawInput, maybe PlainTextField? But that suggests it's a "plain-text field", as opposed to a "plain text-field". Maybe UndecoratedTextField?

    What does TextField add? Could we drop it and require that people either use TextFieldControl or ControlLabel+PlainTextField? In which case we could rename that latter one to just TextField? But then it's weird that TextFieldControl does more than just add the FormControl to the TextField, it also adds the ControlLabel...

    In general, if Foo is a class, then BarFoo should be a subclass of Foo that adds bar-related functionality, and FooBaz should be a helper class for Foos that handles baz-related logic.

  4. mpcomplete commented on Dec 12, 2016

    @mpcomplete
    Contributor

    I like UndecoratedTextField. It's the most accurate description. I suspect most people won't use it anyway.

    TextField is the Material-spec implementation and should be most common, so I think we should keep that.

    I also like the Foo => BarFoo naming convention. I was trying to avoid the repetition of "Field", but maybe that's not worth it.

    Something about "FormControl" seems wrong to me. Maybe it's just me.

    New proposal:

    RawInput => RawTextField
    Input => TextField
    InputContainer => TextFieldDecorator
    InputField => UndecoratedTextField
    InputFormField => TextFieldFormField or TextFieldFormControl (these options are my least favorite)

  5. Hixie commented on Dec 12, 2016

    @Hixie
    ContributorAuthor

    InputContainer is for any kind of form control, right? Not just text fields.

    In general I would avoid a name FooBar if both Foo and Bar are classes because that's confusing (is it a subclass of Bar, or a utility class for Foo?).

  6. Hixie commented on Dec 12, 2016

    @Hixie
    ContributorAuthor

    RawTextField/UndecoratedTextField/TextField seems good to me.

    I think we should broaden the scope of renames to include Form, FormField, and FormState (which by the way has no documentation). (Not saying we need to rename all of these, just that including them in the list is good for noticing if your names are consistent.)

  7. mpcomplete commented on Dec 12, 2016

    @mpcomplete
    Contributor

    Oops you're right, I glossed over InputContainer for some reason. That one's hard to name, because it's such a weird grab bag of stuff. WidgetThatAddsSomeTextFieldLikeDecorationsToChild would be accurate...

  8. Hixie commented on Dec 12, 2016

    @Hixie
    ContributorAuthor

    Maybe InputFieldDecorator or something like that?

  9. abarth commented on Dec 13, 2016

    @abarth
    Contributor

    Here's a slate:

    • Form
    • FormState
    • FormAssociatedWidget
    • RawEditableText
    • EditableText
    • InputFieldDecorator
    • TextField
    • TextFormField
  10. Hixie commented on Dec 13, 2016

    @Hixie
    ContributorAuthor

    What is FormAssociatedWidget? Oh, I see, the current FormField.

  11. abarth commented on Dec 13, 2016

    @abarth
    Contributor

    Yes. It's a base class for other widgets, which with tend to name either with a "Widget" suffix (e.g., AnimatedWidget) or with an "able" suffix (e.g., Pageable).

  12. Hixie commented on Dec 13, 2016

    @Hixie
    ContributorAuthor

    One thing is that EditableText is material-specific (it uses material UI for its popup menu). It's weird that we'd have a RawEditableText in widgets/ an EditableText + TextField in material/. I think Matt's UndecoratedTextField/TextField might be better.

  13. abarth commented on Dec 13, 2016

    @abarth
    Contributor

    Ah, I missed that UndecoratedTextField was material-specific. It's usually a bad pattern to name something after what it isn't. Maybe RawTextField?

  14. 23 remaining items

  15. self-assigned this
    on Mar 20, 2017
  16. abarth commented on Mar 31, 2017

    @abarth
    Contributor

    New proposal:

    • Form
    • FormState
    • FormField
    • EditableText (the widgets version)
    • TextField
      • all-sing, all-dance text field control
      • input decoration is optional, but enabled by default
      • not a form field
    • TextFormField
      • All the dancing and singing of TextField but also a FormField
    • InputDecorator
  17. abarth commented on Mar 31, 2017

    @abarth
    Contributor

    Also, InputDecoration, which bundles up all the consty parameters to InputDecorator to make them easier to deal with.

  18. Hixie commented on Mar 31, 2017

    @Hixie
    ContributorAuthor

    SGTM

  19. added a commit that references this issue on Apr 2, 2017
    ae89948
  20. github-actions commented on Sep 5, 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.

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

Metadata

Metadata

Assignees

Labels

c: API breakBackwards-incompatible API changesframeworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions