Skip to content

ListTile should be able to set SemanticProperties.button: true if it has an enabled onTap #111960

@math1man

Description

@math1man

Use case

Everywhere in our app that we use a clickable ListTile, we have to wrap it like

Semantics(
  button: true,
  child: ListTile(
    onTap: doFoo,
    // other attributes
  ),
)

This is tedious and adds extra widget depth. We could create a wrapper widget, but replicating all the attributes of ListTile is burdensome as well.

Proposal

This is because even when a ListTile specifies a valid onTap attribute, it does not implicitly set the button semantic property. It seems like the extra semantics should not be necessary, and ListTile should do this automatically. I'm sure we're not the only app doing this.

It should also populate the enabled semantic property if applicable and it doesn't already.

I believe both of these behaviors should somehow be configurable though. Something like adding a bool? buttonSemantics constructor argument to ListTile that can be set by a caller but otherwise falls back to whether or not onTap == null.

Metadata

Metadata

Assignees

Labels

Bot is counting down the days until it unassigns the issueP2Important 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.team-designOwned by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions