Skip to content

Resolve Text Input Code Divergence #122647

@InMatrix

Description

@InMatrix

I was looking to use CupertinoTextField on iOS and TextField on Android for my app. The API differences between the two widgets for seemingly similar concepts feel rather unnecessary. Here are some examples:

  • To add a piece of hint text, I need to supply that through the decoration property on TextField but the placeholder property on CupertinoTextField.
  • The decoration property on TextField takes an InputDecoration, but the same property on CupertinoTextField takes a BoxDecoration.
  • To add a prefix icon, I can use the prefixIcon property on InputDecoration, which I then pass to the decoration property on TextField. However, I need to use the prefix property on CupertinoTextField to achieve a similar result.

Such differences make it difficult to 1) reason about how to use CupertinoTextField based on my knowledge about TextField, and 2) minimize platform-specific code when showing one of the two widgets based on the OS.

It could be helpful if a base text field is provided and design language is applied through theming or decoration.

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 problemsf: cupertinoflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions