Skip to content

Commit 15a4b00

Browse files
authored
Use correct semantics for toggle buttons (#113851)
* Use correct semantics for toggle buttons * x
1 parent 0b1fbd2 commit 15a4b00

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/flutter/lib/src/material/toggle_buttons.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ class ToggleButtons extends StatelessWidget {
798798
return MergeSemantics(
799799
child: Semantics(
800800
container: true,
801-
toggled: isSelected[index],
801+
checked: isSelected[index],
802802
enabled: onPressed != null,
803803
child: _InputPadding(
804804
minSize: minPaddingSize,

packages/flutter/test/material/toggle_buttons_test.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ void main() {
20062006
SemanticsFlag.isButton,
20072007
SemanticsFlag.isEnabled,
20082008
SemanticsFlag.hasEnabledState,
2009-
SemanticsFlag.hasToggledState,
2009+
SemanticsFlag.hasCheckedState,
20102010
SemanticsFlag.isFocusable,
20112011
],
20122012
actions: <SemanticsAction>[
@@ -2019,7 +2019,7 @@ void main() {
20192019
SemanticsFlag.isButton,
20202020
SemanticsFlag.isEnabled,
20212021
SemanticsFlag.hasEnabledState,
2022-
SemanticsFlag.hasToggledState,
2022+
SemanticsFlag.hasCheckedState,
20232023
SemanticsFlag.isFocusable,
20242024
],
20252025
actions: <SemanticsAction>[
@@ -2032,7 +2032,7 @@ void main() {
20322032
SemanticsFlag.isButton,
20332033
SemanticsFlag.isEnabled,
20342034
SemanticsFlag.hasEnabledState,
2035-
SemanticsFlag.hasToggledState,
2035+
SemanticsFlag.hasCheckedState,
20362036
SemanticsFlag.isFocusable,
20372037
],
20382038
actions: <SemanticsAction>[
@@ -2051,7 +2051,7 @@ void main() {
20512051
semantics.dispose();
20522052
});
20532053

2054-
testWidgets('Toggle buttons have correct semantics', (WidgetTester tester) async {
2054+
testWidgets('Toggle buttons have correct semantics', (WidgetTester tester) async {
20552055
final SemanticsTester semantics = SemanticsTester(tester);
20562056

20572057
await tester.pumpWidget(
@@ -2079,7 +2079,7 @@ void main() {
20792079
SemanticsFlag.isButton,
20802080
SemanticsFlag.isEnabled,
20812081
SemanticsFlag.hasEnabledState,
2082-
SemanticsFlag.hasToggledState,
2082+
SemanticsFlag.hasCheckedState,
20832083
SemanticsFlag.isFocusable,
20842084
],
20852085
actions: <SemanticsAction>[
@@ -2091,8 +2091,8 @@ void main() {
20912091
SemanticsFlag.isButton,
20922092
SemanticsFlag.isEnabled,
20932093
SemanticsFlag.hasEnabledState,
2094-
SemanticsFlag.isToggled,
2095-
SemanticsFlag.hasToggledState,
2094+
SemanticsFlag.isChecked,
2095+
SemanticsFlag.hasCheckedState,
20962096
SemanticsFlag.isFocusable,
20972097
],
20982098
actions: <SemanticsAction>[

0 commit comments

Comments
 (0)