Skip to content

Commit a1bfadf

Browse files
Update vector_graphics to match repo conventions
- Add missing licence headers. - Remove analysis options fix new warnings. - Update min SDKs. - Autoformat. - Update pubspecs to follow repo standard. - Includes removing dependency overrides for inter-package path pinning as a default state; this can be added temporarily in PRs with repo tooling. - Allow xml dependency, and relax the pinning requirement to allow an explicit, inclusive-endpoint range. - Skip tests on unsupported platforms. - Switch vector_graphics_codec from flutter_test to test. - Add repo metadata. - Add commemoration to the README. - Add AUTHORS files. - Bump versions and slightly relax version constraints to allow the new versions.
1 parent 16dfc47 commit a1bfadf

File tree

82 files changed

+1017
-857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1017
-857
lines changed

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ packages/shared_preferences/** @tarrinneal
4040
packages/standard_message_codec/** @jonahwilliams
4141
packages/two_dimensional_scrollables/** @Piinks
4242
packages/url_launcher/** @stuartmorgan
43+
packages/vector_graphics/** @jonahwilliams
44+
packages/vector_graphics_codec/** @jonahwilliams
45+
packages/vector_graphics_compiler/** @jonahwilliams
4346
packages/video_player/** @tarrinneal
4447
packages/web_benchmarks/** @yjbanov
4548
packages/webview_flutter/** @bparrishMines

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ These are the packages hosted in this repository:
7575
| [standard\_message\_codec](./packages/standard_message_codec/) | [![pub package](https://img.shields.io/pub/v/standard_message_codec.svg)](https://pub.dev/packages/standard_message_codec) | [![pub points](https://img.shields.io/pub/points/standard_message_codec)](https://pub.dev/packages/standard_message_codec/score) | [![popularity](https://img.shields.io/pub/popularity/standard_message_codec)](https://pub.dev/packages/standard_message_codec/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20standard_message_codec?label=)](https://github.com/flutter/flutter/labels/p%3A%20standard_message_codec) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20standard_message_codec?label=)](https://github.com/flutter/packages/labels/p%3A%20standard_message_codec) |
7676
| [two\_dimensional\_scrollables](./packages/two_dimensional_scrollables/) | [![pub package](https://img.shields.io/pub/v/two_dimensional_scrollables.svg)](https://pub.dev/packages/two_dimensional_scrollables) | [![pub points](https://img.shields.io/pub/points/two_dimensional_scrollables)](https://pub.dev/packages/two_dimensional_scrollables/score) | [![popularity](https://img.shields.io/pub/popularity/two_dimensional_scrollables)](https://pub.dev/packages/two_dimensional_scrollables/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20two_dimensional_scrollables?label=)](https://github.com/flutter/flutter/labels/p%3A%20two_dimensional_scrollables) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20two_dimensional_scrollables?label=)](https://github.com/flutter/packages/labels/p%3A%20two_dimensional_scrollables) |
7777
| [url\_launcher](./packages/url_launcher/) | [![pub package](https://img.shields.io/pub/v/url_launcher.svg)](https://pub.dev/packages/url_launcher) | [![pub points](https://img.shields.io/pub/points/url_launcher)](https://pub.dev/packages/url_launcher/score) | [![popularity](https://img.shields.io/pub/popularity/url_launcher)](https://pub.dev/packages/url_launcher/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20url_launcher?label=)](https://github.com/flutter/flutter/labels/p%3A%20url_launcher) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20url_launcher?label=)](https://github.com/flutter/packages/labels/p%3A%20url_launcher) |
78+
| [vector\_graphics](./packages/vector_graphics/) | [![pub package](https://img.shields.io/pub/v/vector_graphics.svg)](https://pub.dev/packages/vector_graphics) | [![pub points](https://img.shields.io/pub/points/vector_graphics)](https://pub.dev/packages/vector_graphics/score) | [![popularity](https://img.shields.io/pub/popularity/vector_graphics)](https://pub.dev/packages/vector_graphics/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20vector_graphics?label=)](https://github.com/flutter/flutter/labels/p%3A%20vector_graphics) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20vector_graphics?label=)](https://github.com/flutter/packages/labels/p%3A%20vector_graphics) |
79+
| [vector\_graphics\_codec](./packages/vector_graphics_codec/) | [![pub package](https://img.shields.io/pub/v/vector_graphics_codec.svg)](https://pub.dev/packages/vector_graphics_codec) | [![pub points](https://img.shields.io/pub/points/vector_graphics_codec)](https://pub.dev/packages/vector_graphics_codec/score) | [![popularity](https://img.shields.io/pub/popularity/vector_graphics_codec)](https://pub.dev/packages/vector_graphics_codec/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20vector_graphics_codec?label=)](https://github.com/flutter/flutter/labels/p%3A%20vector_graphics_codec) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20vector_graphics_codec?label=)](https://github.com/flutter/packages/labels/p%3A%20vector_graphics_codec) |
80+
| [vector\_graphics\_compiler](./packages/vector_graphics_compiler/) | [![pub package](https://img.shields.io/pub/v/vector_graphics_compiler.svg)](https://pub.dev/packages/vector_graphics_compiler) | [![pub points](https://img.shields.io/pub/points/vector_graphics_compiler)](https://pub.dev/packages/vector_graphics_compiler/score) | [![popularity](https://img.shields.io/pub/popularity/vector_graphics_compiler)](https://pub.dev/packages/vector_graphics_compiler/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20vector_graphics_compiler?label=)](https://github.com/flutter/flutter/labels/p%3A%20vector_graphics_compiler) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20vector_graphics_compiler?label=)](https://github.com/flutter/packages/labels/p%3A%20vector_graphics_compiler) |
7881
| [video\_player](./packages/video_player/) | [![pub package](https://img.shields.io/pub/v/video_player.svg)](https://pub.dev/packages/video_player) | [![pub points](https://img.shields.io/pub/points/video_player)](https://pub.dev/packages/video_player/score) | [![popularity](https://img.shields.io/pub/popularity/video_player)](https://pub.dev/packages/video_player/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20video_player?label=)](https://github.com/flutter/flutter/labels/p%3A%20video_player) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20video_player?label=)](https://github.com/flutter/packages/labels/p%3A%20video_player) |
7982
| [web\_benchmarks](./packages/web_benchmarks/) | [![pub package](https://img.shields.io/pub/v/web_benchmarks.svg)](https://pub.dev/packages/web_benchmarks) | [![pub points](https://img.shields.io/pub/points/web_benchmarks)](https://pub.dev/packages/web_benchmarks/score) | [![popularity](https://img.shields.io/pub/popularity/web_benchmarks)](https://pub.dev/packages/web_benchmarks/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20web_benchmarks?label=)](https://github.com/flutter/flutter/labels/p%3A%20web_benchmarks) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20web_benchmarks?label=)](https://github.com/flutter/packages/labels/p%3A%20web_benchmarks) |
8083
| [webview\_flutter](./packages/webview_flutter/) | [![pub package](https://img.shields.io/pub/v/webview_flutter.svg)](https://pub.dev/packages/webview_flutter) | [![pub points](https://img.shields.io/pub/points/webview_flutter)](https://pub.dev/packages/webview_flutter/score) | [![popularity](https://img.shields.io/pub/popularity/webview_flutter)](https://pub.dev/packages/webview_flutter/score) | [![GitHub issues by-label](https://img.shields.io/github/issues/flutter/flutter/p%3A%20webview?label=)](https://github.com/flutter/flutter/labels/p%3A%20webview) | [![GitHub pull requests by-label](https://img.shields.io/github/issues-pr/flutter/packages/p%3A%20webview_flutter?label=)](https://github.com/flutter/packages/labels/p%3A%20webview_flutter) |

packages/vector_graphics/AUTHORS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the Flutter project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.

packages/vector_graphics/CHANGELOG.md

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,105 @@
1-
# CHANGELOG
1+
## 1.1.12
22

3-
## 1.1.11+
3+
* Transfers the package source from https://github.com/dnfield/vector_graphics
4+
to https://github.com/flutter/packages.
45

5-
- Relax package:http constraint.
6+
## 1.1.11+1
7+
8+
* Relax package:http constraint.
69

710
## 1.1.11
811

9-
- Use package:http to drop dependency on dart:html.
12+
* Use package:http to drop dependency on dart:html.
1013

1114
## 1.1.10+1
1215

13-
- Add missing save before clip.
16+
* Add missing save before clip.
1417

1518
## 1.1.10
1619

17-
- Add missing clip before saveLayer.
20+
* Add missing clip before saveLayer.
1821

1922
## 1.1.9+2
2023

21-
- Fix case sensitivity on scientific notation parsing.
24+
* Fix case sensitivity on scientific notation parsing.
2225

2326
## 1.1.9+1
2427

25-
- Fix publication error that did not have latest source code.
28+
* Fix publication error that did not have latest source code.
2629

2730
## 1.1.9
2831

29-
- Fix handling of invalid XML `@id` attributes.
30-
- Fix handling of self-referential `<use/>` elements.
31-
- Add `--out-dir` option to compiler.
32-
- Tweak warning message for unhandled eleemnts.
32+
* Fix handling of invalid XML `@id` attributes.
33+
* Fix handling of self-referential `<use/>` elements.
34+
* Add `--out-dir` option to compiler.
35+
* Tweak warning message for unhandled eleemnts.
3336

3437
## 1.1.8
3538

36-
- Fix bugs in transform parsing.
39+
* Fix bugs in transform parsing.
3740

3841
## 1.1.7
3942

40-
- Support for matching the ambient text direction.
43+
* Support for matching the ambient text direction.
4144

4245
## 1.1.6
4346

44-
- Fix bug in text position computation when transforms are involved.
47+
* Fix bug in text position computation when transforms are involved.
4548

4649
## 1.1.5+1
4750

48-
- Remove/update some invalid assertions related to image formats.
51+
* Remove/update some invalid assertions related to image formats.
4952

5053
## 1.1.5
5154

52-
- Support for decoding control points as IEEE 754-2008 half precision
55+
* Support for decoding control points as IEEE 754-2008 half precision
5356
floating point values.
54-
- Migrate the test to extend DefaultWidgetsLocalizations.
55-
- Added an error builder property to provide a fallback widget on exceptions.
57+
* Migrate the test to extend DefaultWidgetsLocalizations.
58+
* Added an error builder property to provide a fallback widget on exceptions.
5659

5760
## 1.1.4
5861

59-
- Support more image formats and malformed MIME types.
60-
- Fix inheritence for `fill-rule`s.
62+
* Support more image formats and malformed MIME types.
63+
* Fix inheritence for `fill-rule`s.
6164

6265
## 1.1.3
6366

64-
- Further improvements to whitespace handling for text.
67+
* Further improvements to whitespace handling for text.
6568

6669
## 1.1.2
6770

68-
- Fix handling and inheritence of `none`.
71+
* Fix handling and inheritence of `none`.
6972

7073
## 1.1.1
7174

72-
- Multiple text positioning bug fixes.
73-
- Preserve stroke-opacity when specified.
75+
* Multiple text positioning bug fixes.
76+
* Preserve stroke-opacity when specified.
7477

7578
## 1.1.0
7679

77-
- Fix a number of inheritence related bugs:
78-
- Inheritence of properties specified on the root element now work.
79-
- Opacity inheritence is more correct now.
80-
- Inheritence of `use` elements is more correctly handled.
81-
- Make `currentColor` non-null on SVG theme, and fix how it is applied.
82-
- Remove the opacity peephole optimizer, which was incorrectly applying
80+
* Fix a number of inheritence related bugs:
81+
* Inheritence of properties specified on the root element now work.
82+
* Opacity inheritence is more correct now.
83+
* Inheritence of `use` elements is more correctly handled.
84+
* Make `currentColor` non-null on SVG theme, and fix how it is applied.
85+
* Remove the opacity peephole optimizer, which was incorrectly applying
8386
optimizations in a few cases. A future release may add this back.
84-
- Add clipBehavior to the widget.
85-
- Fix patterns when multiple patterns are specified and applied within the
87+
* Add clipBehavior to the widget.
88+
* Fix patterns when multiple patterns are specified and applied within the
8689
graphic.
8790

8891
## 1.0.1+1
8992

90-
- Fix bug in asset loading from packages.
93+
* Fix bug in asset loading from packages.
9194

9295
## 1.0.1
9396

94-
- Fix handling of fill colors on use/group elements.
97+
* Fix handling of fill colors on use/group elements.
9598

9699
## 1.0.0+1
97100

98-
- Fix issue in pattern decoding.
99-
- Fix issue in matrix parsing for some combinations of matrices.
101+
* Fix issue in pattern decoding.
102+
* Fix issue in matrix parsing for some combinations of matrices.
100103

101104
## 1.0.0
102105

@@ -108,19 +111,21 @@
108111

109112
## 0.0.3
110113

111-
* Improvements to CLI utilities.
112-
* Dispose unused objects.
113-
* Improved support for HTML backend.
114-
* Less aggressive rasterization strategy for flutter_svg compatibility.
114+
* Improvements to CLI utilities.
115+
* Dispose unused objects.
116+
* Improved support for HTML backend.
117+
* Less aggressive rasterization strategy for flutter_svg compatibility.
115118

116119
## 0.0.2
117-
* Support for drawing images
120+
121+
* Support for drawing images
118122

119123
## 0.0.1
120-
* Added `VectorGraphic` which consumes encoded vector graphics assets using
121-
a `BytesLoader`.
122-
* Added `AssetBytesLoader` and `NetworkBytesLoader` as example loader
123-
implementations.
124+
125+
* Added `VectorGraphic` which consumes encoded vector graphics assets using
126+
a `BytesLoader`.
127+
* Added `AssetBytesLoader` and `NetworkBytesLoader` as example loader
128+
implementations.
124129

125130
## 0.0.0
126131

packages/vector_graphics/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@
33
A vector graphics rendering runtime for Flutter. This package is intended for
44
use with output from the `package:vector_graphics_compiler` and encoded via
55
a tightly coupled version of `package:vector_graphics_codec`.
6+
7+
## Commemoration
8+
9+
This package was originally authored by
10+
[Dan Field](https://github.com/dnfield) and has been forked here
11+
from [dnfield/vector_graphics](https://github.com/dnfield/vector_graphics).
12+
Dan was a member of the Flutter team at Google from 2018 until his death
13+
in 2024. Dan’s impact and contributions to Flutter were immeasurable, and we
14+
honor his memory by continuing to publish and maintain this package.

packages/vector_graphics/analysis_options.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/vector_graphics/example/analysis_options.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/vector_graphics/example/lib/main.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44

55
import 'dart:developer';
66

7-
import 'package:http/http.dart' as http;
87
import 'package:flutter/foundation.dart';
98
import 'package:flutter/material.dart';
9+
import 'package:http/http.dart' as http;
1010
import 'package:vector_graphics/vector_graphics.dart';
1111
import 'package:vector_graphics_compiler/vector_graphics_compiler.dart';
1212

1313
void main() {
1414
runApp(const MyApp());
1515
}
1616

17+
/// The main example app widget.
1718
class MyApp extends StatelessWidget {
19+
/// Creates a new [MyApp].
1820
const MyApp({super.key});
1921

2022
@override
@@ -37,14 +39,17 @@ class MyApp extends StatelessWidget {
3739
}
3840
}
3941

42+
/// A [BytesLoader] that converts a network URL into encoded SVG data.
4043
class NetworkSvgLoader extends BytesLoader {
44+
/// Creates a [NetworkSvgLoader] that loads an SVG from [url].
4145
const NetworkSvgLoader(this.url);
4246

47+
/// The SVG URL.
4348
final String url;
4449

4550
@override
4651
Future<ByteData> loadBytes(BuildContext? context) async {
47-
return await compute((String svgUrl) async {
52+
return compute((String svgUrl) async {
4853
final http.Response request = await http.get(Uri.parse(svgUrl));
4954
final TimelineTask task = TimelineTask()..start('encodeSvg');
5055
final Uint8List compiledBytes = encodeSvg(

packages/vector_graphics/example/lib/svg_string.dart

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ void main() {
3737
runApp(const MyApp());
3838
}
3939

40+
/// The main example app widget.
4041
class MyApp extends StatefulWidget {
42+
/// Creates a new [MyApp].
4143
const MyApp({super.key});
4244

4345
@override
@@ -115,13 +117,14 @@ class _MyAppState extends State<MyApp> {
115117
child: ListView(
116118
children: <Widget>[
117119
const SizedBox(height: 10),
118-
_data == null
119-
? const Placeholder()
120-
: VectorGraphic(
121-
loader: RawBytesLoader(
122-
_data!,
123-
),
124-
),
120+
if (_data == null)
121+
const Placeholder()
122+
else
123+
VectorGraphic(
124+
loader: RawBytesLoader(
125+
_data!,
126+
),
127+
),
125128
const Divider(),
126129
Text('SVG size (compressed): $_svgLength ($_gzSvgLength). '
127130
'VG size (compressed): $_vgLength ($_gzVgLength)'),
@@ -143,9 +146,12 @@ class _MyAppState extends State<MyApp> {
143146
}
144147
}
145148

149+
/// A [BytesLoader] that passes on existing bytes.
146150
class RawBytesLoader extends BytesLoader {
151+
/// Creates a [RawBytesLoader] that returns [data] directly.
147152
const RawBytesLoader(this.data);
148153

154+
/// The data to return.
149155
final ByteData data;
150156

151157
@override

packages/vector_graphics/example/pubspec.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,30 @@ description: An example of the vector_graphics package
33
publish_to: 'none'
44

55
environment:
6-
sdk: ">=2.17.0 <3.0.0"
6+
sdk: ^3.4.0
77

88
dependencies:
9-
http: any
109
flutter:
1110
sdk: flutter
11+
http: ">=0.13.0 <2.0.0"
1212
vector_graphics: any
1313
vector_graphics_compiler: any
1414

1515

1616
dev_dependencies:
1717
flutter_test:
1818
sdk: flutter
19-
flutter_lints: ^1.0.0
20-
2119

2220
flutter:
2321
uses-material-design: true
2422

2523
dependency_overrides:
26-
vector_graphics_compiler:
27-
path: ../../vector_graphics_compiler
28-
vector_graphics_codec:
29-
path: ../../vector_graphics_codec
3024
vector_graphics:
3125
path: ../
26+
vector_graphics_codec:
27+
path: ../../vector_graphics_codec
28+
vector_graphics_compiler:
29+
path: ../../vector_graphics_compiler
3230

3331
platforms:
3432
android:

0 commit comments

Comments
 (0)