Skip to content

Commit d17ebd1

Browse files
committed
migrate to null safety
1 parent 0baad80 commit d17ebd1

17 files changed

+236
-252
lines changed

example/ios/Flutter/Debug.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Flutter/Release.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

example/ios/Podfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
end
36+
37+
post_install do |installer|
38+
installer.pods_project.targets.each do |target|
39+
flutter_additional_ios_build_settings(target)
40+
end
41+
end

example/pubspec.lock

Lines changed: 39 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
5-
dependency: transitive
6-
description:
7-
name: archive
8-
url: "https://pub.dartlang.org"
9-
source: hosted
10-
version: "2.0.13"
11-
args:
12-
dependency: transitive
13-
description:
14-
name: args
15-
url: "https://pub.dartlang.org"
16-
source: hosted
17-
version: "1.6.0"
184
async:
195
dependency: transitive
206
description:
217
name: async
228
url: "https://pub.dartlang.org"
239
source: hosted
24-
version: "2.4.1"
10+
version: "2.5.0"
2511
blobs:
2612
dependency: "direct main"
2713
description:
2814
path: ".."
2915
relative: true
3016
source: path
31-
version: "1.2.0"
17+
version: "2.0.0"
3218
boolean_selector:
3319
dependency: transitive
3420
description:
3521
name: boolean_selector
3622
url: "https://pub.dartlang.org"
3723
source: hosted
38-
version: "2.0.0"
24+
version: "2.1.0"
25+
characters:
26+
dependency: transitive
27+
description:
28+
name: characters
29+
url: "https://pub.dartlang.org"
30+
source: hosted
31+
version: "1.1.0"
3932
charcode:
4033
dependency: transitive
4134
description:
4235
name: charcode
4336
url: "https://pub.dartlang.org"
4437
source: hosted
45-
version: "1.1.3"
38+
version: "1.2.0"
39+
clock:
40+
dependency: transitive
41+
description:
42+
name: clock
43+
url: "https://pub.dartlang.org"
44+
source: hosted
45+
version: "1.1.0"
4646
collection:
4747
dependency: transitive
4848
description:
4949
name: collection
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.14.12"
52+
version: "1.15.0"
5353
convert:
5454
dependency: transitive
5555
description:
@@ -71,6 +71,13 @@ packages:
7171
url: "https://pub.dartlang.org"
7272
source: hosted
7373
version: "0.1.3"
74+
fake_async:
75+
dependency: transitive
76+
description:
77+
name: fake_async
78+
url: "https://pub.dartlang.org"
79+
source: hosted
80+
version: "1.2.0"
7481
flutter:
7582
dependency: "direct main"
7683
description: flutter
@@ -102,34 +109,27 @@ packages:
102109
url: "https://pub.dartlang.org"
103110
source: hosted
104111
version: "3.1.4"
105-
image:
106-
dependency: transitive
107-
description:
108-
name: image
109-
url: "https://pub.dartlang.org"
110-
source: hosted
111-
version: "2.1.12"
112112
matcher:
113113
dependency: transitive
114114
description:
115115
name: matcher
116116
url: "https://pub.dartlang.org"
117117
source: hosted
118-
version: "0.12.6"
118+
version: "0.12.10"
119119
meta:
120120
dependency: transitive
121121
description:
122122
name: meta
123123
url: "https://pub.dartlang.org"
124124
source: hosted
125-
version: "1.1.8"
125+
version: "1.3.0"
126126
path:
127127
dependency: transitive
128128
description:
129129
name: path
130130
url: "https://pub.dartlang.org"
131131
source: hosted
132-
version: "1.6.4"
132+
version: "1.8.0"
133133
path_provider:
134134
dependency: transitive
135135
description:
@@ -158,13 +158,6 @@ packages:
158158
url: "https://pub.dartlang.org"
159159
source: hosted
160160
version: "1.9.0"
161-
petitparser:
162-
dependency: transitive
163-
description:
164-
name: petitparser
165-
url: "https://pub.dartlang.org"
166-
source: hosted
167-
version: "2.4.0"
168161
platform:
169162
dependency: transitive
170163
description:
@@ -179,13 +172,6 @@ packages:
179172
url: "https://pub.dartlang.org"
180173
source: hosted
181174
version: "1.0.2"
182-
quiver:
183-
dependency: transitive
184-
description:
185-
name: quiver
186-
url: "https://pub.dartlang.org"
187-
source: hosted
188-
version: "2.1.3"
189175
sky_engine:
190176
dependency: transitive
191177
description: flutter
@@ -197,63 +183,56 @@ packages:
197183
name: source_span
198184
url: "https://pub.dartlang.org"
199185
source: hosted
200-
version: "1.7.0"
186+
version: "1.8.0"
201187
stack_trace:
202188
dependency: transitive
203189
description:
204190
name: stack_trace
205191
url: "https://pub.dartlang.org"
206192
source: hosted
207-
version: "1.9.3"
193+
version: "1.10.0"
208194
stream_channel:
209195
dependency: transitive
210196
description:
211197
name: stream_channel
212198
url: "https://pub.dartlang.org"
213199
source: hosted
214-
version: "2.0.0"
200+
version: "2.1.0"
215201
string_scanner:
216202
dependency: transitive
217203
description:
218204
name: string_scanner
219205
url: "https://pub.dartlang.org"
220206
source: hosted
221-
version: "1.0.5"
207+
version: "1.1.0"
222208
term_glyph:
223209
dependency: transitive
224210
description:
225211
name: term_glyph
226212
url: "https://pub.dartlang.org"
227213
source: hosted
228-
version: "1.1.0"
214+
version: "1.2.0"
229215
test_api:
230216
dependency: transitive
231217
description:
232218
name: test_api
233219
url: "https://pub.dartlang.org"
234220
source: hosted
235-
version: "0.2.15"
221+
version: "0.2.19"
236222
typed_data:
237223
dependency: transitive
238224
description:
239225
name: typed_data
240226
url: "https://pub.dartlang.org"
241227
source: hosted
242-
version: "1.1.6"
228+
version: "1.3.0"
243229
vector_math:
244230
dependency: transitive
245231
description:
246232
name: vector_math
247233
url: "https://pub.dartlang.org"
248234
source: hosted
249-
version: "2.0.8"
250-
xml:
251-
dependency: transitive
252-
description:
253-
name: xml
254-
url: "https://pub.dartlang.org"
255-
source: hosted
256-
version: "3.6.1"
235+
version: "2.1.0"
257236
sdks:
258-
dart: ">=2.7.0 <3.0.0"
259-
flutter: ">=1.17.0 <2.0.0"
237+
dart: ">=2.12.0 <3.0.0"
238+
flutter: ">=1.17.0"

lib/src/clipper/clipper.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import 'package:blobs/src/services/blob_generator.dart';
44
import 'package:flutter/material.dart';
55

66
class BlobClipper extends CustomClipper<Path> {
7-
final String id;
7+
final String? id;
88
final int edgesCount;
99
final int minGrowth;
1010
BlobClipper({
1111
this.id,
12-
this.edgesCount = BlobConfig.edgesCount,
13-
this.minGrowth = BlobConfig.minGrowth,
12+
this.edgesCount = BlobConfig.edgesCount as int,
13+
this.minGrowth = BlobConfig.minGrowth as int,
1414
});
1515

1616
@override

lib/src/models.dart

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
import 'package:blobs/src/config.dart';
12
import 'package:flutter/material.dart';
23

34
class BlobData {
45
int growth;
56
num size;
67
int edges;
78
BlobPoints points;
8-
String id;
9+
String? id;
910
Path path;
10-
String svgPath;
11+
String? svgPath;
1112
BlobCurves curves;
1213

1314
BlobData({
14-
this.growth,
15-
this.size,
16-
this.edges,
17-
this.points,
18-
this.id,
19-
this.path,
20-
this.svgPath,
21-
this.curves,
15+
required this.growth,
16+
required this.size,
17+
required this.edges,
18+
required this.points,
19+
required this.id,
20+
required this.path,
21+
required this.svgPath,
22+
required this.curves,
2223
});
2324
}
2425

@@ -33,14 +34,14 @@ enum BlobFillType { fill, stroke }
3334

3435
class BlobStyles {
3536
Color color;
36-
Shader gradient;
37+
Shader? gradient;
3738
int strokeWidth;
3839
BlobFillType fillType;
3940
BlobStyles({
40-
this.color,
41+
this.color = BlobConfig.color,
4142
this.gradient,
42-
this.fillType,
43-
this.strokeWidth,
43+
this.fillType = BlobConfig.fillType,
44+
this.strokeWidth = BlobConfig.strokeWidth,
4445
});
4546
}
4647

@@ -49,12 +50,12 @@ class BlobPoints {
4950
List<Offset> destPoints;
5051
Offset center;
5152
double innerRad;
52-
String id;
53+
String? id;
5354
BlobPoints({
54-
this.originPoints,
55-
this.destPoints,
56-
this.center,
57-
this.id,
58-
this.innerRad,
55+
required this.originPoints,
56+
required this.destPoints,
57+
required this.center,
58+
required this.id,
59+
required this.innerRad,
5960
});
6061
}

lib/src/painter/painter.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ import 'package:blobs/src/painter/tools.dart';
33
import 'package:flutter/material.dart';
44

55
class BlobPainter extends CustomPainter {
6-
final BlobData blobData;
6+
final BlobData? blobData;
77
final bool debug;
88
final BlobStyles styles;
99

1010
BlobPainter({
1111
this.blobData,
12-
this.styles,
12+
required this.styles,
1313
this.debug = false,
1414
});
1515

1616
@override
1717
void paint(Canvas c, Size s) {
18-
drawBlob(c, blobData.path, styles);
18+
drawBlob(c, blobData!.path, styles);
1919
if (debug) {
2020
circle(c, s, (s.width / 2)); // outer circle
21-
circle(c, s, blobData.points.innerRad); // inner circle
21+
circle(c, s, blobData!.points.innerRad); // inner circle
2222
point(c, Offset(s.width / 2, s.height / 2)); // center point
23-
List originPoints = blobData.points.originPoints;
24-
List destPoints = blobData.points.destPoints;
23+
List originPoints = blobData!.points.originPoints;
24+
List destPoints = blobData!.points.destPoints;
2525
originPoints.asMap().forEach(
2626
(i, p) => drawLines(c, p, destPoints[i]),
2727
); // line from inner circle to blob point

0 commit comments

Comments
 (0)