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
9cb2d4d6
Unverified
Commit
9cb2d4d6
authored
Sep 08, 2020
by
chunhtai
Committed by
GitHub
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the sliver appbar to have a fixed traversal order (#65049)
parent
0bb1e573
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
47 deletions
+171
-47
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+14
-6
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+86
-4
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+49
-25
sliver_semantics_test.dart
packages/flutter/test/widgets/sliver_semantics_test.dart
+22
-12
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
9cb2d4d6
...
...
@@ -698,12 +698,20 @@ class _AppBarState extends State<AppBar> {
appBar
=
Stack
(
fit:
StackFit
.
passthrough
,
children:
<
Widget
>[
widget
.
flexibleSpace
,
// Creates a material widget to prevent the flexibleSpace from
// obscuring the ink splashes produced by appBar children.
Material
(
type:
MaterialType
.
transparency
,
child:
appBar
,
Semantics
(
sortKey:
const
OrdinalSortKey
(
1.0
),
explicitChildNodes:
true
,
child:
widget
.
flexibleSpace
,
),
Semantics
(
sortKey:
const
OrdinalSortKey
(
0.0
),
explicitChildNodes:
true
,
// Creates a material widget to prevent the flexibleSpace from
// obscuring the ink splashes produced by appBar children.
child:
Material
(
type:
MaterialType
.
transparency
,
child:
appBar
,
),
),
],
);
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
9cb2d4d6
...
...
@@ -1649,12 +1649,94 @@ void main() {
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Leading'
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Leading'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Action 1'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
TestSemantics
(),
],
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
),
],
),
],
),
],
),
],
),
],
),
ignoreRect:
true
,
ignoreTransform:
true
,
ignoreId:
true
,
));
semantics
.
dispose
();
});
testWidgets
(
'SliverAppBar with flexable space has correct semantics order'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/64922.
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
CustomScrollView
(
slivers:
<
Widget
>[
SliverAppBar
(
leading:
Text
(
'Leading'
),
flexibleSpace:
Text
(
'Flexible space'
),
actions:
<
Widget
>[
Text
(
'Action 1'
)],
),
],
),
),
);
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Leading'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Action 1'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
TestSemantics
(
label:
'Action 1'
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
],
label:
'Flexible space'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
...
...
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
9cb2d4d6
...
...
@@ -178,25 +178,37 @@ void main() {
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
expandedHeight
),
children:
<
TestSemantics
>[
TestSemantics
(
id:
11
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
100.0
,
20.0
),
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
,
SemanticsFlag
.
namesRoute
id:
12
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
200.0
),
children:
<
TestSemantics
>[
TestSemantics
(
id:
13
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
100.0
,
20.0
),
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
,
SemanticsFlag
.
namesRoute
],
label:
'Title'
,
textDirection:
TextDirection
.
ltr
,
),
],
label:
'Title'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
10
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
expandedHeight
),
label:
'Expanded title'
,
textDirection:
TextDirection
.
ltr
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
200.0
),
children:
<
TestSemantics
>[
TestSemantics
(
id:
11
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
expandedHeight
),
label:
'Expanded title'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
TestSemantics
(
id:
1
2
,
id:
1
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
rect:
TestSemantics
.
fullScreen
,
actions:
<
SemanticsAction
>[
SemanticsAction
.
scrollUp
],
...
...
@@ -272,27 +284,39 @@ void main() {
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
56.0
),
children:
<
TestSemantics
>[
TestSemantics
(
id:
11
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
100.0
,
20.0
),
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
,
SemanticsFlag
.
namesRoute
id:
12
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
56.0
),
children:
<
TestSemantics
>[
TestSemantics
(
id:
13
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
100.0
,
20.0
),
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
,
SemanticsFlag
.
namesRoute
],
label:
'Title'
,
textDirection:
TextDirection
.
ltr
,
),
],
label:
'Title'
,
textDirection:
TextDirection
.
ltr
,
),
// The flexible space bar still persists in the
// semantic tree even if it is collapsed.
TestSemantics
(
id:
10
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
36.0
,
800.0
,
92.0
),
label:
'Expanded title'
,
textDirection:
TextDirection
.
ltr
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
56.0
),
children:
<
TestSemantics
>[
TestSemantics
(
id:
11
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
36.0
,
800.0
,
92.0
),
label:
'Expanded title'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
TestSemantics
(
id:
1
2
,
id:
1
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
rect:
TestSemantics
.
fullScreen
,
actions:
<
SemanticsAction
>[
SemanticsAction
.
scrollUp
,
SemanticsAction
.
scrollDown
],
...
...
@@ -324,20 +348,20 @@ void main() {
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
1
3
,
id:
1
5
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
200.0
),
label:
'Item 4'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
1
4
,
id:
1
6
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
200.0
),
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
label:
'Item 5'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
id:
1
5
,
id:
1
7
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
50.0
),
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
label:
'Item 6'
,
...
...
packages/flutter/test/widgets/sliver_semantics_test.dart
View file @
9cb2d4d6
...
...
@@ -986,13 +986,18 @@ void _tests() {
TestSemantics
(
tags:
<
SemanticsTag
>[
RenderViewport
.
excludeFromScrolling
],
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
,
SemanticsFlag
.
isHeader
,
TestSemantics
(),
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
,
SemanticsFlag
.
isHeader
,
],
label:
'Forward app bar'
,
textDirection:
TextDirection
.
ltr
,
),
],
label:
'Forward app bar'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
...
...
@@ -1096,13 +1101,18 @@ void _tests() {
TestSemantics
(
tags:
<
SemanticsTag
>[
RenderViewport
.
excludeFromScrolling
],
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
,
SemanticsFlag
.
isHeader
,
TestSemantics
(),
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
namesRoute
,
SemanticsFlag
.
isHeader
,
],
label:
'Backward app bar'
,
textDirection:
TextDirection
.
ltr
,
),
],
label:
'Backward app bar'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
...
...
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