Add svg finder (#880)
* Extract flutter svg to package
* Add flutter svg test library
* Adjust readme
* Update and rename ci.yml to flutter_svg.yml
* Create flutter_svg_test.yml
---------
Co-authored-by: Dan Field <dfield@gmail.com>
[flutter_svg] feat: Expose the colorMapper property in SvgPicture (#9043)
## Description
This pull request exposes the existing colorMapper functionality in the flutter_svg package, allowing developers to customize SVG colors during parsing.
## Related Issue
- https://github.com/flutter/flutter/issues/158634
## Motivation
The colorMapper functionality was already present within the flutter_svg package but was not directly accessible through the SvgPicture constructors. By exposing this property, developers gain a powerful and flexible way to dynamically modify the colors of SVG assets based on custom logic. This can be useful for various scenarios, such as theming or branding.
## Example Usage
```dart
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
const String svgString = '''
<svg viewBox="0 0 100 100">
<rect width="50" height="50" fill="#FF0000" />
<circle cx="75" cy="75" r="25" fill="#00FF00" />
</svg>
''';
class MyColorMapper extends ColorMapper {
const MyColorMapper();
@override
Color substitute(
String? id, String elementName, String attributeName, Color color) {
if (color == const Color(0xFFFF0000)) {
return Colors.blue;
}
if (color == const Color(0xFF00FF00)) {
return Colors.yellow;
}
return color;
}
}
void main() {
runApp(MaterialApp(
home: Scaffold(
body: Center(
child: SvgPicture.string(
svgString,
width: 200,
height: 200,
colorMapper: const MyColorMapper(),
),
),
),
));
}
```