Unverified Commit 5d03a593 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Allow wrapping CheckBox in Semantics (#15259)

parent 7d1ceb40
......@@ -329,7 +329,6 @@ abstract class RenderToggleable extends RenderConstrainedBox {
void describeSemanticsConfiguration(SemanticsConfiguration config) {
super.describeSemanticsConfiguration(config);
config.isSemanticBoundary = true;
config.isEnabled = isInteractive;
if (isInteractive)
config.onTap = _handleTap;
......
......@@ -11,6 +11,10 @@ import 'package:flutter/material.dart';
import '../widgets/semantics_tester.dart';
void main() {
setUp(() {
debugResetSemanticsIdCounter();
});
testWidgets('CheckBox semantics', (WidgetTester tester) async {
final SemanticsTester semantics = new SemanticsTester(tester);
......@@ -103,6 +107,41 @@ void main() {
semantics.dispose();
});
testWidgets('Can wrap CheckBox with Semantics', (WidgetTester tester) async {
final SemanticsTester semantics = new SemanticsTester(tester);
await tester.pumpWidget(new Material(
child: new Semantics(
label: 'foo',
textDirection: TextDirection.ltr,
child: new Checkbox(
value: false,
onChanged: (bool b) { },
),
),
));
expect(semantics, hasSemantics(new TestSemantics.root(
children: <TestSemantics>[
new TestSemantics.rootChild(
id: 1,
label: 'foo',
textDirection: TextDirection.ltr,
flags: <SemanticsFlag>[
SemanticsFlag.hasCheckedState,
SemanticsFlag.hasEnabledState,
SemanticsFlag.isEnabled,
],
actions: <SemanticsAction>[
SemanticsAction.tap,
],
),
],
), ignoreRect: true, ignoreTransform: true));
semantics.dispose();
});
testWidgets('CheckBox tristate: true', (WidgetTester tester) async {
bool checkBoxValue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment