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
a745fc58
Unverified
Commit
a745fc58
authored
Apr 14, 2021
by
Kate Lovett
Committed by
GitHub
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix FlexibleSpaceBar Opacity when AppBar.toolbarHeight > ktoolbarHeight (#80453)
parent
1912f7de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
flexible_space_bar.dart
packages/flutter/lib/src/material/flexible_space_bar.dart
+5
-1
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+33
-1
No files found.
packages/flutter/lib/src/material/flexible_space_bar.dart
View file @
a745fc58
...
...
@@ -305,7 +305,11 @@ class _FlexibleSpaceBarState extends State<FlexibleSpaceBar> {
final
double
fadeStart
=
math
.
max
(
0.0
,
1.0
-
kToolbarHeight
/
deltaExtent
);
const
double
fadeEnd
=
1.0
;
assert
(
fadeStart
<=
fadeEnd
);
final
double
opacity
=
1.0
-
Interval
(
fadeStart
,
fadeEnd
).
transform
(
t
);
// If the min and max extent are the same, the app bar cannot collapse
// and the content should be visible, so opacity = 1.
final
double
opacity
=
settings
.
maxExtent
==
settings
.
minExtent
?
1.0
:
1.0
-
Interval
(
fadeStart
,
fadeEnd
).
transform
(
t
);
double
height
=
settings
.
maxExtent
;
// StretchMode.zoomBackground
...
...
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
a745fc58
...
...
@@ -121,7 +121,39 @@ void main() {
expect
(
clipRect
.
size
.
height
,
minExtent
);
});
testWidgets
(
'Collpased FlexibleSpaceBar has correct semantics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'FlexibleSpaceBar.background is visible when using height other than kToolbarHeight'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/80451
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
appBar:
AppBar
(
toolbarHeight:
300
,
flexibleSpace:
const
FlexibleSpaceBar
(
title:
Text
(
'Title'
),
background:
Text
(
'Background'
),
collapseMode:
CollapseMode
.
pin
,
),
),
body:
CustomScrollView
(
primary:
true
,
slivers:
<
Widget
>[
SliverToBoxAdapter
(
child:
Container
(
height:
1200.0
,
color:
Colors
.
orange
[
400
],
),
),
],
),
),
),
);
final
Opacity
backgroundOpacity
=
tester
.
firstWidget
(
find
.
byType
(
Opacity
));
expect
(
backgroundOpacity
.
opacity
,
1.0
);
});
testWidgets
(
'Collapsed FlexibleSpaceBar has correct semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
const
double
expandedHeight
=
200
;
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