Skip to content

Commit f882d95

Browse files
authored
feat: integrate awesome_lints and upgrade to Flutter 3.38 (#1173)
* chore: update Flutter SDK to version 3.38.5 Upgrade Flutter from 3.32.4 to 3.38.5 to meet awesome_lints requirement for Dart SDK 3.10.0+. Update CI workflow to use the new Flutter version and add custom_lint verification step. * chore: integrate awesome_lints with custom lint rules Add awesome_lints and custom_lint dependencies, configure analysis_options.yaml to enable newline lint rules: newline_before_case, newline_before_constructor, newline_before_method, and newline_before_return. * style: apply newline formatting per awesome_lints rules Add blank lines before case clauses, return statements, method declarations, and constructors throughout the codebase to comply with awesome_lints newline rules. * fix: replace deprecated translate with leftTranslateByDouble Update Matrix4.translate() calls to use the new leftTranslateByDouble() API to resolve deprecation warnings in Flutter SDK 3.38.5. * chore: improve code readability with blank line formatting
1 parent 580399b commit f882d95

File tree

229 files changed

+850
-5
lines changed

Some content is hidden

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

229 files changed

+850
-5
lines changed

.fvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"flutter": "3.32.4"
2+
"flutter": "3.38.5"
33
}

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- uses: subosito/flutter-action@v2
3434
with:
3535
channel: "stable"
36-
flutter-version: "3.32.4"
36+
flutter-version: "3.38.5"
3737
cache: true
3838

3939
- name: Run tests
@@ -42,6 +42,7 @@ jobs:
4242
flutter pub get
4343
flutter analyze .
4444
dart format --set-exit-if-changed .
45+
dart run custom_lint
4546
flutter test --coverage
4647
4748
- name: Upload coverage to Codecov

analysis_options.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ linter:
1111

1212
analyzer:
1313
exclude:
14-
- lib/src/l10n/**
14+
- lib/src/l10n/**
15+
plugins:
16+
- custom_lint
17+
18+
custom_lint:
19+
enable_all_lint_rules: false
20+
rules:
21+
- newline_before_case
22+
- newline_before_constructor
23+
- newline_before_method
24+
- newline_before_return

lib/src/core/document/deprecated/document.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class DocumentV0 {
2222

2323
final document = Map<String, Object>.from(json['document'] as Map);
2424
final root = NodeV0.fromJson(document);
25+
2526
return DocumentV0(root: root);
2627
}
2728

@@ -31,6 +32,7 @@ class DocumentV0 {
3132
type: 'editor',
3233
children: LinkedList<NodeV0>()..add(TextNodeV0.empty()),
3334
);
35+
3436
return DocumentV0(
3537
root: root,
3638
);
@@ -54,6 +56,7 @@ class DocumentV0 {
5456
for (final node in nodes) {
5557
target.insertBefore(node);
5658
}
59+
5760
return true;
5861
}
5962

@@ -62,6 +65,7 @@ class DocumentV0 {
6265
for (var i = 0; i < nodes.length; i++) {
6366
parent.insert(nodes.elementAt(i), index: path.last + i);
6467
}
68+
6569
return true;
6670
}
6771

@@ -83,6 +87,7 @@ class DocumentV0 {
8387
target = next;
8488
length--;
8589
}
90+
8691
return true;
8792
}
8893

@@ -96,6 +101,7 @@ class DocumentV0 {
96101
return false;
97102
}
98103
target.updateAttributes(attributes);
104+
99105
return true;
100106
}
101107

@@ -109,6 +115,7 @@ class DocumentV0 {
109115
return false;
110116
}
111117
target.delta = target.delta.compose(delta);
118+
112119
return true;
113120
}
114121

lib/src/core/document/deprecated/node.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ final class NodeV0 extends ChangeNotifier with LinkedListEntry<NodeV0> {
8787
if (subtype != null) {
8888
return '$type/$subtype';
8989
}
90+
9091
return type;
9192
}
9293

9394
String? get subtype {
9495
if (attributes[BuiltInAttributeKey.subtype] is String) {
9596
return attributes[BuiltInAttributeKey.subtype] as String;
9697
}
98+
9799
return null;
98100
}
99101

@@ -136,6 +138,7 @@ final class NodeV0 extends ChangeNotifier with LinkedListEntry<NodeV0> {
136138
entry.parent = this;
137139
children.add(entry);
138140
notifyListeners();
141+
139142
return;
140143
}
141144

@@ -188,6 +191,7 @@ final class NodeV0 extends ChangeNotifier with LinkedListEntry<NodeV0> {
188191
if (attributes.isNotEmpty) {
189192
map['attributes'] = attributes;
190193
}
194+
191195
return map;
192196
}
193197

@@ -208,6 +212,7 @@ final class NodeV0 extends ChangeNotifier with LinkedListEntry<NodeV0> {
208212
);
209213
}
210214
}
215+
211216
return node;
212217
}
213218

@@ -222,6 +227,7 @@ final class NodeV0 extends ChangeNotifier with LinkedListEntry<NodeV0> {
222227
}
223228
index += 1;
224229
}
230+
225231
return parent!._computePath([index, ...previous]);
226232
}
227233
}
@@ -245,7 +251,9 @@ final class TextNodeV0 extends NodeV0 {
245251
);
246252

247253
Delta _delta;
254+
248255
Delta get delta => _delta;
256+
249257
set delta(Delta v) {
250258
_delta = v;
251259
notifyListeners();
@@ -255,6 +263,7 @@ final class TextNodeV0 extends NodeV0 {
255263
Map<String, Object> toJson() {
256264
final map = super.toJson();
257265
map['delta'] = delta.toJson();
266+
258267
return map;
259268
}
260269

@@ -277,6 +286,7 @@ final class TextNodeV0 extends NodeV0 {
277286
);
278287
}
279288
}
289+
280290
return textNode;
281291
}
282292

@@ -293,6 +303,7 @@ extension NodeV0Equality on Iterable<NodeV0> {
293303
return false;
294304
}
295305
}
306+
296307
return true;
297308
}
298309

lib/src/core/document/diff.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ List<Operation> diffNodes(Node oldNode, Node newNode) {
7171
}
7272
}
7373
}
74+
7475
return combinedOperations;
7576
}
7677

@@ -99,6 +100,7 @@ List<Operation> diffNodes(Node oldNode, Node newNode) {
99100
}
100101
}
101102
}
103+
102104
return combinedOperations;
103105
}
104106

lib/src/core/document/document.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class Document {
4141

4242
final document = Map<String, Object>.from(json['document'] as Map);
4343
final root = Node.fromJson(document);
44+
4445
return Document(root: root);
4546
}
4647

@@ -51,6 +52,7 @@ class Document {
5152
type: 'document',
5253
children: LinkedList<Node>()..add(TextNode.empty()),
5354
);
55+
5456
return Document(
5557
root: root,
5658
);
@@ -66,6 +68,7 @@ class Document {
6668
type: 'page',
6769
children: withInitialText ? [paragraphNode()] : [],
6870
);
71+
6972
return Document(
7073
root: root,
7174
);
@@ -83,6 +86,7 @@ class Document {
8386
while (current != null && current.children.isNotEmpty) {
8487
current = current.children.last;
8588
}
89+
8690
return current;
8791
}
8892

@@ -110,6 +114,7 @@ class Document {
110114
for (final node in nodes) {
111115
target.insertBefore(node);
112116
}
117+
113118
return true;
114119
}
115120

@@ -118,6 +123,7 @@ class Document {
118123
for (var i = 0; i < nodes.length; i++) {
119124
parent.insert(nodes.elementAt(i), index: path.last + i);
120125
}
126+
121127
return true;
122128
}
123129

@@ -139,6 +145,7 @@ class Document {
139145
target = next;
140146
length--;
141147
}
148+
142149
return true;
143150
}
144151

@@ -147,13 +154,15 @@ class Document {
147154
// if the path is empty, it means the root node.
148155
if (path.isEmpty) {
149156
root.updateAttributes(attributes);
157+
150158
return true;
151159
}
152160
final target = nodeAtPath(path);
153161
if (target == null) {
154162
return false;
155163
}
156164
target.updateAttributes(attributes);
165+
157166
return true;
158167
}
159168

@@ -168,6 +177,7 @@ class Document {
168177
return false;
169178
}
170179
target.updateAttributes({'delta': (targetDelta.compose(delta)).toJson()});
180+
171181
return true;
172182
}
173183

lib/src/core/document/node.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,18 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
8484

8585
/// The children of the node.
8686
final LinkedList<Node> _children;
87+
8788
List<Node> get children {
8889
_cacheChildren ??= _children.toList(growable: false);
90+
8991
return _cacheChildren!;
9092
}
9193

9294
List<Node>? _cacheChildren;
9395

9496
/// The attributes of the node.
9597
Attributes _attributes;
98+
9699
Attributes get attributes => {..._attributes};
97100

98101
/// The path of the node.
@@ -138,6 +141,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
138141

139142
final index = path.first;
140143
final child = childAtIndexOrNull(index);
144+
141145
return child?.childAtPath(path.sublist(1));
142146
}
143147

@@ -161,6 +165,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
161165
if (_children.isEmpty) {
162166
_children.add(entry);
163167
notifyListeners();
168+
164169
return;
165170
}
166171

@@ -213,6 +218,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
213218

214219
parent?.notifyListeners();
215220
parent = null;
221+
216222
return true;
217223
}
218224

@@ -235,6 +241,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
235241
if (attributes['delta'] is List) {
236242
return Delta.fromJson(attributes['delta']);
237243
}
244+
238245
return null;
239246
}
240247

@@ -253,6 +260,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
253260
// filter the null value
254261
map['data'] = attributes..removeWhere((_, value) => value == null);
255262
}
263+
256264
return map;
257265
}
258266

@@ -281,6 +289,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
281289
}
282290
node.externalValues = externalValues;
283291
node.extraInfos = extraInfos;
292+
284293
return node;
285294
}
286295

@@ -297,6 +306,7 @@ final class Node extends ChangeNotifier with LinkedListEntry<Node> {
297306
return previous;
298307
}
299308
final index = parent.children.indexOf(this);
309+
300310
return parent._computePath([index, ...previous]);
301311
}
302312

@@ -351,8 +361,10 @@ final class TextNode extends Node {
351361
String get subtype => '';
352362

353363
Delta _delta;
364+
354365
@override
355366
Delta get delta => _delta;
367+
356368
set delta(Delta v) {
357369
_delta = v;
358370
notifyListeners();
@@ -362,6 +374,7 @@ final class TextNode extends Node {
362374
Map<String, Object> toJson() {
363375
final map = super.toJson();
364376
map['delta'] = delta.toJson();
377+
365378
return map;
366379
}
367380

@@ -385,6 +398,7 @@ final class TextNode extends Node {
385398
);
386399
}
387400
}
401+
388402
return textNode;
389403
}
390404

@@ -401,6 +415,7 @@ extension NodeEquality on Iterable<Node> {
401415
return false;
402416
}
403417
}
418+
404419
return true;
405420
}
406421

0 commit comments

Comments
 (0)