Skip to content

Commit 22c6056

Browse files
[various] Replace deprecated Color.value in SVG packages (#10482)
Replaces the deprecated `Color.value` with the equivalent `toARGB()`. While this method is discouraged for many use cases, since it's for interacting with the `vector_graphics` `Color` class, which uses a 32-bit ARGB value as its fundamental representation, this appears to be the correct replacement. Part of flutter/flutter#159739 ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 8918543 commit 22c6056

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

packages/vector_graphics/test/listener_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void main() {
108108
final FlutterVectorGraphicsListener listener =
109109
FlutterVectorGraphicsListener(pictureFactory: factory);
110110
listener.onPaintObject(
111-
color: const ui.Color(0xff000000).value,
111+
color: const ui.Color(0xff000000).toARGB32(),
112112
strokeCap: null,
113113
strokeJoin: null,
114114
blendMode: BlendMode.srcIn.index,

third_party/packages/flutter_svg/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 2.2.3
22

3+
* Replaces use of deprecated Color.value.
34
* Updates minimum supported SDK version to Flutter 3.32/Dart 3.8.
45

56
## 2.2.2

third_party/packages/flutter_svg/lib/src/loaders.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SvgTheme {
4747
/// Creates a [vg.SvgTheme] from this.
4848
vg.SvgTheme toVgTheme() {
4949
return vg.SvgTheme(
50-
currentColor: vg.Color(currentColor.value),
50+
currentColor: vg.Color(currentColor.toARGB32()),
5151
fontSize: fontSize,
5252
xHeight: xHeight,
5353
);
@@ -111,7 +111,7 @@ class _DelegateVgColorMapper extends vg.ColorMapper {
111111
attributeName,
112112
Color(color.value),
113113
);
114-
return vg.Color(substituteColor.value);
114+
return vg.Color(substituteColor.toARGB32());
115115
}
116116
}
117117

third_party/packages/flutter_svg/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: flutter_svg
22
description: An SVG rendering and widget library for Flutter, which allows painting and displaying Scalable Vector Graphics 1.1 files.
33
repository: https://github.com/flutter/packages/tree/main/third_party/packages/flutter_svg
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_svg%22
5-
version: 2.2.2
5+
version: 2.2.3
66

77
environment:
88
sdk: ^3.8.0

0 commit comments

Comments
 (0)