Use tristate checkbox engine changes (#111032)

* Introduce tests for tristate checkboxes

* Initial

* Use tristate changes in engine

* Flutter_test matchers test update

* Comments, tests

* Update packages/flutter/lib/src/semantics/semantics.dart

Co-authored-by: Chris Bracken <chris@bracken.jp>

* Assert mutual exclusivity

* Assert valid state before updating state

* Update packages/flutter/lib/src/semantics/semantics.dart

Typo fix in comment

Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>

Co-authored-by: Chris Bracken <chris@bracken.jp>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
This commit is contained in:
yaakovschectman
2022-09-08 17:41:54 -04:00
committed by GitHub
parent 70f6bed9ee
commit 4d3c122434
10 changed files with 158 additions and 8 deletions

View File

@@ -542,6 +542,7 @@ Matcher matchesSemantics({
// Flags //
bool hasCheckedState = false,
bool isChecked = false,
bool isCheckStateMixed = false,
bool isSelected = false,
bool isButton = false,
bool isSlider = false,
@@ -617,6 +618,7 @@ Matcher matchesSemantics({
// Flags
hasCheckedState: hasCheckedState,
isChecked: isChecked,
isCheckStateMixed: isCheckStateMixed,
isSelected: isSelected,
isButton: isButton,
isSlider: isSlider,
@@ -713,6 +715,7 @@ Matcher containsSemantics({
// Flags
bool? hasCheckedState,
bool? isChecked,
bool? isCheckStateMixed,
bool? isSelected,
bool? isButton,
bool? isSlider,
@@ -788,6 +791,7 @@ Matcher containsSemantics({
// Flags
hasCheckedState: hasCheckedState,
isChecked: isChecked,
isCheckStateMixed: isCheckStateMixed,
isSelected: isSelected,
isButton: isButton,
isSlider: isSlider,
@@ -2085,6 +2089,7 @@ class _MatchesSemanticsData extends Matcher {
// Flags
required bool? hasCheckedState,
required bool? isChecked,
required bool? isCheckStateMixed,
required bool? isSelected,
required bool? isButton,
required bool? isSlider,
@@ -2138,6 +2143,7 @@ class _MatchesSemanticsData extends Matcher {
}) : flags = <SemanticsFlag, bool>{
if (hasCheckedState != null) SemanticsFlag.hasCheckedState: hasCheckedState,
if (isChecked != null) SemanticsFlag.isChecked: isChecked,
if (isCheckStateMixed != null) SemanticsFlag.isCheckStateMixed: isCheckStateMixed,
if (isSelected != null) SemanticsFlag.isSelected: isSelected,
if (isButton != null) SemanticsFlag.isButton: isButton,
if (isSlider != null) SemanticsFlag.isSlider: isSlider,

View File

@@ -656,6 +656,7 @@ void main() {
/* Flags */
hasCheckedState: true,
isChecked: true,
isCheckStateMixed: true,
isSelected: true,
isButton: true,
isSlider: true,