Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inkscape gradients not rendering #97

Closed
hash404 opened this issue Jan 6, 2019 · 14 comments
Closed

Inkscape gradients not rendering #97

hash404 opened this issue Jan 6, 2019 · 14 comments

Comments

@hash404
Copy link

hash404 commented Jan 6, 2019

Gradients made in Inkscape don't always render properly with flutter_svg.

Here is what the SVG looks like with version 0.9.0+1 of flutter_svg:

Here is what it should look like (verified in web browser, Inkscape and Android Studio's SVG preview):

Inkscape version:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="356.78598"
   height="356.78598"
   viewBox="0 0 94.399622 94.399627"
   version="1.1"
   id="svg8"
   inkscape:version="0.92.2 5c3e80d, 2017-08-06"
   sodipodi:docname="gradient.svg">
  <defs
     id="defs2">
    <linearGradient
       inkscape:collect="always"
       id="linearGradient829">
      <stop
         style="stop-color:#ff02ce;stop-opacity:1"
         offset="0"
         id="stop825" />
      <stop
         style="stop-color:#ffef3a;stop-opacity:1"
         offset="1"
         id="stop827" />
    </linearGradient>
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient829"
       id="linearGradient831"
       x1="-157.99403"
       y1="122.75297"
       x2="-9.071434"
       y2="122.75297"
       gradientUnits="userSpaceOnUse" />
    <linearGradient
       inkscape:collect="always"
       xlink:href="#linearGradient829"
       id="linearGradient916"
       gradientUnits="userSpaceOnUse"
       x1="-157.99403"
       y1="122.75297"
       x2="-9.071434"
       y2="122.75297" />
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.7"
     inkscape:cx="116.40809"
     inkscape:cy="239.7796"
     inkscape:document-units="mm"
     inkscape:current-layer="g914"
     showgrid="false"
     inkscape:window-width="1440"
     inkscape:window-height="818"
     inkscape:window-x="0"
     inkscape:window-y="1"
     inkscape:window-maximized="1"
     units="px"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(2.9777116,-102.81465)">
    <g
       id="g884">
      <g
         id="g914"
         transform="matrix(0.63388377,0,0,0.63388377,97.172147,72.203346)">
        <circle
           r="74.461304"
           cy="122.75297"
           cx="-83.532738"
           id="path815"
           style="opacity:1;fill:url(#linearGradient916);fill-opacity:1;stroke:none;stroke-width:0.39687499;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
      </g>
    </g>
  </g>
</svg>

Compressed version (without any Inkscape metadata):

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 94.4 94.4">
  <defs>
    <linearGradient id="a">
      <stop offset="0" stop-color="#ff02ce"/>
      <stop offset="1" stop-color="#ffef3a"/>
    </linearGradient>
    <linearGradient id="b" x1="-157.994" x2="-9.071" y1="122.753" y2="122.753" gradientUnits="userSpaceOnUse" xlink:href="#a"/>
  </defs>
  <circle cx="-83.533" cy="122.753" r="74.461" fill="url(#b)" transform="matrix(.63388 0 0 .63388 100.15 -30.611)"/>
</svg>

Both versions don't work with the current build but can't figure out why some other SVGs with gradients work fine.

Issue related to #49 and #4

@dnfield
Copy link
Owner

dnfield commented Jan 13, 2019

It's because the gradients have references to each other, which isn't supported (yet).

See #68

@hash404
Copy link
Author

hash404 commented Jan 14, 2019

Is there a workaround for this? Even the simplest gradients made in Inkscape with two stops have this issue, so it would be hard to manually change everything for the bigger SVG files.

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

I can look at supporting this - for now, unfortunately, it'd require manually updating the SVG.

I'm not sure if Inkscape has a setting control this - I have a feeling it doesn't though.

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

FYI - your compressed version would go from:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 94.4 94.4">
  <defs>
    <linearGradient id="a">
      <stop offset="0" stop-color="#ff02ce"/>
      <stop offset="1" stop-color="#ffef3a"/>
    </linearGradient>
    <linearGradient id="b" x1="-157.994" x2="-9.071" y1="122.753" y2="122.753" gradientUnits="userSpaceOnUse" xlink:href="#a"/>
  </defs>
  <circle cx="-83.533" cy="122.753" r="74.461" fill="url(#b)" transform="matrix(.63388 0 0 .63388 100.15 -30.611)"/>
</svg>

to

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 94.4 94.4">
  <defs>
    <linearGradient id="a" x1="-157.994" x2="-9.071" y1="122.753" y2="122.753" gradientUnits="userSpaceOnUse">
      <stop offset="0" stop-color="#ff02ce"/>
      <stop offset="1" stop-color="#ffef3a"/>
    </linearGradient>
  </defs>
  <circle cx="-83.533" cy="122.753" r="74.461" fill="url(#a)" transform="matrix(.63388 0 0 .63388 100.15 -30.611)"/>
</svg>

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

I think I can whip something up for this fairly quickly. Going to close this though and use #68 to track.

Duplicate of #68

@dnfield dnfield closed this as completed Jan 14, 2019
@hash404
Copy link
Author

hash404 commented Jan 14, 2019

Thank you - I have quite a few Inkscape SVGs, so a fix in the code would be good.

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

Implemented in dd44ee7 - can you try that revision and make sure it's working for you?

@hash404
Copy link
Author

hash404 commented Jan 14, 2019

Tried it on the more complex SVGs which haven't been working.

This is the error I'm getting

flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
flutter: The following NoSuchMethodError was thrown resolving a single-frame picture stream:
flutter: The getter 'colors' was called on null.
flutter: Receiver: null
flutter: Tried calling: colors
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
flutter: #1      _Elements.linearGradient (package:flutter_svg/src/svg/parser_state.dart:272:25)
flutter: #2      SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:579:28)
flutter: <asynchronous suspension>
flutter: #3      SvgParser.parse (package:flutter_svg/parser.dart:14:58)
flutter: <asynchronous suspension>
flutter: #4      Svg.fromSvgString (package:flutter_svg/svg.dart:110:25)
flutter: <asynchronous suspension>
flutter: #5      Svg.svgPictureStringDecoder (package:flutter_svg/svg.dart:72:36)
flutter: <asynchronous suspension>
flutter: #6      SvgPicture.svgStringDecoder.<anonymous closure> (package:flutter_svg/svg.dart:444:15)
flutter: #7      AssetBundlePictureProvider._loadAsync (package:flutter_svg/src/picture_provider.dart:426:18)
flutter: <asynchronous suspension>
flutter: #8      AssetBundlePictureProvider.load (package:flutter_svg/src/picture_provider.dart:408:43)
flutter: #9      PictureProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter_svg/src/picture_provider.dart:307:57)
flutter: #10     PictureCache.putIfAbsent (package:flutter_svg/src/picture_cache.dart:67:22)
flutter: #11     PictureProvider.resolve.<anonymous closure> (package:flutter_svg/src/picture_provider.dart:307:34)
flutter: #12     SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:38:29)
flutter: #13     PictureProvider.resolve (package:flutter_svg/src/picture_provider.dart:305:17)
flutter: #14     _SvgPictureState._resolveImage (package:flutter_svg/svg.dart:542:10)
flutter: #15     _SvgPictureState.didChangeDependencies (package:flutter_svg/svg.dart:516:5)
flutter: #16     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3846:12)
flutter: #17     ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)

Will try and find a SVG I can share with the same issue to repro

@hash404
Copy link
Author

hash404 commented Jan 14, 2019

Thanks for the update.

Started off with the SVG from https://github.com/googlei18n/noto-emoji/blob/master/svg/emoji_u1f366.svg then added a gradient in Inkscape, then checked for errors in Flutter.

Gradient rendering when the gradient is made in Inkscape is still spotty, but some gradients render perfectly with your update.

Source SVG:

<svg enable-background="new 0 0 128 128" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><radialGradient id="i" cx="70.328" cy="14.204" r="17.496" gradientTransform="matrix(-.9989 -.0467 -.0467 .9989 135.95 3.3302)" gradientUnits="userSpaceOnUse"><stop stop-color="#FECC81" offset=".1692"/><stop stop-color="#FFD492" offset=".2255"/><stop stop-color="#FFE7BC" offset=".3652"/><stop stop-color="#FFF2D7" offset=".4717"/><stop stop-color="#FEF7E2" offset=".5315"/></radialGradient><path d="m46.77 27.22s-2.02-11.76 11.08-19.16c3-1.7 3.56-3.47 5.51-3.98 1.84-0.48 2.58 0.96 2.39 2.85-0.38 3.84 0.42 9.48 8.32 9.85 0.2 0.01 0.38 0.03 0.56 0.05-5.41 7.65-27.86 10.39-27.86 10.39z" fill="url(#i)"/><linearGradient id="h" x1="64" x2="64" y1="86.244" y2="124.34" gradientUnits="userSpaceOnUse"><stop stop-color="#FCB316" offset="0"/><stop stop-color="#FFCB28" offset=".0724"/><stop stop-color="#FFC826" offset=".3217"/><stop stop-color="#FEBF1E" offset=".5653"/><stop stop-color="#FCB316" offset=".7841"/></linearGradient><path d="m75.2 124.15h-22.4c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-0.65 4.44-4.42 7.74-8.87 7.74z" fill="url(#h)"/><defs><path id="g" d="m75.2 124.15h-22.4c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-0.65 4.44-4.42 7.74-8.87 7.74z"/></defs><clipPath id="f"><use xlink:href="#g"/></clipPath><g clip-path="url(#f)" fill="none" opacity=".2" stroke="#795649" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"><line x1="56.01" x2="39.03" y1="79.77" y2="98.71"/><line x1="75.64" x2="41.95" y1="77.2" y2="114.8"/><line x1="91.98" x2="49.78" y1="79.5" y2="126.6"/><line x1="108.13" x2="65.92" y1="79.5" y2="126.6"/><line x1="56.01" x2="39.03" y1="124.04" y2="105.1"/><line x1="75.64" x2="36.5" y1="126.6" y2="82.92"/><line x1="91.98" x2="49.78" y1="124.31" y2="77.2"/><line x1="108.13" x2="65.92" y1="124.31" y2="77.2"/></g><g opacity=".2"><path d="m88.27 72.43-6.17 43.68c-0.51 3.44-3.47 6.03-6.9 6.03h-22.4c-3.43 0-6.4-2.59-6.9-6.02l-6.17-43.69h48.54m2.3-2h-53.14l6.5 45.97c0.65 4.45 4.43 7.74 8.88 7.74h22.39c4.45 0 8.23-3.29 8.88-7.74l6.49-45.97z" fill="#434343"/></g><linearGradient id="e" x1="30.661" x2="97.339" y1="72.455" y2="72.455" gradientUnits="userSpaceOnUse"><stop stop-color="#FFD54E" offset=".2376"/><stop stop-color="#FEC111" offset=".7544"/></linearGradient><path d="m91.37 83.91h-54.74c-2.25 0-4.07-1.92-4.07-4.3l-1.9-18.61h66.68l-1.9 18.62c0 2.37-1.82 4.29-4.07 4.29z" fill="url(#e)"/><g opacity=".2"><path d="m95.12 63-1.67 16.41c-0.01 0.07-0.01 0.14-0.01 0.2 0 1.27-0.93 2.3-2.07 2.3h-54.74c-1.14 0-2.07-1.03-2.07-2.3 0-0.07 0-0.14-0.01-0.2l-1.67-16.41h62.24m2.22-2h-66.68l1.9 18.62c0 2.37 1.82 4.3 4.07 4.3h54.75c2.25 0 4.07-1.92 4.07-4.3l1.89-18.62z" fill="#434343"/></g><path d="m21.2 75.29" fill="none" stroke="#F36E44" stroke-miterlimit="10"/><path d="m63.2 3.13" fill="none" stroke="#F36E44" stroke-miterlimit="10"/><path d="m107.53 75.29" fill="none" stroke="#F36E44" stroke-miterlimit="10"/><path d="m65.53 3.13" fill="none" stroke="#F36E44" stroke-miterlimit="10"/><radialGradient id="d" cx="52.285" cy="18.379" r="86.93" gradientTransform="matrix(.9782 .2304 -.1657 .649 27.321 -16.454)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".4685"/><stop stop-color="#FFF2D7" offset=".5283"/><stop stop-color="#FFE7BC" offset=".6348"/><stop stop-color="#FFD492" offset=".7745"/><stop stop-color="#FECC81" offset=".8308"/></radialGradient><path d="m88.67 66.52-49.52-2.32 2.74-17.67 50.79-5.26c7.37 1.7 11.02 10.74 9.92 15.87-2.38 11.06-13.93 9.38-13.93 9.38z" fill="url(#d)"/><radialGradient id="c" cx="59.433" cy="19.915" r="45.23" gradientTransform="matrix(1.0264 -.159 .1026 .6636 -3.334 2.3631)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".4685"/><stop stop-color="#FFF2D7" offset=".5283"/><stop stop-color="#FFE7BC" offset=".6348"/><stop stop-color="#FFD492" offset=".7745"/><stop stop-color="#FECC81" offset=".8308"/></radialGradient><path d="m74.19 29.68-22.23 4.89c-8.41 1.29-10.12-9.04-6.02-14.49 1.93-2.57 5.28-4.3 8.69-4.83l11.38-1.78c4.22-0.66 8.46 1.21 10.73 4.73l0.02 0.03c3.12 5.32 4.48 9.05-2.57 11.45z" fill="url(#c)"/><radialGradient id="b" cx="59.808" cy="26.02" r="65.185" gradientTransform="matrix(1.1621 -.1662 .1359 .6641 -13.024 6.115)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".4685"/><stop stop-color="#FFF2D7" offset=".5283"/><stop stop-color="#FFE7BC" offset=".6348"/><stop stop-color="#FFD492" offset=".7745"/><stop stop-color="#FECC81" offset=".8308"/></radialGradient><path d="m82.66 46.49-37.82 6.42c-10.88 1.4-14.79-9.75-9.78-18.68 1.91-3.41 5.46-5.77 9.6-6.39l30.4-4.56c5.25-0.79 10.56 1.35 13.55 5.45l0.43 0.6c5.54 7.59 3.37 15.9-6.38 17.16z" fill="url(#b)"/><radialGradient id="a" cx="59.609" cy="29.591" r="96.963" gradientTransform="matrix(.9738 -.2102 .1289 .5249 -1.6665 26.807)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".4465"/><stop stop-color="#FFF2D7" offset=".4957"/><stop stop-color="#FFE7BC" offset=".5833"/><stop stop-color="#FFD492" offset=".6984"/><stop stop-color="#FECC81" offset=".7447"/></radialGradient><path d="m97.93 45.12-0.21-0.32c-2.74-4.18-7.85-6.41-12.97-5.67l-48.13 6.94c-4.13 0.6-7.84 2.91-9.73 6.44-3.52 6.53-0.25 13.7 5.76 16.54 2.18 1.03 2.84 0.62 4.37 2.59 1.09 1.4 1.97 2.64 3.84 2.88 2.61 0.34 3.69-0.55 4.28-2.07 0.39-0.99 0.62-2.19 0.77-2.54 1.7-3.81 5.9-1.39 5.84 1.74l-0.19 1.91c-0.1 2.13 1.45 4.12 3.68 4.4 2.51 0.33 4.71-1.45 4.82-3.8l0.28-3.98c0.09-1.86 1.53-3.4 3.47-3.71 0 0 3.19-1.16 7.47-1.45 8.02-0.54 11.21 1.09 12.35 3.19 0.96 1.75 2.69 3.09 4.84 3.44 4.12 0.67 7.79-2.22 7.97-6.05l0.01-0.12c0.16-3.47 1.15-6.83 2.56-10.04 1.37-3.12 1.2-6.86-1.08-10.32z" fill="url(#a)"/><g opacity=".2"><path d="m63.81 6.04c0.03 0.17 0.06 0.45 0.02 0.84-0.29 2.89 0.14 5.48 1.25 7.48 0.35 0.64 1.03 1.03 1.75 1.03 0.05 0 0.11 0 0.16-0.01 0.24-0.02 0.47-0.03 0.71-0.03 2.96 0 5.77 1.5 7.36 3.94 0.85 1.44 1.75 3.09 2.09 4.44 0.2 0.8 0.87 1.39 1.68 1.49 3.32 0.43 6.3 2.14 8.16 4.69l0.44 0.6c2.23 3.05 3.07 6.29 2.32 8.88-0.29 0.99 0.23 2.04 1.19 2.42 1.33 0.53 2.52 1.27 3.53 2.23 0.1 0.1 0.22 0.18 0.34 0.26 4.67 2.8 6.55 9.13 5.84 12.43-0.7 3.26-2.4 5.55-5.05 6.79-0.67 0.31-1.11 0.98-1.15 1.71-0.01 0.06-0.01 0.11-0.01 0.17l-0.01 0.12c-0.11 2.38-2.21 4.24-4.78 4.24-0.29 0-0.58-0.02-0.87-0.07-1.45-0.24-2.69-1.12-3.4-2.42-0.66-1.2-1.7-2.17-3.1-2.88-0.25-0.13-0.53-0.2-0.81-0.21l-13.9-0.65h-0.09c-0.13 0-0.25 0.01-0.38 0.04-1.93 0.37-3.32 0.81-3.8 0.98-2.76 0.52-4.84 2.83-4.96 5.51l-0.29 4.03c-0.04 1.06-1.02 1.91-2.22 1.91-0.11 0-0.22-0.01-0.34-0.02-1.13-0.15-1.97-1.15-1.94-2.28l0.18-1.85c0.01-0.05 0.01-0.1 0.01-0.15 0.03-1.5-0.58-3-1.66-4.11-1.01-1.03-2.34-1.62-3.64-1.62-1.88 0-3.47 1.14-4.36 3.13-0.13 0.29-0.22 0.63-0.35 1.1-0.12 0.47-0.28 1.05-0.46 1.52-0.25 0.63-0.43 0.87-1.39 0.87-0.23 0-0.49-0.02-0.77-0.06-0.89-0.12-1.34-0.6-2.38-1.95l-0.14-0.18c-1.33-1.71-2.31-2.14-3.65-2.6-0.43-0.15-0.87-0.3-1.44-0.57-2.67-1.26-4.7-3.52-5.59-6.21-0.58-1.76-0.92-4.5 0.73-7.58 1.16-2.15 3.2-3.84 5.76-4.77 0.5-0.18 0.91-0.56 1.14-1.05 0.22-0.49 0.24-1.05 0.05-1.55-1.25-3.24-0.79-7.3 1.21-10.88 1.49-2.66 4.22-4.57 7.48-5.25 1.01-0.21 1.69-1.15 1.58-2.18-0.25-2.29 0.39-4.78 1.68-6.49 0.4-0.53 0.91-1.04 1.51-1.53 0.23-0.19 0.42-0.43 0.55-0.7 1.75-3.66 4.77-6.71 8.95-9.08 1.72-0.97 2.75-1.95 3.59-2.74 0.78-0.71 1.14-1.04 1.67-1.18m0.21-2.04c-0.21 0-0.44 0.03-0.7 0.1-2.04 0.53-2.62 2.38-5.75 4.15-5.25 2.96-8.17 6.6-9.77 9.96-0.7 0.56-1.34 1.19-1.86 1.89-1.66 2.2-2.37 5.2-2.07 7.91-3.79 0.79-7.02 3.04-8.81 6.23-2.37 4.22-2.74 8.92-1.34 12.58-2.92 1.06-5.4 3.03-6.84 5.7-3.52 6.53-0.25 13.7 5.76 16.54 2.18 1.03 2.84 0.62 4.37 2.59 1.09 1.4 1.97 2.64 3.84 2.88 0.37 0.05 0.71 0.07 1.03 0.07 1.88 0 2.74-0.84 3.25-2.14 0.39-0.99 0.62-2.19 0.77-2.54 0.62-1.39 1.57-1.95 2.53-1.95 1.67 0 3.34 1.7 3.3 3.69l-0.19 1.91c-0.1 2.13 1.45 4.12 3.68 4.4 0.2 0.03 0.4 0.04 0.59 0.04 2.26 0 4.13-1.68 4.23-3.84l0.28-3.98c0.09-1.86 1.53-3.4 3.47-3.7 0 0 1.44-0.52 3.68-0.96l13.9 0.65c1.12 0.56 1.82 1.27 2.24 2.05 0.96 1.75 2.69 3.09 4.84 3.44 0.4 0.07 0.8 0.1 1.19 0.1 3.61 0 6.61-2.69 6.78-6.15l0.01-0.12c0-0.06 0.01-0.11 0.01-0.17 2.64-1.24 5.17-3.63 6.15-8.18 0.93-4.33-1.54-11.43-6.76-14.56-1.2-1.13-2.62-2.02-4.17-2.63 0.9-3.13 0.05-6.95-2.63-10.62l-0.43-0.6c-2.22-3.04-5.72-5-9.52-5.49-0.38-1.48-1.24-3.14-2.33-4.99l-0.02-0.03c-1.97-3.05-5.41-4.86-9.04-4.86-0.29 0-0.58 0.01-0.87 0.03-1.1-1.99-1.2-4.37-1.01-6.31 0.18-1.73-0.38-3.09-1.79-3.09z" fill="#434343"/></g></svg>

Adding radial gradient to center of ice-cream in Inkscape

Error:

flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
flutter: The following NoSuchMethodError was thrown resolving a single-frame picture stream:
flutter: The getter 'colors' was called on null.
flutter: Receiver: null
flutter: Tried calling: colors
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
flutter: #1      _Elements.radialGradient (package:flutter_svg/src/svg/parser_state.dart:194:25)
flutter: #2      SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:579:28)
flutter: <asynchronous suspension>
flutter: #3      SvgParser.parse (package:flutter_svg/parser.dart:14:58)
flutter: <asynchronous suspension>
flutter: #4      Svg.fromSvgString (package:flutter_svg/svg.dart:110:25)
flutter: <asynchronous suspension>
flutter: #5      Svg.svgPictureStringDecoder (package:flutter_svg/svg.dart:72:36)
flutter: <asynchronous suspension>
flutter: #6      SvgPicture.svgStringDecoder.<anonymous closure> (package:flutter_svg/svg.dart:444:15)
flutter: #7      AssetBundlePictureProvider._loadAsync (package:flutter_svg/src/picture_provider.dart:426:18)
flutter: <asynchronous suspension>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 128 128"><radialGradient id="a" cx="70.328" cy="14.204" r="17.496" gradientTransform="scale(-1 1) rotate(-2.677 3.296 2911.212)" gradientUnits="userSpaceOnUse"><stop stop-color="#FECC81" offset=".169"/><stop stop-color="#FFD492" offset=".226"/><stop stop-color="#FFE7BC" offset=".365"/><stop stop-color="#FFF2D7" offset=".472"/><stop stop-color="#FEF7E2" offset=".531"/></radialGradient><path d="M46.77 27.22S44.75 15.46 57.85 8.06c3-1.7 3.56-3.47 5.51-3.98 1.84-.48 2.58.96 2.39 2.85-.38 3.84.42 9.48 8.32 9.85.2.01.38.03.56.05-5.41 7.65-27.86 10.39-27.86 10.39z" fill="url(#a)"/><linearGradient id="b" x1="64" x2="64" y1="86.244" y2="124.34" gradientUnits="userSpaceOnUse"><stop stop-color="#FCB316" offset="0"/><stop stop-color="#FFCB28" offset=".072"/><stop stop-color="#FFC826" offset=".322"/><stop stop-color="#FEBF1E" offset=".565"/><stop stop-color="#FCB316" offset=".784"/></linearGradient><path d="M75.2 124.15H52.8c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-.65 4.44-4.42 7.74-8.87 7.74z" fill="url(#b)"/><defs><path id="d" d="M75.2 124.15H52.8c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-.65 4.44-4.42 7.74-8.87 7.74z"/><radialGradient xlink:href="#c" id="f" cx="36.5" cy="102.914" fx="36.5" fy="102.914" r="33.34" gradientTransform="matrix(2.94402 0 0 .47372 -70.957 34.167)" gradientUnits="userSpaceOnUse"/></defs><clipPath id="e"><use xlink:href="#d"/></clipPath><g clip-path="url(#e)" fill="none" opacity=".2" stroke="#795649" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"><path d="M56.01 79.77L39.03 98.71M75.64 77.2l-33.69 37.6M91.98 79.5l-42.2 47.1M108.13 79.5l-42.21 47.1M56.01 124.04L39.03 105.1M75.64 126.6L36.5 82.92M91.98 124.31L49.78 77.2M108.13 124.31L65.92 77.2"/></g><path d="M88.27 72.43l-6.17 43.68c-.51 3.44-3.47 6.03-6.9 6.03H52.8c-3.43 0-6.4-2.59-6.9-6.02l-6.17-43.69h48.54m2.3-2H37.43l6.5 45.97c.65 4.45 4.43 7.74 8.88 7.74H75.2c4.45 0 8.23-3.29 8.88-7.74l6.49-45.97z" fill="#434343" opacity=".2"/><linearGradient id="c" x1="30.661" x2="97.339" y1="72.455" y2="72.455" gradientUnits="userSpaceOnUse"><stop stop-color="#00020d" offset=".238"/><stop stop-color="#e977da" offset=".754"/></linearGradient><path d="M91.37 83.91H36.63c-2.25 0-4.07-1.92-4.07-4.3L30.66 61h66.68l-1.9 18.62c0 2.37-1.82 4.29-4.07 4.29z" fill="url(#f)"/><path d="M95.12 63l-1.67 16.41c-.01.07-.01.14-.01.2 0 1.27-.93 2.3-2.07 2.3H36.63c-1.14 0-2.07-1.03-2.07-2.3 0-.07 0-.14-.01-.2L32.88 63h62.24m2.22-2H30.66l1.9 18.62c0 2.37 1.82 4.3 4.07 4.3h54.75c2.25 0 4.07-1.92 4.07-4.3L97.34 61z" fill="#434343" opacity=".2"/><radialGradient id="g" cx="52.285" cy="18.379" r="86.93" gradientTransform="matrix(.9782 .2304 -.1657 .649 27.321 -16.454)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".469"/><stop stop-color="#FFF2D7" offset=".528"/><stop stop-color="#FFE7BC" offset=".635"/><stop stop-color="#FFD492" offset=".774"/><stop stop-color="#FECC81" offset=".831"/></radialGradient><path d="M88.67 66.52L39.15 64.2l2.74-17.67 50.79-5.26c7.37 1.7 11.02 10.74 9.92 15.87-2.38 11.06-13.93 9.38-13.93 9.38z" fill="url(#g)"/><radialGradient id="h" cx="59.433" cy="19.915" r="45.23" gradientTransform="matrix(1.0264 -.159 .1026 .6636 -3.334 2.363)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".469"/><stop stop-color="#FFF2D7" offset=".528"/><stop stop-color="#FFE7BC" offset=".635"/><stop stop-color="#FFD492" offset=".774"/><stop stop-color="#FECC81" offset=".831"/></radialGradient><path d="M74.19 29.68l-22.23 4.89c-8.41 1.29-10.12-9.04-6.02-14.49 1.93-2.57 5.28-4.3 8.69-4.83l11.38-1.78c4.22-.66 8.46 1.21 10.73 4.73l.02.03c3.12 5.32 4.48 9.05-2.57 11.45z" fill="url(#h)"/><radialGradient id="i" cx="59.808" cy="26.02" r="65.185" gradientTransform="matrix(1.1621 -.1662 .1359 .6641 -13.024 6.115)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".469"/><stop stop-color="#FFF2D7" offset=".528"/><stop stop-color="#FFE7BC" offset=".635"/><stop stop-color="#FFD492" offset=".774"/><stop stop-color="#FECC81" offset=".831"/></radialGradient><path d="M82.66 46.49l-37.82 6.42c-10.88 1.4-14.79-9.75-9.78-18.68 1.91-3.41 5.46-5.77 9.6-6.39l30.4-4.56c5.25-.79 10.56 1.35 13.55 5.45l.43.6c5.54 7.59 3.37 15.9-6.38 17.16z" fill="url(#i)"/><radialGradient id="j" cx="59.609" cy="29.591" r="96.963" gradientTransform="matrix(.9738 -.2102 .1289 .5249 -1.667 26.807)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".447"/><stop stop-color="#FFF2D7" offset=".496"/><stop stop-color="#FFE7BC" offset=".583"/><stop stop-color="#FFD492" offset=".698"/><stop stop-color="#FECC81" offset=".745"/></radialGradient><path d="M97.93 45.12l-.21-.32c-2.74-4.18-7.85-6.41-12.97-5.67l-48.13 6.94c-4.13.6-7.84 2.91-9.73 6.44-3.52 6.53-.25 13.7 5.76 16.54 2.18 1.03 2.84.62 4.37 2.59 1.09 1.4 1.97 2.64 3.84 2.88 2.61.34 3.69-.55 4.28-2.07.39-.99.62-2.19.77-2.54 1.7-3.81 5.9-1.39 5.84 1.74l-.19 1.91c-.1 2.13 1.45 4.12 3.68 4.4 2.51.33 4.71-1.45 4.82-3.8l.28-3.98c.09-1.86 1.53-3.4 3.47-3.71 0 0 3.19-1.16 7.47-1.45 8.02-.54 11.21 1.09 12.35 3.19a6.761 6.761 0 0 0 4.84 3.44c4.12.67 7.79-2.22 7.97-6.05l.01-.12c.16-3.47 1.15-6.83 2.56-10.04 1.37-3.12 1.2-6.86-1.08-10.32z" fill="url(#j)"/><path d="M63.81 6.04c.03.17.06.45.02.84-.29 2.89.14 5.48 1.25 7.48.35.64 1.03 1.03 1.75 1.03.05 0 .11 0 .16-.01.24-.02.47-.03.71-.03 2.96 0 5.77 1.5 7.36 3.94.85 1.44 1.75 3.09 2.09 4.44.2.8.87 1.39 1.68 1.49 3.32.43 6.3 2.14 8.16 4.69l.44.6c2.23 3.05 3.07 6.29 2.32 8.88-.29.99.23 2.04 1.19 2.42 1.33.53 2.52 1.27 3.53 2.23.1.1.22.18.34.26 4.67 2.8 6.55 9.13 5.84 12.43-.7 3.26-2.4 5.55-5.05 6.79-.67.31-1.11.98-1.15 1.71-.01.06-.01.11-.01.17l-.01.12c-.11 2.38-2.21 4.24-4.78 4.24-.29 0-.58-.02-.87-.07a4.733 4.733 0 0 1-3.4-2.42c-.66-1.2-1.7-2.17-3.1-2.88-.25-.13-.53-.2-.81-.21l-13.9-.65h-.09c-.13 0-.25.01-.38.04-1.93.37-3.32.81-3.8.98-2.76.52-4.84 2.83-4.96 5.51l-.29 4.03c-.04 1.06-1.02 1.91-2.22 1.91-.11 0-.22-.01-.34-.02a2.252 2.252 0 0 1-1.94-2.28l.18-1.85c.01-.05.01-.1.01-.15.03-1.5-.58-3-1.66-4.11-1.01-1.03-2.34-1.62-3.64-1.62-1.88 0-3.47 1.14-4.36 3.13-.13.29-.22.63-.35 1.1-.12.47-.28 1.05-.46 1.52-.25.63-.43.87-1.39.87-.23 0-.49-.02-.77-.06-.89-.12-1.34-.6-2.38-1.95l-.14-.18c-1.33-1.71-2.31-2.14-3.65-2.6-.43-.15-.87-.3-1.44-.57-2.67-1.26-4.7-3.52-5.59-6.21-.58-1.76-.92-4.5.73-7.58 1.16-2.15 3.2-3.84 5.76-4.77.5-.18.91-.56 1.14-1.05.22-.49.24-1.05.05-1.55-1.25-3.24-.79-7.3 1.21-10.88 1.49-2.66 4.22-4.57 7.48-5.25a2.001 2.001 0 0 0 1.58-2.18c-.25-2.29.39-4.78 1.68-6.49.4-.53.91-1.04 1.51-1.53.23-.19.42-.43.55-.7 1.75-3.66 4.77-6.71 8.95-9.08 1.72-.97 2.75-1.95 3.59-2.74.78-.71 1.14-1.04 1.67-1.18M64.02 4c-.21 0-.44.03-.7.1-2.04.53-2.62 2.38-5.75 4.15-5.25 2.96-8.17 6.6-9.77 9.96-.7.56-1.34 1.19-1.86 1.89-1.66 2.2-2.37 5.2-2.07 7.91-3.79.79-7.02 3.04-8.81 6.23-2.37 4.22-2.74 8.92-1.34 12.58-2.92 1.06-5.4 3.03-6.84 5.7-3.52 6.53-.25 13.7 5.76 16.54 2.18 1.03 2.84.62 4.37 2.59 1.09 1.4 1.97 2.64 3.84 2.88.37.05.71.07 1.03.07 1.88 0 2.74-.84 3.25-2.14.39-.99.62-2.19.77-2.54.62-1.39 1.57-1.95 2.53-1.95 1.67 0 3.34 1.7 3.3 3.69l-.19 1.91c-.1 2.13 1.45 4.12 3.68 4.4.2.03.4.04.59.04 2.26 0 4.13-1.68 4.23-3.84l.28-3.98c.09-1.86 1.53-3.4 3.47-3.7 0 0 1.44-.52 3.68-.96l13.9.65c1.12.56 1.82 1.27 2.24 2.05a6.761 6.761 0 0 0 4.84 3.44c.4.07.8.1 1.19.1 3.61 0 6.61-2.69 6.78-6.15l.01-.12c0-.06.01-.11.01-.17 2.64-1.24 5.17-3.63 6.15-8.18.93-4.33-1.54-11.43-6.76-14.56-1.2-1.13-2.62-2.02-4.17-2.63.9-3.13.05-6.95-2.63-10.62l-.43-.6c-2.22-3.04-5.72-5-9.52-5.49-.38-1.48-1.24-3.14-2.33-4.99l-.02-.03c-1.97-3.05-5.41-4.86-9.04-4.86-.29 0-.58.01-.87.03-1.1-1.99-1.2-4.37-1.01-6.31.18-1.73-.38-3.09-1.79-3.09z" fill="#434343" opacity=".2"/></svg>

Actual:

Does not render SVG at all in Flutter

Adding gradient to bottom of ice-cream in Inkscape

Error:

flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
flutter: The following StateError was thrown in _getDefinitionPaint:
flutter: Bad state: Failed to find definition for url(#b)
flutter:
flutter: This library only supports <defs> that are defined ahead of their references. This error can be
flutter: caused when the desired definition is defined after the element referring to it (e.g. at the end of
flutter: the file), or defined in another file.
flutter: This error is treated as non-fatal, but your SVG file will likely not render as intended
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 128 128"><radialGradient id="a" cx="70.328" cy="14.204" r="17.496" gradientTransform="scale(-1 1) rotate(-2.677 3.296 2911.212)" gradientUnits="userSpaceOnUse"><stop stop-color="#FECC81" offset=".169"/><stop stop-color="#FFD492" offset=".226"/><stop stop-color="#FFE7BC" offset=".365"/><stop stop-color="#FFF2D7" offset=".472"/><stop stop-color="#FEF7E2" offset=".531"/></radialGradient><path d="M46.77 27.22S44.75 15.46 57.85 8.06c3-1.7 3.56-3.47 5.51-3.98 1.84-.48 2.58.96 2.39 2.85-.38 3.84.42 9.48 8.32 9.85.2.01.38.03.56.05-5.41 7.65-27.86 10.39-27.86 10.39z" fill="url(#a)"/><path d="M75.2 124.15H52.8c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-.65 4.44-4.42 7.74-8.87 7.74z" fill="url(#b)"/><defs><linearGradient id="c"><stop offset="0" stop-color="#fcb316"/><stop offset="1" stop-color="#ff24e9"/></linearGradient><path id="d" d="M75.2 124.15H52.8c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-.65 4.44-4.42 7.74-8.87 7.74z"/><linearGradient xlink:href="#c" id="b" x1="37.42" y1="97.295" x2="90.57" y2="97.295" gradientUnits="userSpaceOnUse"/></defs><clipPath id="e"><use xlink:href="#d"/></clipPath><g clip-path="url(#e)" fill="none" opacity=".2" stroke="#795649" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"><path d="M56.01 79.77L39.03 98.71M75.64 77.2l-33.69 37.6M91.98 79.5l-42.2 47.1M108.13 79.5l-42.21 47.1M56.01 124.04L39.03 105.1M75.64 126.6L36.5 82.92M91.98 124.31L49.78 77.2M108.13 124.31L65.92 77.2"/></g><path d="M88.27 72.43l-6.17 43.68c-.51 3.44-3.47 6.03-6.9 6.03H52.8c-3.43 0-6.4-2.59-6.9-6.02l-6.17-43.69h48.54m2.3-2H37.43l6.5 45.97c.65 4.45 4.43 7.74 8.88 7.74H75.2c4.45 0 8.23-3.29 8.88-7.74l6.49-45.97z" fill="#434343" opacity=".2"/><linearGradient id="f" x1="30.661" x2="97.339" y1="72.455" y2="72.455" gradientUnits="userSpaceOnUse"><stop stop-color="#FFD54E" offset=".238"/><stop stop-color="#FEC111" offset=".754"/></linearGradient><path d="M91.37 83.91H36.63c-2.25 0-4.07-1.92-4.07-4.3L30.66 61h66.68l-1.9 18.62c0 2.37-1.82 4.29-4.07 4.29z" fill="url(#f)"/><path d="M95.12 63l-1.67 16.41c-.01.07-.01.14-.01.2 0 1.27-.93 2.3-2.07 2.3H36.63c-1.14 0-2.07-1.03-2.07-2.3 0-.07 0-.14-.01-.2L32.88 63h62.24m2.22-2H30.66l1.9 18.62c0 2.37 1.82 4.3 4.07 4.3h54.75c2.25 0 4.07-1.92 4.07-4.3L97.34 61z" fill="#434343" opacity=".2"/><radialGradient id="g" cx="52.285" cy="18.379" r="86.93" gradientTransform="matrix(.9782 .2304 -.1657 .649 27.321 -16.454)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".469"/><stop stop-color="#FFF2D7" offset=".528"/><stop stop-color="#FFE7BC" offset=".635"/><stop stop-color="#FFD492" offset=".774"/><stop stop-color="#FECC81" offset=".831"/></radialGradient><path d="M88.67 66.52L39.15 64.2l2.74-17.67 50.79-5.26c7.37 1.7 11.02 10.74 9.92 15.87-2.38 11.06-13.93 9.38-13.93 9.38z" fill="url(#g)"/><radialGradient id="h" cx="59.433" cy="19.915" r="45.23" gradientTransform="matrix(1.0264 -.159 .1026 .6636 -3.334 2.363)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".469"/><stop stop-color="#FFF2D7" offset=".528"/><stop stop-color="#FFE7BC" offset=".635"/><stop stop-color="#FFD492" offset=".774"/><stop stop-color="#FECC81" offset=".831"/></radialGradient><path d="M74.19 29.68l-22.23 4.89c-8.41 1.29-10.12-9.04-6.02-14.49 1.93-2.57 5.28-4.3 8.69-4.83l11.38-1.78c4.22-.66 8.46 1.21 10.73 4.73l.02.03c3.12 5.32 4.48 9.05-2.57 11.45z" fill="url(#h)"/><radialGradient id="i" cx="59.808" cy="26.02" r="65.185" gradientTransform="matrix(1.1621 -.1662 .1359 .6641 -13.024 6.115)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".469"/><stop stop-color="#FFF2D7" offset=".528"/><stop stop-color="#FFE7BC" offset=".635"/><stop stop-color="#FFD492" offset=".774"/><stop stop-color="#FECC81" offset=".831"/></radialGradient><path d="M82.66 46.49l-37.82 6.42c-10.88 1.4-14.79-9.75-9.78-18.68 1.91-3.41 5.46-5.77 9.6-6.39l30.4-4.56c5.25-.79 10.56 1.35 13.55 5.45l.43.6c5.54 7.59 3.37 15.9-6.38 17.16z" fill="url(#i)"/><radialGradient id="j" cx="59.609" cy="29.591" r="96.963" gradientTransform="matrix(.9738 -.2102 .1289 .5249 -1.667 26.807)" gradientUnits="userSpaceOnUse"><stop stop-color="#FEF7E2" offset=".447"/><stop stop-color="#FFF2D7" offset=".496"/><stop stop-color="#FFE7BC" offset=".583"/><stop stop-color="#FFD492" offset=".698"/><stop stop-color="#FECC81" offset=".745"/></radialGradient><path d="M97.93 45.12l-.21-.32c-2.74-4.18-7.85-6.41-12.97-5.67l-48.13 6.94c-4.13.6-7.84 2.91-9.73 6.44-3.52 6.53-.25 13.7 5.76 16.54 2.18 1.03 2.84.62 4.37 2.59 1.09 1.4 1.97 2.64 3.84 2.88 2.61.34 3.69-.55 4.28-2.07.39-.99.62-2.19.77-2.54 1.7-3.81 5.9-1.39 5.84 1.74l-.19 1.91c-.1 2.13 1.45 4.12 3.68 4.4 2.51.33 4.71-1.45 4.82-3.8l.28-3.98c.09-1.86 1.53-3.4 3.47-3.71 0 0 3.19-1.16 7.47-1.45 8.02-.54 11.21 1.09 12.35 3.19a6.761 6.761 0 0 0 4.84 3.44c4.12.67 7.79-2.22 7.97-6.05l.01-.12c.16-3.47 1.15-6.83 2.56-10.04 1.37-3.12 1.2-6.86-1.08-10.32z" fill="url(#j)"/><path d="M63.81 6.04c.03.17.06.45.02.84-.29 2.89.14 5.48 1.25 7.48.35.64 1.03 1.03 1.75 1.03.05 0 .11 0 .16-.01.24-.02.47-.03.71-.03 2.96 0 5.77 1.5 7.36 3.94.85 1.44 1.75 3.09 2.09 4.44.2.8.87 1.39 1.68 1.49 3.32.43 6.3 2.14 8.16 4.69l.44.6c2.23 3.05 3.07 6.29 2.32 8.88-.29.99.23 2.04 1.19 2.42 1.33.53 2.52 1.27 3.53 2.23.1.1.22.18.34.26 4.67 2.8 6.55 9.13 5.84 12.43-.7 3.26-2.4 5.55-5.05 6.79-.67.31-1.11.98-1.15 1.71-.01.06-.01.11-.01.17l-.01.12c-.11 2.38-2.21 4.24-4.78 4.24-.29 0-.58-.02-.87-.07a4.733 4.733 0 0 1-3.4-2.42c-.66-1.2-1.7-2.17-3.1-2.88-.25-.13-.53-.2-.81-.21l-13.9-.65h-.09c-.13 0-.25.01-.38.04-1.93.37-3.32.81-3.8.98-2.76.52-4.84 2.83-4.96 5.51l-.29 4.03c-.04 1.06-1.02 1.91-2.22 1.91-.11 0-.22-.01-.34-.02a2.252 2.252 0 0 1-1.94-2.28l.18-1.85c.01-.05.01-.1.01-.15.03-1.5-.58-3-1.66-4.11-1.01-1.03-2.34-1.62-3.64-1.62-1.88 0-3.47 1.14-4.36 3.13-.13.29-.22.63-.35 1.1-.12.47-.28 1.05-.46 1.52-.25.63-.43.87-1.39.87-.23 0-.49-.02-.77-.06-.89-.12-1.34-.6-2.38-1.95l-.14-.18c-1.33-1.71-2.31-2.14-3.65-2.6-.43-.15-.87-.3-1.44-.57-2.67-1.26-4.7-3.52-5.59-6.21-.58-1.76-.92-4.5.73-7.58 1.16-2.15 3.2-3.84 5.76-4.77.5-.18.91-.56 1.14-1.05.22-.49.24-1.05.05-1.55-1.25-3.24-.79-7.3 1.21-10.88 1.49-2.66 4.22-4.57 7.48-5.25a2.001 2.001 0 0 0 1.58-2.18c-.25-2.29.39-4.78 1.68-6.49.4-.53.91-1.04 1.51-1.53.23-.19.42-.43.55-.7 1.75-3.66 4.77-6.71 8.95-9.08 1.72-.97 2.75-1.95 3.59-2.74.78-.71 1.14-1.04 1.67-1.18M64.02 4c-.21 0-.44.03-.7.1-2.04.53-2.62 2.38-5.75 4.15-5.25 2.96-8.17 6.6-9.77 9.96-.7.56-1.34 1.19-1.86 1.89-1.66 2.2-2.37 5.2-2.07 7.91-3.79.79-7.02 3.04-8.81 6.23-2.37 4.22-2.74 8.92-1.34 12.58-2.92 1.06-5.4 3.03-6.84 5.7-3.52 6.53-.25 13.7 5.76 16.54 2.18 1.03 2.84.62 4.37 2.59 1.09 1.4 1.97 2.64 3.84 2.88.37.05.71.07 1.03.07 1.88 0 2.74-.84 3.25-2.14.39-.99.62-2.19.77-2.54.62-1.39 1.57-1.95 2.53-1.95 1.67 0 3.34 1.7 3.3 3.69l-.19 1.91c-.1 2.13 1.45 4.12 3.68 4.4.2.03.4.04.59.04 2.26 0 4.13-1.68 4.23-3.84l.28-3.98c.09-1.86 1.53-3.4 3.47-3.7 0 0 1.44-.52 3.68-.96l13.9.65c1.12.56 1.82 1.27 2.24 2.05a6.761 6.761 0 0 0 4.84 3.44c.4.07.8.1 1.19.1 3.61 0 6.61-2.69 6.78-6.15l.01-.12c0-.06.01-.11.01-.17 2.64-1.24 5.17-3.63 6.15-8.18.93-4.33-1.54-11.43-6.76-14.56-1.2-1.13-2.62-2.02-4.17-2.63.9-3.13.05-6.95-2.63-10.62l-.43-.6c-2.22-3.04-5.72-5-9.52-5.49-.38-1.48-1.24-3.14-2.33-4.99l-.02-.03c-1.97-3.05-5.41-4.86-9.04-4.86-.29 0-.58.01-.87.03-1.1-1.99-1.2-4.37-1.01-6.31.18-1.73-.38-3.09-1.79-3.09z" fill="#434343" opacity=".2"/></svg>

Actual:
Does not render bottom part of ice-cream

Simple radial gradient

Error

flutter: ══╡ EXCEPTION CAUGHT BY SVG ╞═══════════════════════════════════════════════════════════════════════
flutter: The following assertion was thrown resolving a single-frame picture stream:
flutter: type 'DrawableLinearGradient' is not a subtype of type 'DrawableRadialGradient'
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      DrawableDefinitionServer.getGradient (package:flutter_svg/src/vector_drawable.dart:602:5)
flutter: #1      _Elements.radialGradient (package:flutter_svg/src/svg/parser_state.dart:193:12)
flutter: #2      SvgParserState.parse (package:flutter_svg/src/svg/parser_state.dart:579:28)
flutter: <asynchronous suspension>
flutter: #3      SvgParser.parse (package:flutter_svg/parser.dart:14:58)
flutter: <asynchronous suspension>
flutter: #4      Svg.fromSvgString (package:flutter_svg/svg.dart:110:25)
flutter: <asynchronous suspension>
flutter: #5      Svg.svgPictureStringDecoder (package:flutter_svg/svg.dart:72:36)
flutter: <asynchronous suspension>
flutter: #6      SvgPicture.svgStringDecoder.<anonymous closure> (package:flutter_svg/svg.dart:444:15)
flutter: #7      AssetBundlePictureProvider._loadAsync (package:flutter_svg/src/picture_provider.dart:426:18)
flutter: <asynchronous suspension>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 128 128"><defs><linearGradient id="a"><stop offset="0" stop-color="#fcb316"/><stop offset="1" stop-color="#fcb316" stop-opacity="0"/></linearGradient><path id="b" d="M75.2 124.15H52.8c-4.45 0-8.23-3.29-8.88-7.74l-6.5-45.97h53.15l-6.5 45.97c-.65 4.44-4.42 7.74-8.87 7.74z"/><radialGradient xlink:href="#a" id="c" cx="67.797" cy="65.627" fx="67.797" fy="65.627" r="39.593" gradientTransform="matrix(1 0 0 1.10959 0 -7.192)" gradientUnits="userSpaceOnUse"/></defs><path fill="url(#c)" d="M28.203 21.695h79.186v87.864H28.203z"/></svg>

Actual:

Does not render SVG at all in Flutter

Edit: Tested using 94790ea

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

Thanks for all the examples!

I'll take a look.

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

That last one is very fixable.

The other two are bad news. I've improved the error message for those cases, but this library expects references to be defined before they're used - otherwise we have to start keeping more things around in memory.

I have an idea about how I could maybe tolerate that for this case, but for now I've improved the error message. If you move the element up towards the top of the document, Inkscape shouldn't move it again on you.

@hash404
Copy link
Author

hash404 commented Jan 14, 2019

Thanks for the radial gradient fix.

Manually ordering defs fixes the issue for the first two cases as well.

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

I'm going to publish this for now, and I'll open a new issue for tracking whether we can get some support for out-of-order definitions.

@dnfield
Copy link
Owner

dnfield commented Jan 14, 2019

published as v0.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants