Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
29e0e8b2
Unverified
Commit
29e0e8b2
authored
Jun 15, 2018
by
Jonah Williams
Committed by
GitHub
Jun 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Tristate checkbox semantics to consider indeterminate as "unchecked" (#18297)
parent
bcaf026c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
1 deletion
+64
-1
toggleable.dart
packages/flutter/lib/src/material/toggleable.dart
+1
-1
checkbox_test.dart
packages/flutter/test/material/checkbox_test.dart
+63
-0
No files found.
packages/flutter/lib/src/material/toggleable.dart
View file @
29e0e8b2
...
...
@@ -339,7 +339,7 @@ abstract class RenderToggleable extends RenderConstrainedBox {
config
.
isEnabled
=
isInteractive
;
if
(
isInteractive
)
config
.
onTap
=
_handleTap
;
config
.
isChecked
=
_value
!=
fals
e
;
config
.
isChecked
=
_value
==
tru
e
;
}
@override
...
...
packages/flutter/test/material/checkbox_test.dart
View file @
29e0e8b2
...
...
@@ -202,6 +202,69 @@ void main() {
expect
(
checkBoxValue
,
null
);
});
testWidgets
(
'has semantics for tristate'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Checkbox
(
tristate:
true
,
value:
null
,
onChanged:
(
bool
newValue
)
{},
),
),
);
expect
(
semantics
.
nodesWith
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasCheckedState
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
),
hasLength
(
1
));
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Checkbox
(
tristate:
true
,
value:
true
,
onChanged:
(
bool
newValue
)
{},
),
),
);
expect
(
semantics
.
nodesWith
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasCheckedState
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
SemanticsFlag
.
isChecked
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
),
hasLength
(
1
));
await
tester
.
pumpWidget
(
new
Material
(
child:
new
Checkbox
(
tristate:
true
,
value:
false
,
onChanged:
(
bool
newValue
)
{},
),
),
);
expect
(
semantics
.
nodesWith
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasCheckedState
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
),
hasLength
(
1
));
semantics
.
dispose
();
});
testWidgets
(
'has semantic events'
,
(
WidgetTester
tester
)
async
{
dynamic
semanticEvent
;
bool
checkboxValue
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment