flutter_svg icon indicating copy to clipboard operation
flutter_svg copied to clipboard

SvgPicture.network() don't shows the image but no errors getted

Open quetool opened this issue 6 years ago • 22 comments

Like the title says, SvgPicture.network('https://staging.apperto.co/rocketchat/avatar/mhuergo') doesn't shows up no matter where I put the widget

quetool avatar Jan 17 '19 17:01 quetool

I'm not sure why you're not getting errors, but it looks like percentages don't work for width and height parameters on a rect right now.

I get a stack dump like this:

flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
flutter: The following FormatException was thrown resolving a single-frame picture stream:
flutter: Invalid double
flutter: 100%
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      double.parse (dart:core/runtime/libdouble_patch.dart:110:28)
flutter: #1      _Paths.rect (package:flutter_svg/src/svg/parser_state.dart:506:29)
flutter: #2      SvgParserState.addShape (package:flutter_svg/src/svg/parser_state.dart:664:31)
flutter: #3      SvgParserState.startElement (package:flutter_svg/src/svg/parser_state.dart:689:12)
flutter: #4      SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:590:15)
flutter: <asynchronous suspension>
...

This should be supportable but I'm not sure it's a trivial fix. I'd be happy to take a PR for it.

dnfield avatar Jan 17 '19 18:01 dnfield

(Are you sure your testing device/emulator is connected to the network?)

dnfield avatar Jan 17 '19 18:01 dnfield

I will look into it!

(Are you sure your testing device/emulator is connected to the network?)

Yes, off course :)

quetool avatar Jan 17 '19 18:01 quetool

I got the same problem, all svg images work fine, except of those: https://btcsecure.io/img/logo.svg https://minter.stakeholder.space/local/templates/minter_pool/images/logo.svg https://minter.center/images/MC_logo_svg.svg

mintermania avatar Jun 10 '19 18:06 mintermania

I found that it will report "Invalid double" when it contains <rect width="100%" height="100%" fill="#ffffff"/>

bailyzheng avatar Jun 29 '19 01:06 bailyzheng

Can anyone able to solve it some SVG images won't able to render and throw an error like "The following FormatException was thrown resolving a single-frame picture stream".

hirenvadher954 avatar Aug 27 '19 18:08 hirenvadher954

I'm not sure why you're not getting errors, but it looks like percentages don't work for width and height parameters on a rect right now.

I get a stack dump like this:

flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
flutter: The following FormatException was thrown resolving a single-frame picture stream:
flutter: Invalid double
flutter: 100%
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      double.parse (dart:core/runtime/libdouble_patch.dart:110:28)
flutter: #1      _Paths.rect (package:flutter_svg/src/svg/parser_state.dart:506:29)
flutter: #2      SvgParserState.addShape (package:flutter_svg/src/svg/parser_state.dart:664:31)
flutter: #3      SvgParserState.startElement (package:flutter_svg/src/svg/parser_state.dart:689:12)
flutter: #4      SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:590:15)
flutter: <asynchronous suspension>
...

This should be supportable but I'm not sure it's a trivial fix. I'd be happy to take a PR for it. The same error occurred to me now tell us how to solve it if possible?

hirenvadher954 avatar Aug 27 '19 18:08 hirenvadher954

Your SVG is using a % where it's not currently supported. If you have the SVG in question we could look at it and see about making it work.

dnfield avatar Aug 27 '19 18:08 dnfield

Your SVG is using a % where it's not currently supported. If you have the SVG in question we could look at it and see about making it work.

https://restcountries.eu/data/asm.svg

hirenvadher954 avatar Aug 28 '19 12:08 hirenvadher954

Your SVG is using a % where it's not currently supported. If you have the SVG in question we could look at it and see about making it work.

https://restcountries.eu/data/asm.svg

Was there ever a fix to this?

sonikslayer avatar May 06 '20 22:05 sonikslayer

+1

zhangao0086 avatar Jun 11 '20 08:06 zhangao0086

Having the exact same problem, also with a flag: https://restcountries.eu/data/bra.svg

denizdogan avatar Sep 05 '20 20:09 denizdogan

Find in your SVG file and remove this : width="100%" height="100%" will help

thogtq avatar Jan 02 '21 14:01 thogtq

Still doesn't work: https://restcountries.eu/data/asm.svg Invalid double 1pt When using SvgPicture.network(), the SVG is online, and changing it on the fly hardly seems like the right solution (though it might be necessary, until a real solution is in place )

martin-jorgensen avatar Jun 03 '21 19:06 martin-jorgensen

I am facing the same issue, do we have any solution yet?

Prasan02 avatar Sep 01 '21 17:09 Prasan02

Faced the same issiue

osmanGuler19 avatar Oct 28 '21 22:10 osmanGuler19

same here: https://storage.opensea.io/files/2608580f4b0251e8945e6e20e4c541dc.svg

hitripod avatar Nov 10 '21 12:11 hitripod

I am facing the same issue, do we have any solution?

JagaranMaharjan avatar Dec 31 '21 11:12 JagaranMaharjan

Hello I also got this error. any update for this ?

pansitwattana avatar Feb 07 '22 10:02 pansitwattana

I have the same issue, caused by: ''stroke-width="1pt". If I remove de "pt" from the vector file, it works.

sebapastore avatar Mar 11 '22 13:03 sebapastore

Did anyone solve the problem?

I have the following error: The following XmlParserException was thrown resolving a single-frame picture stream:

ghost avatar May 05 '22 20:05 ghost

I'm still getting this at the end of 2023... Is there a fix? Getting it from one or both of these SVG's only sometimes...

Svg1:

<svg enable-background="new 0 0 1024 1024" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
    <path d="m932.19 421.19c0-232.07-188.13-420.19-420.19-420.19s-420.19 188.12-420.19 420.19c0 115.56 45.69 219.25 121.19 295.21l292.04 298.49c12.51 11.23 31.61 10.74 43.53-1.12l263.18-298.14c75.5-75.96 120.44-178.88 120.44-294.44z" fill="#000000"/>
    <path d="m617.25 639.54h6.51 17.62 8.69c8.64 0 17.68-3.31 17.68-16.51v-4.59c0-.02.06-.08.06-.11v-8.91c0-3.19 2.4-5.68 5.54-6.22 27.99-4.84 49.5-32.08 49.5-64.83v-183.85h16.02c7.47 0 13.53-6.06 13.53-13.53v-64.97c0-5.63-3.44-10.44-8.34-12.48l-21.21-8.99v-6.47c0-30.21-18.34-55.5-43.12-63.09-.32-.13-.53-.29-.95-.4-.13-.03-.31-.08-.44-.12-.64-.18-1.26-.36-1.91-.51-15.34-4.16-56.91-15.93-152.14-17.4-.09 0-.19 0-.28-.01-2.58-.04-5.18-.07-7.84-.1-1.62-.02-3.26-.06-4.88-.06-.94 0-1.89.03-2.83.03-3.43-.01-6.72-.05-10.28-.03-111.68.52-155.31 17.89-163.24 21.53-.18.09-.37.16-.55.26-.55.26-.93.45-.93.45l.07.09c-19.91 10.47-33.79 33.08-33.79 59.35v118.88h-14.61c-7.47 0-13.53 6.06-13.53 13.53v64.97c0 5.7 3.55 10.53 8.53 12.52l19.61 8.31v72.07c0 32.44 21.09 59.46 48.68 64.68 3.1.59 5.44 3.06 5.44 6.21v13.77c0 13.2 9.04 16.51 17.68 16.51h32.82c10.81 0 16.84-5.64 16.84-16.03v-13.17c0-3.53 2.86-6.39 6.39-6.39h162.46 3.97c3.53 0 6.39 2.86 6.39 6.39v13.17c0 10.42 6.03 16.05 16.84 16.05zm79.75-121.4c-15.47 15.74-82.4 18.4-89.94 6.76-7.54-11.65 5.47-29.77 22.53-41.85 18.03-12.75 53.8-31.65 67.41-20.86 10.17 8.08 9.22 46.56 0 55.95zm-273.19 6.76c-7.54 11.64-74.47 8.98-89.94-6.76-9.22-9.39-10.17-47.88 0-55.95 13.61-10.79 49.38 8.11 67.41 20.86 17.06 12.08 30.07 30.2 22.53 41.85zm151.07 51.58h-120.03c-7.19 0-13.02-5.83-13.02-13.02s5.83-13.02 13.02-13.02h120.03c7.19 0 13.02 5.83 13.02 13.02s-5.83 13.02-13.02 13.02zm-63.32-130.11c-63.94 0-124.32-15.53-172.37-44.03-6.71-3.98-10.63-11.41-10.63-19.22v-134.7c0-18.71 366-18.71 366 0v134.74c0 7.79-3.91 15.19-10.6 19.17-48.06 28.51-108.45 44.04-172.4 44.04z" fill="#fff"/>
</svg>
Svg2:
<?xml version="1.0" encoding="utf-8"?>
<svg width="1024" height="1024" enable-background="new 0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  <g transform="matrix(1, 0, 0, 1, 5.359098, -4.335575)">
    <title>Layer 1</title>
    <path id="svg_1" fill="#000000" d="m932.19,421.19c0,-232.07 -188.13,-420.19 -420.19,-420.19s-420.19,188.12 -420.19,420.19c0,115.56 45.69,219.25 121.19,295.21l292.04,298.49c12.51,11.23 31.61,10.74 43.53,-1.12l263.18,-298.14c75.5,-75.96 120.44,-178.88 120.44,-294.44z"/>
    <text transform="matrix(23.885 0 0 24.3478 -7916.98 -9373.89)" stroke="null" text-anchor="start" font-family="Arial, sans-serif" font-size="10" stroke-width="0" id="svg_3" y="406.90386" x="338.97323" fill="#FFFFFF" style="white-space: pre;">Text</text>
  </g>
</svg>

joseph-lewis avatar Sep 21 '23 03:09 joseph-lewis