Skip to content

Placeholder widget for images that haven't yet loaded #157

Closed

Description

@FlutterIssues

Issue by afandria
Friday Sep 04, 2015 at 23:29 GMT
Originally opened as https://github.com/flutter/engine/issues/1072


Related: #801

Since images can occasionally fail to load, it reminded me that it's worth having alternative text drawn on-screen in the missing image's place.

(Supposedly, this would also be helpful for accessibility purposes, but I'm not sure if Sky intends to support screen readers and such.)

Activity

  1. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by abarth
    Tuesday Sep 08, 2015 at 16:18 GMT


    Sky will support screen readers. We'll need to think about what we want to have happen when network images fail to load. We probably want a callback at minimum so that developers can choose to do whatever they want.

  2. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by Hixie
    Tuesday Oct 13, 2015 at 19:17 GMT


    Why would images fail to load? If they're core app assets, presumably they come with the app, and basically can't fail (unless something catastrophic is going on). If they're network images like a user's album photos or whatnot, it's not clear that the right behaviour is to display text instead.

    (This is orthogonal to accessibility concerns.)

    Do you have a concrete case in mind?

  3. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by afandria
    Tuesday Oct 13, 2015 at 19:24 GMT


    I don't know why the images are failing to load, but they are. I even specified them in my app's manifest.yaml. (I haven't updated recently, but I am on 0.0.53 and the images are still lost occasionally. IIRC, there was a fix for image decoders that went in just after that version.)

    Otherwise, my use case is the same as the web's. When an image that is pulled from the internet fails to load, I want alt text to show up in its place. That would require NetworkImage to accept the alt text as a property. It doesn't have to be the only fallback, but I think it's one of the common ones.

    An alternative would be to allow a placeholder Widget until the image loads, since that will satisfy many use cases.

  4. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by Hixie
    Tuesday Oct 13, 2015 at 19:34 GMT


    If you're getting lost images on the latest trunk, please do file a bug for that. We shouldn't be losing images.

    The Web's use case for alternative text is that sometimes people disable images, sometimes people use text-only browsers, and sometimes they write documents where they use images in place of text, and when using screen readers, the image should be in-place replaced by text. None of these apply to flutter. (Also, on the Web, we've learnt that authors are horrifically bad at writing good alternative text, so even if those were the use cases, we should find better solutions.)

    Having a placeholder widget for images that are not yet loaded is interesting. A big concern with image loading in general is that because layout depends on image dimensions, as images are loading the layout can change. This is bad for performance and results in really ugly UI reminiscent of the way the Web jumps around when pages are loading. I'd really like us to find a way to avoid that.

  5. changed the title [-]Alt Text for Images that do not load[/-] [+]Placeholder widget for images that haven't yet loaded[/+] on Dec 16, 2015
  6. added this to the milestone on Dec 16, 2015
  7. Hixie commented on Feb 23, 2016

    @Hixie
    Contributor

    This now only applies to images that are coming from the network, and thus not part of the app, since images in the assets file will be quick to load. Showing network images is probably something that the developer would wrap with loading behaviour anyway, so I'm not sure we really need to do anything explicit here.

  8. sethladd commented on Sep 20, 2016

    @sethladd
    Contributor

    Going to close because we don't have plans to take action, but please reopen if we need to.

  9. github-actions commented on Aug 17, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions