Skip to content

[web]: How to use SVG image in listview #37749

Closed

Description

@Parmendrakumar

Flutter SDK v1.8.3

I am unable to find SvgPicture.network(), Its working fine on Mobile. When I use dart.svg packge then I don''t have option of SVG Images

return ListTile(title: Text(country[index].name,style: TextStyle(fontWeight: FontWeight.bold)), subtitle: Text(country[index].capital),leading: SvgPicture.network(country[index].flag, width: 20,
height: 20,), trailing: Icon(Icons.keyboard_arrow_right),

Activity

  1. mannprerak2 commented on Aug 7, 2019

    @mannprerak2
    Contributor

    Use this package -> https://pub.dev/packages/flutter_svg

    final Widget networkSvg = new SvgPicture.network(
      'https://site-that-takes-a-while.com/image.svg',
      semanticsLabel: 'A shark?!',
      placeholderBuilder: (BuildContext context) => new Container(
          padding: const EdgeInsets.all(30.0),
          child: const CircularProgressIndicator()),
    );
  2. Parmendrakumar commented on Aug 7, 2019

    @Parmendrakumar
    Author

    Its working on Flutter Mobile, But getting issue on Web? Is this work on flutter_web?

  3. mannprerak2 commented on Aug 7, 2019

    @mannprerak2
    Contributor

    It won't work on flutter web as it depends on flutter sdk
    (flutter web isn't available in the stable channel yet)
    Even then.. I wouldn't recommend making a flutter web app for production as of now, its very heavy and lags a lot..
    and then rendering SVG would contribute even more to lag.

    You should prefer to convert this SVG to png or find a PNG alternative..

  4. provokateurin commented on Aug 7, 2019

    @provokateurin

    I'm using the unforked version of flutter and it's working for me.

  5. Parmendrakumar commented on Aug 7, 2019

    @Parmendrakumar
    Author

    Any Idea about how to use SVG in flutter_web

  6. provokateurin commented on Aug 7, 2019

    @provokateurin

    You have the dart:svg library, but as long as your app is usable without the svg I think the cost of implementation for web is too high.

  7. provokateurin commented on Aug 10, 2019

    @provokateurin

    OK sorry. I checked today again and either the plugin broke in the mean time or it never worked and I remembered wrong :(

  8. provokateurin commented on Aug 12, 2019

    @provokateurin

    So after implementing my own web "plugin" for firebase messaging yesterday, I would say it should be feasible to implement a web plugin for flutter_svg, because the library for svg drawing is right in dart.
    My web firebase messaging "plugin": provokateurin/ginko@9eef819

    I'm going to do that now and update you :)

  9. provokateurin commented on Aug 12, 2019

    @provokateurin

    My idea is to provide the same interface as flutter_svg.
    On Android/iOS it simply calls the real plugin, but on web it insert something like a container and the uses js to insert the svg into the DOM tree.

    After some time I realized, that flutter web doesn't use a simple DOM tree. So inserting my own html/svg is not easy.

  10. provokateurin commented on Aug 12, 2019

    @provokateurin

    I'm able to replace a DOM node and display the svg, but the svg currently shows as big as possible.
    EDIT: I got it! The svg displays in the right size. Now I'm going to abstract the svg rendering.

  11. provokateurin commented on Aug 12, 2019

    @provokateurin

    Finally I got it!
    provokateurin/ginko@deebb54
    Ask me any question about it if you want :)

  12. Parmendrakumar commented on Aug 12, 2019

    @Parmendrakumar
    Author

    Thanks you let me try

  13. Parmendrakumar commented on Aug 14, 2019

    @Parmendrakumar
    Author

    @jld3103 Can I use .jpg or .png image in flutter web.

    I want to display any static image in flutter web app. Where I can store this image and how to use it.

  14. provokateurin commented on Aug 14, 2019

    @provokateurin

    @Parmendrakumar This has nothing to do with this issue, but you simply use it like a normal image in flutter.
    https://flutter.dev/docs/development/ui/assets-and-images

  15. BondarenkoStas commented on Sep 19, 2019

    @BondarenkoStas

    @Parmendrakumar is the issue solved as proposed in #37749 (comment)?

  16. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 19, 2019
  17. iapicca commented on Nov 11, 2019

    @iapicca

    Without additional information, we are unfortunately not sure how to resolve this issue.
    We are therefore reluctantly going to close this bug for now.
    Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!

    Could everyone who still has this problem please file a new issue with the exact descriptions what happens, logs and the output of ' flutter doctor -v' please.
    All system setups can be slightly different so its always better to open new issues and reference related issues.

  18. github-actions commented on Aug 25, 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.

  19. locked as resolved and limited conversation to collaborators on Aug 25, 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

    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions