Package selection guidance compiled from public package information, community data, and project usage.
A Flutter package enabling SVG editing and manipulation across Android, iOS, Web, macOS, Windows, and Linux. It provides tools to modify vector graphics directly within Flutter applications, supporting features like shape adjustments, color changes, and layer management. Designed for cross-platform consistency, it integrates seamlessly with existing Flutter workflows. The package is ideal for apps requiring interactive SVG customization without relying on external tools.
Use cases
Interactive SVG design in mobile apps
Web-based vector graphic editors
Cross-platform image customization tools
Real-time SVG rendering and modification
Educational apps with visual content editing
Key features
Cross-platform SVG support
Real-time editing capabilities
Vector-based manipulation
Integration with Flutter's widget system
Lightweight and modular architecture
Suitable for
Developers building multimedia apps
Design-focused Flutter applications
Tools requiring SVG interactivity
Multiplatform app creators
Apps with user-generated content
Considerations
Limited to SVG format only
Requires understanding of vector graphics
Performance may vary with complex SVGs
No built-in export to raster formats
Dependent on upstream SVG parsing libraries
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
SvgPicEditor
SvgPicEditor is a Flutter widget that allows you to load and modify SVG files from various sources, such as local assets, SVG strings, or URLs. This widget also lets you modify specific SVG elements using the ElementEdit class, making it easy to change properties like color, opacity, transformations, and more. The new listenEdit and getColors features further expand the possibilities for manipulating and customizing SVGs.
This example loads an SVG file from a local asset, modifies it, and adds the onTap callback to handle tap actions, printing either the modified SVG string or no value at all.
The listenEdit feature allows you to listen for edits made to the SVG content and get updates about the modified SVG.
SvgPicEditor.asset(
'assets/example.svg',
modifications: [
ElementEdit(
querySelector: '#element1',
fillColor: Colors.red,
),
],
width: 200.0,
height: 200.0,
fit: BoxFit.contain,
listenEdit: (svgContent) {
// Whenever the SVG is edited, the updated content will be printedprint('Edited SVG content: $svgContent');
},
);
Using getColors to Retrieve Colors from the SVG
The getColors feature allows you to extract color information from an SVG. It returns an SvgColorElement containing the color and the elements associated with it in the SVG.
SvgPicEditor.asset(
'assets/example.svg',
modifications: [
ElementEdit(
querySelector: '#element1',
fillColor: Colors.red,
),
],
width: 200.0,
height: 200.0,
fit: BoxFit.contain,
getColor: (List<SvgColorElement> colors) {
// Retrieve the colors and associated elements from the SVG
colors.forEach((colorElement) {
print('Color: ${colorElement.color}');
colorElement.parts.forEach((part) { // List of associated elementsprint('Element: ${part.querySelector}');
});
});
},
);
Conclusion
With the new listenEdit, getColors, and onTap features, SvgPicEditor becomes an even more powerful and flexible tool for manipulating and customizing SVGs in Flutter. Now, in addition to modifying SVG elements, you can track real-time edits, extract valuable information about the colors and elements within the SVG, and trigger actions when the SVG is tapped.
Support the Project
If you would like to support the development of this project, you can make a contribution through PayPal. Your support helps keep the development active and adds new features.
Contribute via Inter Pix
You can make your donation by scanning the QR code below:
We truly appreciate your support!
Version 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.