Visitar URL original
Super parameters are neat (#73) · flutter/packages@f8f6d75 · GitHub
Skip to content

Commit f8f6d75

Browse files
authored
Super parameters are neat (#73)
1 parent a46477d commit f8f6d75

6 files changed

Lines changed: 16 additions & 21 deletions

File tree

‎packages/vector_graphics/example/lib/main.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void main() {
1616
}
1717

1818
class MyApp extends StatelessWidget {
19-
const MyApp({Key? key}) : super(key: key);
19+
const MyApp({super.key});
2020

2121
@override
2222
Widget build(BuildContext context) {

‎packages/vector_graphics/example/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: An example of the vector_graphics package
33
publish_to: 'none'
44

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

88
dependencies:
99
http: any

‎packages/vector_graphics/lib/vector_graphics.dart‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class VectorGraphic extends StatefulWidget {
2929
///
3030
/// See [VectorGraphic].
3131
const VectorGraphic({
32-
Key? key,
32+
super.key,
3333
required this.loader,
3434
this.width,
3535
this.height,
@@ -40,9 +40,8 @@ class VectorGraphic extends StatefulWidget {
4040
this.placeholderBuilder,
4141
this.colorFilter,
4242
this.opacity = 1.0,
43-
}) : assert(opacity >= 0.0 && opacity <= 1.0,
44-
'opacity must be a value between 0.0 and 1.0'),
45-
super(key: key);
43+
}) : assert(opacity >= 0.0 && opacity <= 1.0,
44+
'opacity must be a value between 0.0 and 1.0');
4645

4746
/// A delegate for fetching the raw bytes of the vector graphic.
4847
///
@@ -315,11 +314,10 @@ class NetworkBytesLoader extends BytesLoader {
315314

316315
class _RawVectorGraphicWidget extends SingleChildRenderObjectWidget {
317316
const _RawVectorGraphicWidget({
318-
Key? key,
319317
required this.pictureInfo,
320318
required this.colorFilter,
321319
required this.opacity,
322-
}) : super(key: key);
320+
});
323321

324322
final PictureInfo pictureInfo;
325323
final ColorFilter? colorFilter;

‎packages/vector_graphics/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 0.0.1
44
homepage: https://github.com/dnfield/vector_graphics
55

66
environment:
7-
sdk: ">=2.12.0 <3.0.0"
7+
sdk: ">=2.17.0 <3.0.0"
88
flutter: ">=1.17.0"
99

1010
dependencies:

‎packages/vector_graphics_compiler/lib/src/svg/node.dart‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,10 @@ class ViewportNode extends ParentNode {
8585
required this.width,
8686
required this.height,
8787
required AffineMatrix transform,
88-
List<Node>? children,
88+
super.children,
8989
}) : super(
9090
attributes,
9191
precalculatedTransform: transform,
92-
children: children,
9392
);
9493

9594
/// The width of the viewport in pixels.
@@ -114,12 +113,11 @@ typedef NodeCallback = void Function(Node child);
114113
class ParentNode extends AttributedNode {
115114
/// Creates a new [ParentNode].
116115
ParentNode(
117-
SvgAttributes attributes, {
116+
super.attributes, {
118117
AffineMatrix? precalculatedTransform,
119118
List<Node>? children,
120119
}) : transform = precalculatedTransform ?? attributes.transform,
121-
_children = children ?? <Node>[],
122-
super(attributes);
120+
_children = children ?? <Node>[];
123121

124122
/// The transform to apply to this subtree, if any.
125123
final AffineMatrix transform;
@@ -214,9 +212,8 @@ class SaveLayerNode extends ParentNode {
214212
SaveLayerNode(
215213
SvgAttributes attributes, {
216214
required this.paint,
217-
List<Node>? children,
218-
}) : super(attributes,
219-
children: children, precalculatedTransform: AffineMatrix.identity);
215+
super.children,
216+
}) : super(attributes, precalculatedTransform: AffineMatrix.identity);
220217

221218
/// The paint to apply to the saved layer.
222219
final Paint paint;
@@ -325,7 +322,7 @@ class MaskNode extends Node {
325322
class PathNode extends AttributedNode {
326323
/// Creates a new leaf node for the graphics tree with the specified [path]
327324
/// and attributes
328-
PathNode(this.path, SvgAttributes attributes) : super(attributes);
325+
PathNode(this.path, super.attributes);
329326

330327
/// The description of the geometry this leaf node draws.
331328
final Path path;
@@ -409,8 +406,8 @@ class TextNode extends AttributedNode {
409406
this.absolute,
410407
this.fontSize,
411408
this.fontWeight,
412-
SvgAttributes attributes,
413-
) : super(attributes);
409+
super.attributes,
410+
);
414411

415412
/// The text this node contains.
416413
final String text;

‎packages/vector_graphics_compiler/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ executables:
88
vector_graphics_compiler:
99

1010
environment:
11-
sdk: '>=2.12.0 <3.0.0'
11+
sdk: '>=2.17.0 <3.0.0'
1212

1313
dependencies:
1414
meta: ^1.7.0

0 commit comments

Comments
 (0)