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
fa2d770c
Unverified
Commit
fa2d770c
authored
Sep 23, 2022
by
fzyzcjy
Committed by
GitHub
Sep 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SliverScrollingPersistentHeader not able to update stretchConfiguration (#112042)
parent
1fbd7ec1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
sliver_persistent_header.dart
...ges/flutter/lib/src/widgets/sliver_persistent_header.dart
+5
-0
sliver_persistent_header_test.dart
...s/flutter/test/widgets/sliver_persistent_header_test.dart
+63
-0
No files found.
packages/flutter/lib/src/widgets/sliver_persistent_header.dart
View file @
fa2d770c
...
...
@@ -402,6 +402,11 @@ class _SliverScrollingPersistentHeader extends _SliverPersistentHeaderRenderObje
stretchConfiguration:
delegate
.
stretchConfiguration
,
);
}
@override
void
updateRenderObject
(
BuildContext
context
,
covariant
_RenderSliverScrollingPersistentHeaderForWidgets
renderObject
)
{
renderObject
.
stretchConfiguration
=
delegate
.
stretchConfiguration
;
}
}
class
_RenderSliverScrollingPersistentHeaderForWidgets
extends
RenderSliverScrollingPersistentHeader
...
...
packages/flutter/test/widgets/sliver_persistent_header_test.dart
0 → 100644
View file @
fa2d770c
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter/src/rendering/sliver_persistent_header.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'_SliverScrollingPersistentHeader should update stretchConfiguration'
,
(
WidgetTester
tester
)
async
{
for
(
final
double
stretchTriggerOffset
in
<
double
>[
10.0
,
20.0
])
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
CustomScrollView
(
slivers:
<
Widget
>[
SliverPersistentHeader
(
delegate:
TestDelegate
(
stretchConfiguration:
OverScrollHeaderStretchConfiguration
(
stretchTriggerOffset:
stretchTriggerOffset
,
),
),
)
],
),
));
}
expect
(
tester
.
allWidgets
.
where
((
Widget
w
)
=>
w
.
runtimeType
.
toString
()
==
'_SliverScrollingPersistentHeader'
),
isNotEmpty
);
final
RenderSliverScrollingPersistentHeader
render
=
tester
.
allRenderObjects
.
whereType
<
RenderSliverScrollingPersistentHeader
>()
.
first
;
expect
(
render
.
stretchConfiguration
?.
stretchTriggerOffset
,
20
);
});
}
class
TestDelegate
extends
SliverPersistentHeaderDelegate
{
TestDelegate
({
this
.
stretchConfiguration
,
this
.
showOnScreenConfiguration
});
@override
double
get
maxExtent
=>
200.0
;
@override
double
get
minExtent
=>
200.0
;
@override
Widget
build
(
BuildContext
context
,
double
shrinkOffset
,
bool
overlapsContent
)
{
return
Container
(
height:
maxExtent
);
}
@override
bool
shouldRebuild
(
TestDelegate
oldDelegate
)
=>
false
;
@override
final
OverScrollHeaderStretchConfiguration
?
stretchConfiguration
;
@override
final
PersistentHeaderShowOnScreenConfiguration
?
showOnScreenConfiguration
;
}
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