Skip to content

DropDownMenu secondary trailing widget (e.g. for clear action) #175847

@Gustl22

Description

@Gustl22

Use case

If having a DropDownMenu it is currently only possible to replace the trailingIcon, which is tied to an action.

Internally a TextField with an IconButton is used to provide this dropdown action.

For convenience it should also be possible to define more trailing actions apart from the dropdown functionality. In comparison to a TextField, where this trailing icon is usually used as a clear action, it should also be possible for a DropDownMenu to define such an action via e.g. secondaryTrailing, which also could hold a list to define multiple trailing widgets, in front of the current dropdown tralingIcon.

Proposal

How it currently is:

Image

Proposal:

Image

E.g. by providing a property called secodaryTrailing

As reference: This is how its shown for a textfield with a clear icon:
https://m3.material.io/components/text-fields/overview

Image

Workarounds

For me no workarounds are known. If replacing the trailingIcon with a Row of IconButtons the Row would be still wrapped by the IconButton of the DropDownMenu Widget, which would result in a double wrapped IconButton, if providing a second one next to it.

Alternative solutions

We could also have a trailing parameter, which overrides all actions, but then it would be advisable to instead have a trailingBuilder to provide the dropdown action in the parameters, so one is able to customize the trailing widget without need of rebuilding the dropdown action.

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: 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: solvedIssue is closed as solvedteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions