svg_pic_editor 5.1.0 copy "svg_pic_editor: ^5.1.0" to clipboard
svg_pic_editor: ^5.1.0 copied to clipboard

A dependency-free Flutter widget to load, edit and render SVGs (CSS, @keyframes and SMIL animations included) across all platforms.

Changelog #

5.1.0 #

New Features #

  • Added ElementEdit.customAttributes (List<String>?): an escape hatch for setting arbitrary raw XML attributes (e.g. 'preserveAspectRatio=xMidYMid slice', 'data-tag=hero') that aren't covered by the typed fields (fillColor, strokeColor, opacity, etc.). Each entry is a literal "attributeName=value" string; entries without an = are ignored. Applied last, so it can also override a typed field's result for the same element.

5.0.0 #

Breaking Changes #

  • flutter_svg is no longer a dependency, and svg_pic_editor.dart no longer re-exports package:flutter_svg/flutter_svg.dart. Code that imported flutter_svg types (e.g. SvgPicture, ColorFilter helpers) through this package needs to depend on flutter_svg directly if it still needs them.
  • SvgEditorCore's lower-level XmlDocument/XmlElement parameters now come from the package's own xml_lite module (exported from svg_pic_editor.dart) instead of package:xml.
  • SvgEditorCore.cleanSvg no longer strips <style> tags (only <script>) — CSS is now parsed and applied instead of discarded.

New Features #

  • Zero third-party dependencies. The package now has no runtime dependencies beyond the Flutter SDK itself: SVG parsing (lib/src/xml), network loading (lib/src/net, dart:io/dart:html), and now SVG rendering (lib/src/render) are all built in-house.
  • Built-in rendering engine (NativeSvgPicture, also exported): paints shapes directly via CustomPainter/Canvas — rect, circle, ellipse, line, polyline, polygon, full path data (including arcs), g/use/basic text, transform, and basic linearGradient/radialGradient.
  • CSS support: <style> blocks are parsed and resolved (tag/class/id selectors and compounds, proper cascade/specificity), instead of being deleted by cleanSvg.
  • Animation support: CSS @keyframes + animation shorthand, and SMIL <animate>/<animateTransform>/<animateColor>, are interpreted and played back automatically. A static SVG (no animation elements) never starts an animation ticker, so this has no cost for the common case.

Fixes #

  • getParts, getColors and listenEdit could crash with setState() or markNeedsBuild() called during build when the SVG source was a .string() (no asset/network delay) and the callback called setState on an ancestor widget — a very common pattern. These callbacks are now always deferred to right after the current frame, so calling setState from them is safe regardless of the source type.

Known limitations #

  • No <clipPath>, <mask>, <pattern>, <filter>, markers, or <animateMotion>.
  • Gradients are objectBoundingBox-only (no gradientTransform/userSpaceOnUse).
  • SMIL keyTimes/calcMode (spline/discrete) are not supported; interpolation is always linear between values.
  • <text> has no tspan sub-positioning; it renders as a single run at (x, y).

4.0.0 #

New Features #

  • Added support for borderRadius on <rect> elements in ElementEdit and SvgEditorCore.

Improvements #

  • Upgraded the package to use the new Flutter Color API (r, g, b, a and toARGB32()), resolving all static analysis deprecation warnings.
  • Upgraded environment constraints to Flutter >=3.22.0 and Dart >=3.4.0 to support modern APIs.
  • Created a robust .pubignore file to exclude build caches, local configuration files, and the docs web helper from the published package, reducing the package size significantly.
  • Cleaned up unused local variables and resolved minor warnings.

3.2.0 #

Improvements #

  • Refined the onTap functionality, now supporting both void and modified SVG string returns for better flexibility.
  • Enhanced error handling in the SvgPicEditor widget, ensuring smoother user experience when errors occur.
  • Updated the modifiedSvgString update logic to improve the reactivity and ensure faster rendering.

New Features #

  • Introduced the onTap callback function, allowing users to trigger actions when the SVG is tapped, either with the modified SVG string or without any return value.
  • Added shimmer effect loading for a smoother experience when the SVG is being processed.

Fixes #

  • Corrected a potential issue with the SVG string processing, improving the integrity of the final modified output.
  • Minor optimizations in the way SVG parts are loaded for performance improvements.

Notes #

  • This update focuses on improving the interactivity and error resilience of the SvgPicEditor, alongside optimizing the performance during SVG manipulation and loading.
  • Users are encouraged to explore the new onTap functionality to enhance user interactivity with SVG elements.

3.0.0 #

Improvements #

  • Enhanced the search system with improved query handling for better performance and flexibility.
  • Refined the listemEdit functionality, which now returns the SVG string whenever an element is edited, including support for nullable attributes.
  • Introduced the getColors function that returns a SvgColorElement, containing two attributes: one for the color and another for a list of associated SvgElement elements.
  • Renamed the ElementSvg class to ElementEdit to better reflect its new functionality.

New Features #

  • Added the listemEdit function, which provides real-time SVG string updates when elements are modified.
  • Introduced getColors function to facilitate easier extraction and modification of colors within an SVG.

Notes #

  • This update focuses on enhancing the search functionality, adding new element editing features, and improving the handling of colors in SVG elements.
  • The renaming of ElementSvg to ElementEdit reflects a more appropriate naming convention after the recent changes.
  • Users are encouraged to try the new listemEdit and getColors functionalities to streamline their workflows.

2.0.1 #

Improvements #

  • Readme updated with new features and examples.

Notes #

  • Updated the README with new features and examples.

2.0.0 #

Improvements #

  • Refined the queryAdvanced function to boost performance and readability.
  • Enhanced querying capabilities with simplified attribute handling and more efficient filtering logic.
  • Optimized XML element filtering to increase execution speed.

New Features #

  • Added an animation extension to SvgPicEditor, offering ready-to-use and customizable animations.

Notes #

  • This update focuses on improving user experience with faster and more efficient XML querying.
  • Users are encouraged to explore the new querying capabilities and the animation extension to ensure they meet their needs.

1.2.0 #

Added #

  • Support added for multiple platforms (Android, iOS, Web, Windows, macOS, Linux).
  • Adjustments to the homepage for better presentation and documentation.
  • New folder structure to facilitate code maintenance and navigation within the project.

Fixes #

  • Removed deprecated color property in SvgPicture.
  • Adjustments to dependencies to support the new platforms.
  • Updated examples in the README to reflect recent changes.

Notes #

  • This version includes significant improvements in project structure and user experience.
  • Multi-platform support allows for broader reach and better compatibility.
  • We recommend users test the functionalities on all supported platforms to ensure a consistent experience.

1.1.3 #

Fixes #

  • Removed deprecated color property in SvgPicture.

Notes #

  • Updated to remove deprecated color property in SvgPicture.

1.1.2 #

Fixes #

  • Updated README examples to reflect recent changes.

Notes #

  • Corrected typos in the README examples.

1.1.1 #

Fixes #

  • Updated README examples to reflect recent changes.

Notes #

  • Corrected typos in the README examples.

1.1.0 #

Added #

  • Initial implementation of SvgPicEditor.
  • Support for loading SVG from assets, URLs, and strings.
  • ElementSvg class for modifying SVG elements.
  • Usage examples in the README.
  • Shimmer effect loading implementation while SVG is being processed.
  • Improved SVG cleanup method for better compatibility.

Fixes #

  • Adjusted factory methods in SvgPicEditor; the first argument is now automatically the context.
  • Updated README examples to reflect recent changes.
  • Fixed color naming convention to color.
  • Code review to eliminate redundancies and improve maintainability.
  • Performance optimizations for SVG loading.
  • Improved error handling during loading.

Notes #

  • This is the 1.1.0 release and may contain bugs or limitations.
  • Enhanced user experience during SVG loading.
  • General improvements in code quality and documentation.

1.0.5 #

Fixes #

  • Performance optimizations for SVG loading.
  • Improved error handling during loading.

Notes #

  • SvgPicEditor performance has been enhanced for a more robust and efficient experience.

1.0.4 #

Fixes #

  • Code review to eliminate redundancies and improve maintainability.
  • Documentation updates to include new features and fixes.

Notes #

  • General improvements in code quality and documentation.

1.0.3 #

Added #

  • Shimmer effect loading implementation while SVG is being processed.
  • Improved SVG cleanup method for better compatibility.

Notes #

  • Enhanced user experience during the loading of SVG.
  • Refactoring of the code for better clarity.

1.0.2 #

Fixes #

  • Adjusted factory methods in SvgPicEditor; the first argument is now automatically the context.
  • Updated examples in README to reflect recent changes.
  • Corrected typos.

Notes #

  • Adjustments in the implementation of SvgPicEditor.
  • Improvements in the README documentation.

1.0.1 #

Added #

  • Corrected the color naming convention to color.

Notes #

  • Fixed a typo error.

1.0.0 #

Added #

  • Initial implementation of SvgPicEditor.
  • Support for loading SVG from assets, URLs, and strings.
  • ElementSvg class for modifying SVG elements.
  • Usage examples in the README.

Notes #

  • This is the initial version and may contain bugs or limitations.
30
likes
150
points
285
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A dependency-free Flutter widget to load, edit and render SVGs (CSS, @keyframes and SMIL animations included) across all platforms.

Repository (GitHub)
View/report issues

Topics

#svg #image #animation #widget

License

MIT (license)

Dependencies

flutter

More

Packages that depend on svg_pic_editor