Steps to reproduce
Try to render an svg containing one of the valid color tags:
rgba(31 120 50 / 40%);
rgb(31 120 50 / 40%);
rgba(31% 12% 50% / 0.2);
rgba(31% 12% 50%);
rgb(31% 12% 50%);
rgb(31%, 12%, 50%);
...
Note: above rgb colors are all correct, as defined here:
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/rgb
Note 2: rgba is just an alias for rgb, which means that rgba with no opacity defined is still valid. Similarly, rgb can define opacity.
Expected results
The above colors can be parsed successfully.
Actual results
Error trying to parse them (see logs below). Current implementation only allows for the following:
- rgb with three comma delimited values (rgb values can be int or percentage)
- rgba with four comma delimited values (rgb values can be int or percentage, opacity value can be double or percentage)
Support is needed for:
- opacity for rgb tag
- space-delimited values (rather than supporting only comma-delimited)
- opacity being delimited by the
/ character
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
E/flutter (13027): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: FormatException: Invalid double
E/flutter (13027): 100% 0% 0
E/flutter (13027): #0 double.parse (dart:core-patch/double_patch.dart:111)
E/flutter (13027): #1 parseDouble (package:vector_graphics_compiler/src/svg/numbers.dart:33)
E/flutter (13027): #2 SvgParser._parseColor.<anonymous closure> (package:vector_graphics_compiler/src/svg/parser.dart:1489)
E/flutter (13027): #3 MappedIterable.elementAt (dart:_internal/iterable.dart:402)
E/flutter (13027): #4 ListIterator.moveNext (dart:_internal/iterable.dart:371)
E/flutter (13027): #5 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:194)
E/flutter (13027): #6 new _GrowableList.of (dart:core-patch/growable_array.dart:154)
E/flutter (13027): #7 new List.of (dart:core-patch/array_patch.dart:39)
E/flutter (13027): #8 ListIterable.toList (dart:_internal/iterable.dart:224)
E/flutter (13027): #9 SvgParser._parseColor (package:vector_graphics_compiler/src/svg/parser.dart:1493)
E/flutter (13027): #10 SvgParser.parseColor (package:vector_graphics_compiler/src/svg/parser.dart:1344)
E/flutter (13027): #11 _Elements.parseStops (package:vector_graphics_compiler/src/svg/parser.dart:271)
E/flutter (13027): #12 _Elements.linearGradient (package:vector_graphics_compiler/src/svg/parser.dart:351)
E/flutter (13027): #13 SvgParser._parseTree (package:vector_graphics_compiler/src/svg/parser.dart:797)
E/flutter (13027): #14 SvgParser.parse (package:vector_graphics_compiler/src/svg/parser.dart:817)
E/flutter (13027): #15 parse (package:vector_graphics_compiler/vector_graphics_compiler.dart:78)
E/flutter (13027): #16 encodeSvg (package:vector_graphics_compiler/vector_graphics_compiler.dart:147)
E/flutter (13027): #17 SvgLoader._load.<anonymous closure>.<anonymous closure> (package:flutter_svg/src/loaders.dart:162)
E/flutter (13027): #18 compute.<anonymous closure> (package:flutter/src/foundation/_isolates_io.dart:23)
E/flutter (13027): #19 _RemoteRunner._run (dart:isolate:1116)
E/flutter (13027): #20 _RemoteRunner._remoteExecute (dart:isolate:1110)
E/flutter (13027): #21 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:317)
E/flutter (13027): #22 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193)
E/flutter (13027):
Flutter Doctor output
Doctor output
Steps to reproduce
Try to render an svg containing one of the valid color tags:
Note: above rgb colors are all correct, as defined here:
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/rgb
Note 2:
rgbais just an alias forrgb, which means thatrgbawith no opacity defined is still valid. Similarly, rgb can define opacity.Expected results
The above colors can be parsed successfully.
Actual results
Error trying to parse them (see logs below). Current implementation only allows for the following:
Support is needed for:
/characterCode sample
Code sample
[Paste your code here]Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
Flutter Doctor output
Doctor output
[Paste your output here]