Skip to content

textCapitalization option for SearchBar #131260

@jamesncl

Description

@jamesncl

Is there an existing issue for this?

Use case

Using the new material 3 SearchBar, it would be nice to be able to pass in the TextCapitalization to use in the TextField.

For example, if I have a SearchBar where the user can search a list of things, or create one if it doesn't exist in the list, sometimes I want those new things to begin with a capital letter as default without the user having to manually use shift to capitalize the first letter. Currently this is not possible.

Proposal

Currently this is what happens by default when you type into SearchBar without manually using shift to capitalize the first letter:

image

To allow this to default to "New thing", it's a really easy addition: allow passing in a TextCapitalization property:

SearchBar(
   hintText: "Search or create",
   onChanged: widget.onChanged,
   textCapitalization: TextCapitalization.sentences,
)

And apply this to the TextField in SearchBar:

                      TextField(
                        ...
                        // ADD THIS:
                        textCapitalization: widget.textCapitalization,
                      )

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions