Skip to content

Commit

Permalink
Use correct semantics for toggle buttons (flutter#113851)
Browse files Browse the repository at this point in the history
* Use correct semantics for toggle buttons

* x
  • Loading branch information
guidezpl committed Oct 24, 2022
1 parent 0b1fbd2 commit 15a4b00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/toggle_buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ class ToggleButtons extends StatelessWidget {
return MergeSemantics(
child: Semantics(
container: true,
toggled: isSelected[index],
checked: isSelected[index],
enabled: onPressed != null,
child: _InputPadding(
minSize: minPaddingSize,
Expand Down
14 changes: 7 additions & 7 deletions packages/flutter/test/material/toggle_buttons_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,7 @@ void main() {
SemanticsFlag.isButton,
SemanticsFlag.isEnabled,
SemanticsFlag.hasEnabledState,
SemanticsFlag.hasToggledState,
SemanticsFlag.hasCheckedState,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[
Expand All @@ -2019,7 +2019,7 @@ void main() {
SemanticsFlag.isButton,
SemanticsFlag.isEnabled,
SemanticsFlag.hasEnabledState,
SemanticsFlag.hasToggledState,
SemanticsFlag.hasCheckedState,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[
Expand All @@ -2032,7 +2032,7 @@ void main() {
SemanticsFlag.isButton,
SemanticsFlag.isEnabled,
SemanticsFlag.hasEnabledState,
SemanticsFlag.hasToggledState,
SemanticsFlag.hasCheckedState,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[
Expand All @@ -2051,7 +2051,7 @@ void main() {
semantics.dispose();
});

testWidgets('Toggle buttons have correct semantics', (WidgetTester tester) async {
testWidgets('Toggle buttons have correct semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);

await tester.pumpWidget(
Expand Down Expand Up @@ -2079,7 +2079,7 @@ void main() {
SemanticsFlag.isButton,
SemanticsFlag.isEnabled,
SemanticsFlag.hasEnabledState,
SemanticsFlag.hasToggledState,
SemanticsFlag.hasCheckedState,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[
Expand All @@ -2091,8 +2091,8 @@ void main() {
SemanticsFlag.isButton,
SemanticsFlag.isEnabled,
SemanticsFlag.hasEnabledState,
SemanticsFlag.isToggled,
SemanticsFlag.hasToggledState,
SemanticsFlag.isChecked,
SemanticsFlag.hasCheckedState,
SemanticsFlag.isFocusable,
],
actions: <SemanticsAction>[
Expand Down

0 comments on commit 15a4b00

Please sign in to comment.