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
39baa099
Unverified
Commit
39baa099
authored
Jul 08, 2019
by
Dan Field
Committed by
GitHub
Jul 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix semantics for floating pinned sliver app bar (#35574)
parent
cac8835d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
197 additions
and
1 deletion
+197
-1
sliver_persistent_header.dart
...s/flutter/lib/src/rendering/sliver_persistent_header.dart
+1
-1
slivers_appbar_floating_pinned_test.dart
...ter/test/widgets/slivers_appbar_floating_pinned_test.dart
+196
-0
No files found.
packages/flutter/lib/src/rendering/sliver_persistent_header.dart
View file @
39baa099
...
...
@@ -476,7 +476,7 @@ abstract class RenderSliverFloatingPersistentHeader extends RenderSliverPersiste
}
else
{
_effectiveScrollOffset
=
constraints
.
scrollOffset
;
}
final
bool
overlapsContent
=
_effectiveScrollOffset
<
constraints
.
scrollOffset
;
final
bool
overlapsContent
=
_effectiveScrollOffset
<
=
constraints
.
scrollOffset
;
excludeFromSemanticsScrolling
=
overlapsContent
;
layoutChild
(
_effectiveScrollOffset
,
maxExtent
,
overlapsContent:
overlapsContent
);
_childPosition
=
updateGeometry
();
...
...
packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart
View file @
39baa099
...
...
@@ -6,7 +6,203 @@ import 'package:flutter/rendering.dart';
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'semantics_tester.dart'
;
void
main
(
)
{
testWidgets
(
'Sliver appbars - floating and pinned - correct semantics'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Localizations
(
locale:
const
Locale
(
'en'
,
'us'
),
delegates:
const
<
LocalizationsDelegate
<
dynamic
>>[
DefaultWidgetsLocalizations
.
delegate
,
DefaultMaterialLocalizations
.
delegate
,
],
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
MediaQuery
(
data:
const
MediaQueryData
(),
child:
CustomScrollView
(
slivers:
<
Widget
>[
const
SliverAppBar
(
title:
Text
(
'Hello'
),
pinned:
true
,
floating:
true
,
expandedHeight:
200.0
,
),
SliverFixedExtentList
(
itemExtent:
100.0
,
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
_
,
int
index
)
{
return
Container
(
height:
100.0
,
color:
index
%
2
==
0
?
Colors
.
red
:
Colors
.
yellow
,
child:
Text
(
'Tile
$index
'
),
);
},
),
),
],
),
),
),
),
);
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
TestSemantics
expectedSemantics
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
.
rootChild
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
thickness:
4
,
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Hello'
,
elevation:
4
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
,
SemanticsFlag
.
namesRoute
],
textDirection:
TextDirection
.
ltr
,
),
],
),
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
scrollUp
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
scrollIndex:
0
,
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Tile 0'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 1'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 2'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 3'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 4'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
TestSemantics
(
label:
'Tile 5'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
TestSemantics
(
label:
'Tile 6'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
],
)
],
),
],
),
],
);
expect
(
semantics
,
hasSemantics
(
expectedSemantics
,
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
await
tester
.
fling
(
find
.
text
(
'Tile 2'
),
const
Offset
(
0
,
-
600
),
2000
);
await
tester
.
pumpAndSettle
();
expectedSemantics
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
.
rootChild
(
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Hello'
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHeader
,
SemanticsFlag
.
namesRoute
],
textDirection:
TextDirection
.
ltr
,
),
],
),
TestSemantics
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
scrollUp
,
SemanticsAction
.
scrollDown
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
scrollIndex:
10
,
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Tile 7'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
TestSemantics
(
label:
'Tile 8'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
TestSemantics
(
label:
'Tile 9'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
TestSemantics
(
label:
'Tile 10'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 11'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 12'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 13'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 14'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 15'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 16'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
label:
'Tile 17'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
TestSemantics
(
label:
'Tile 18'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isHidden
],
),
],
)
],
),
],
),
],
);
expect
(
semantics
,
hasSemantics
(
expectedSemantics
,
ignoreTransform:
true
,
ignoreId:
true
,
ignoreRect:
true
));
});
testWidgets
(
'Sliver appbars - floating and pinned - second app bar stacks below'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
controller
=
ScrollController
();
await
tester
.
pumpWidget
(
...
...
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