Add button semantics in list tile (#112593)

This commit is contained in:
hangyu 2022-10-01 03:52:08 +08:00 committed by GitHub
parent c7a0218aa0
commit 1e87fdd883
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 0 deletions

View file

@ -747,6 +747,7 @@ class ListTile extends StatelessWidget {
autofocus: autofocus,
enableFeedback: enableFeedback ?? tileTheme.enableFeedback ?? true,
child: Semantics(
button: onTap != null,
selected: selected,
enabled: enabled,
child: Ink(

View file

@ -325,6 +325,7 @@ void main() {
),
TestSemantics.rootChild(
flags: <SemanticsFlag>[
SemanticsFlag.isButton,
SemanticsFlag.hasEnabledState,
SemanticsFlag.isEnabled,
SemanticsFlag.isFocusable,

View file

@ -407,6 +407,7 @@ void main() {
SemanticsFlag.hasCheckedState,
SemanticsFlag.hasEnabledState,
SemanticsFlag.isEnabled,
SemanticsFlag.isButton,
SemanticsFlag.isInMutuallyExclusiveGroup,
SemanticsFlag.isFocusable,
],
@ -444,6 +445,7 @@ void main() {
SemanticsFlag.isChecked,
SemanticsFlag.hasEnabledState,
SemanticsFlag.isEnabled,
SemanticsFlag.isButton,
SemanticsFlag.isInMutuallyExclusiveGroup,
SemanticsFlag.isFocusable,
],

View file

@ -677,6 +677,7 @@ void main() {
hasToggledState: true,
isToggled: true,
isEnabled: true,
isButton: true,
isFocusable: true,
hasEnabledState: true,
label: 'Switch tile',

View file

@ -76,6 +76,7 @@ void main() {
SemanticsFlag.hasEnabledState,
SemanticsFlag.hasToggledState,
SemanticsFlag.isEnabled,
SemanticsFlag.isButton,
SemanticsFlag.isFocusable,
SemanticsFlag.isToggled,
],
@ -91,6 +92,7 @@ void main() {
SemanticsFlag.hasEnabledState,
SemanticsFlag.isChecked,
SemanticsFlag.isEnabled,
SemanticsFlag.isButton,
SemanticsFlag.isFocusable,
],
actions: SemanticsAction.tap.index,
@ -104,6 +106,7 @@ void main() {
SemanticsFlag.hasCheckedState,
SemanticsFlag.hasEnabledState,
SemanticsFlag.isEnabled,
SemanticsFlag.isButton,
SemanticsFlag.isFocusable,
SemanticsFlag.isInMutuallyExclusiveGroup,
],