文件最后提交记录最后更新时间
[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(), ), ), ), )); } ```1 年前
[flutter_svg] Initial import Imports https://github.com/dnfield/flutter_svg into this repository, with history, and updates it to follow repository conventions: - Updates min SDKs. - Removes analysis options and fixes resulting warnings. - Autoformats. - Updates pubspecs to follow repo standard. - Updates repo tooling to allow the flutter_svg_test non-dev dependency on flutter_test. - Adds repo metadata. - Adds METADATA files. - Adds commemoration to README. - Updates example app Android build files to current standards. - Bumps versions and slightly relax version constraints for vector_graphics* to allow the new versions. - Moves gitignore of golden test diffs into the package. 1 年前
[flutter_svg] Initial import Imports https://github.com/dnfield/flutter_svg into this repository, with history, and updates it to follow repository conventions: - Updates min SDKs. - Removes analysis options and fixes resulting warnings. - Autoformats. - Updates pubspecs to follow repo standard. - Updates repo tooling to allow the flutter_svg_test non-dev dependency on flutter_test. - Adds repo metadata. - Adds METADATA files. - Adds commemoration to README. - Updates example app Android build files to current standards. - Bumps versions and slightly relax version constraints for vector_graphics* to allow the new versions. - Moves gitignore of golden test diffs into the package. 1 年前
[flutter_svg] Initial import Imports https://github.com/dnfield/flutter_svg into this repository, with history, and updates it to follow repository conventions: - Updates min SDKs. - Removes analysis options and fixes resulting warnings. - Autoformats. - Updates pubspecs to follow repo standard. - Updates repo tooling to allow the flutter_svg_test non-dev dependency on flutter_test. - Adds repo metadata. - Adds METADATA files. - Adds commemoration to README. - Updates example app Android build files to current standards. - Bumps versions and slightly relax version constraints for vector_graphics* to allow the new versions. - Moves gitignore of golden test diffs into the package. 1 年前
[flutter_svg] Fix SvgNetworkLoader not closing internal http client (#8126) closes https://github.com/flutter/flutter/issues/158928 Ensures that if a Client is created in prepareMessage it is closed after getting the resource.1 年前
[flutter_svg] Initial import Imports https://github.com/dnfield/flutter_svg into this repository, with history, and updates it to follow repository conventions: - Updates min SDKs. - Removes analysis options and fixes resulting warnings. - Autoformats. - Updates pubspecs to follow repo standard. - Updates repo tooling to allow the flutter_svg_test non-dev dependency on flutter_test. - Adds repo metadata. - Adds METADATA files. - Adds commemoration to README. - Updates example app Android build files to current standards. - Bumps versions and slightly relax version constraints for vector_graphics* to allow the new versions. - Moves gitignore of golden test diffs into the package. 1 年前
[flutter_svg] feat: Expose the renderStrategy property in SvgPicture (#9373) This PR exposes the renderStrategy property from the vector_graphics package to address the performance issue discussed in [#166184](https://github.com/flutter/flutter/issues/166184). By default, SVG widgets are rendered using the picture strategy, which records a list of drawing commands and replays them each frame. While this offers greater flexibility (e.g., for scaling), it can result in significant raster time when many SVGs are present in the widget tree. As demonstrated in [#166184](https://github.com/flutter/flutter/issues/166184), using the default strategy can lead to frame drops due to high raster time: <img width="820" alt="image" src="https://github.com/user-attachments/assets/dfc58d50-c8b2-477e-9a75-fe0eb742f9c7" /> Switching to the raster strategy renders the SVGs into images ahead of time, reducing the raster workload: <img width="894" alt="image" src="https://github.com/user-attachments/assets/2fd8ddbf-3693-4797-be99-8b0919ef1703" /> Exposing this property allows developers to choose between flexibility and performance based on their app’s needs. Fixes https://github.com/flutter/flutter/issues/166184 ## Pre-Review Checklist11 个月前