Skip to content

Commit d9885d7

Browse files
authored
[material_ui] Decouple disabled CheckboxListTile state in a11y_assessments (#13177)
Decouples the disabled `CheckboxListTile` (`enabled: false`) in `a11y_assessments`'s `/check-box-list-tile` use case from the enabled tile's mutable `_checked` state so toggling the first checkbox does not also flip the disabled checkbox to checked (the other 5 use cases originally in this branch landed in #13159 and #13243). Only the `a11y_assessments` test app changes, so no package version or CHANGELOG update is needed. Fixes flutter/flutter#194905 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 65b6fab commit d9885d7

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

‎packages/material_ui/test_apps/a11y_assessments/lib/use_cases/check_box_list_tile.dart‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,10 @@ class _MainWidgetState extends State<_MainWidget> {
4747
},
4848
title: const Text('a check box list title'),
4949
),
50-
CheckboxListTile(
51-
value: _checked,
52-
onChanged: (bool? value) {
53-
setState(() {
54-
_checked = value!;
55-
});
56-
},
57-
title: const Text('a disabled check box list title'),
50+
const CheckboxListTile(
51+
value: false,
52+
onChanged: null,
53+
title: Text('a disabled check box list title'),
5854
enabled: false,
5955
),
6056
],

‎packages/material_ui/test_apps/a11y_assessments/test/check_box_list_tile_test.dart‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'package:a11y_assessments/use_cases/check_box_list_tile.dart';
66
import 'package:flutter_test/flutter_test.dart';
7+
import 'package:material_ui/material_ui.dart';
78

89
import 'test_utils.dart';
910

@@ -12,6 +13,15 @@ void main() {
1213
await pumpsUseCase(tester, CheckBoxListTile());
1314
expect(find.text('a check box list title'), findsOneWidget);
1415
expect(find.text('a disabled check box list title'), findsOneWidget);
16+
17+
await tester.tap(find.text('a check box list title'));
18+
await tester.pumpAndSettle();
19+
20+
final List<CheckboxListTile> tiles = tester
21+
.widgetList<CheckboxListTile>(find.byType(CheckboxListTile))
22+
.toList();
23+
expect(tiles[0].value, isTrue);
24+
expect(tiles[1].value, isFalse);
1525
});
1626

1727
testWidgets('check box list has one h1 tag', (WidgetTester tester) async {

0 commit comments

Comments
 (0)