Skip to content

TextInputConfiguration should implement value equality #139033

@angelosilvestre

Description

@angelosilvestre

Is there an existing issue for this?

Use case

Widgets that open a TextInputConnection might receive a TextInputConfiguration to forward it to TextInput.attach.

For those kinds of widgets, it's expected that they will detach and re-attach to the IME when the TextInputConfiguration changes during didUpdateWidget. For example:

@override
void didUpdateWidget(Widget oldWidget) {
  super.didUpdateWidget(oldWidget);
  if (widget.imeConfiguration != oldWidget.imeConfiguration) {
    // close input connection.
    // open new input connection.
  }
}

Consider this widget being used in the following example:

MyWidget(
  imeConfiguration: TextInputConfiguration(
    textCapitalization: TextCapitalization.characters,
  ),
)

In this example, each time the widget rebuilds, it closes and re-opens the IME connection, because we will have different TextInputConfiguration instances and, by checkingwidget.imeConfiguration != oldWidget.imeConfiguration, we are comparing only the references.

Proposal

Implement the == operator for both TextInputConfiguration and AutofillConfiguration, so two instances with the same values are considered to be equal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions