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
165cb0b9
Unverified
Commit
165cb0b9
authored
Sep 08, 2022
by
Viren Khatri
Committed by
GitHub
Sep 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes FadeInImage for an edge case (#111035)
parent
16a07716
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
fade_in_image.dart
packages/flutter/lib/src/widgets/fade_in_image.dart
+2
-1
fade_in_image_test.dart
packages/flutter/test/widgets/fade_in_image_test.dart
+38
-0
No files found.
packages/flutter/lib/src/widgets/fade_in_image.dart
View file @
165cb0b9
...
...
@@ -562,7 +562,8 @@ class _AnimatedFadeOutFadeInState extends ImplicitlyAnimatedWidgetState<_Animate
@override
Widget
build
(
BuildContext
context
)
{
if
(
widget
.
wasSynchronouslyLoaded
||
_placeholderOpacityAnimation
!.
isCompleted
)
{
if
(
widget
.
wasSynchronouslyLoaded
||
(
_placeholderOpacityAnimation
?.
isCompleted
??
true
))
{
return
widget
.
target
;
}
...
...
packages/flutter/test/widgets/fade_in_image_test.dart
View file @
165cb0b9
...
...
@@ -199,6 +199,44 @@ Future<void> main() async {
expect
(
parts
.
target
.
opacity
,
1
);
});
// Regression test for https://github.com/flutter/flutter/issues/111011
testWidgets
(
"FadeInImage's image obeys gapless playback when first image is cached but second isn't"
,
(
WidgetTester
tester
)
async
{
final
TestImageProvider
placeholderProvider
=
TestImageProvider
(
placeholderImage
);
final
TestImageProvider
imageProvider
=
TestImageProvider
(
targetImage
);
final
TestImageProvider
secondImageProvider
=
TestImageProvider
(
replacementImage
);
// Pre-cache the initial image.
imageProvider
.
resolve
(
ImageConfiguration
.
empty
);
imageProvider
.
complete
();
placeholderProvider
.
complete
();
await
tester
.
pumpWidget
(
FadeInImage
(
placeholder:
placeholderProvider
,
image:
imageProvider
,
));
await
tester
.
pumpAndSettle
();
await
tester
.
pumpWidget
(
FadeInImage
(
placeholder:
placeholderProvider
,
image:
secondImageProvider
,
));
FadeInImageParts
parts
=
findFadeInImage
(
tester
);
// Continually shows previously loaded image until the new image provider provides the image.
expect
(
parts
.
placeholder
,
isNull
);
expect
(
parts
.
target
.
rawImage
.
image
!.
isCloneOf
(
targetImage
),
isTrue
);
expect
(
parts
.
target
.
opacity
,
1
);
// Now, provide the image.
secondImageProvider
.
complete
();
await
tester
.
pump
();
parts
=
findFadeInImage
(
tester
);
expect
(
parts
.
target
.
rawImage
.
image
!.
isCloneOf
(
replacementImage
),
isTrue
);
expect
(
parts
.
target
.
opacity
,
1
);
});
testWidgets
(
"FadeInImage's placeholder obeys gapless playback"
,
(
WidgetTester
tester
)
async
{
final
TestImageProvider
placeholderProvider
=
TestImageProvider
(
placeholderImage
);
final
TestImageProvider
secondPlaceholderProvider
=
TestImageProvider
(
replacementImage
);
...
...
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