Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Show placeholders for images while loading, and then fade in images#3

Merged
clocksmith merged 10 commits intoflutter:masterfrom
perclasson:fade_in_images
Mar 6, 2020
Merged

Show placeholders for images while loading, and then fade in images#3
clocksmith merged 10 commits intoflutter:masterfrom
perclasson:fade_in_images

Conversation

@perclasson
Copy link
Contributor

@perclasson perclasson commented Mar 6, 2020

Add placeholders for when images are loading. To make sure that the placeholders are the same size as the images, I added the image aspect ratio to the data of the demos. I assume in a real application such information would be saved in a database.

fade_in_final_2

I am still waiting on the final designs for the placeholders. I'll update them in case there are any updates.

Closes material-components/material-components-flutter-gallery#552

@guidezpl
Copy link
Member

guidezpl commented Mar 6, 2020

Is it possible to get around the size shift going from the placeholder to the image? Other than that, looks great!

@perclasson
Copy link
Contributor Author

perclasson commented Mar 6, 2020

Is it possible to get around the size shift going from the placeholder to the image? Other than that, looks great!

The shifting comes from the fact that the height of the placeholders are different compared to the images. We will only know the height of the images when they have been loaded. So I think it will be hard to get around the size shift going on.

The only way to get around it would be to hard code the aspect ratios into the code for every image.

@willlarche
Copy link

Looks much better! Can you do the same for the Shrine logo?

@perclasson
Copy link
Contributor Author

perclasson commented Mar 6, 2020

I updated the PR now with aspect ratios for the images to make sure that the placeholders have the exact same size as the images.

Looks much better! Can you do the same for the Shrine logo?

Sure. I added it to the logos now.

@willlarche
Copy link

Can you put in the aspect ratio for the shrine logo?

@willlarche
Copy link

Is this necessary on mobile?

@perclasson
Copy link
Contributor Author

perclasson commented Mar 6, 2020

Can you put in the aspect ratio for the shrine logo?

Good idea.

Is this necessary on mobile?

No. It should only be needed for the web. Let me update my FadeInImagePlaceholder to only have this on the web and then to use this everywhere instead of FadeImage.

@perclasson perclasson changed the title Show placefolders for images while loading, and then fade in images Show placeholders for images while loading, and then fade in images Mar 6, 2020
/// to specify a widget as a [placeholder], instead of just an [ImageProvider].
/// It also lets you override the [child] argument, in case you want to wrap
/// the image with another widget, for example an [Ink.image].
class FadeInImagePlaceholder extends StatelessWidget {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about calling this FadeInImage, since its not really a placeholder, but rather the placeholder is inside of it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is already a widget inside the Flutter framework, and this one works a bit different.

What do you think about:

  1. WebFadeInImage
  2. FadeInImageWithWidgetsPlaceholder
  3. FadeInLoadingImage

@clocksmith clocksmith merged commit 0a9bdde into flutter:master Mar 6, 2020
DanTup pushed a commit to DanTup/flutter_gallery that referenced this pull request Jun 30, 2020
…lutter#3)

* Fade in images when loading

* Fix imports

* Add imageAspectRatio for fortnightly

* Add image aspect ratio to Crane

* Add image aspect ratio to Shrine

* Fade in Rally and Fortnightly logos

* Ensure full height on mobile for shrine images

* Only fade images on the web, by modifying FadeInImagePlaceholder and using it instead of FadeInImage

* Add height and width for the Rally logo placeholder

Co-authored-by: Anthony <[email protected]>
Former-commit-id: 0a9bdde
4geru pushed a commit to 4geru/gallery that referenced this pull request Mar 18, 2022
c.f. issue flutter#3
Thanks pravindodia@ for implementing and publishing the iOS app !
shaheerCM pushed a commit to shaheerCM/gallery that referenced this pull request May 18, 2023
 estimateion make offer ui done and Api integration is in process
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Performance] Assets load with a flash

4 participants