Skip to content

Commit 760c092

Browse files
authored
Chore/dart 3.12 format (singerdmx#2744)
* style: apply Dart 3.12 format (tall style) * ci: enforce repo-wide dart format + blame-ignore the reformat
1 parent 5c96e65 commit 760c092

183 files changed

Lines changed: 4545 additions & 3748 deletions

File tree

Some content is hidden

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

.git-blame-ignore-revs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Revisions for `git blame` to skip (large, mechanical changes with no logic impact).
2+
#
3+
# Enable locally once with:
4+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
5+
#
6+
# GitHub honors this file automatically. List full 40-char commit SHAs only.
7+
8+
# style: apply Dart 3.12 format (tall style) — repo-wide dart_format, no logic changes
9+
10e0814088ae3b12f0cca4673f885e2828eaaa7a

.github/workflows/checks.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
- name: Set up Flutter
1717
uses: subosito/flutter-action@v2
1818
with:
19+
# Pinned so a future Flutter/Dart release can't change formatter output
20+
# and turn the format check below red on unrelated PRs. Bump deliberately
21+
# alongside a repo-wide reformat (see .git-blame-ignore-revs).
22+
flutter-version: 3.44.1
1923
channel: stable
2024
cache: true
2125

@@ -34,9 +38,8 @@ jobs:
3438
- name: Perform Flutter Analysis
3539
run: flutter analyze
3640

37-
# TODO: Restore Dart formatting check, disabled due to an issue https://github.com/singerdmx/flutter-quill/actions/runs/13355109619/job/37296760819.
38-
# - name: Check Dart code formatting
39-
# run: dart format --set-exit-if-changed .
41+
- name: Check Dart code formatting
42+
run: dart format --set-exit-if-changed .
4043

4144
- name: Preview Dart proposed changes
4245
run: dart fix --dry-run

example/integration_test/flutter_quill_integration_test.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@ import 'package:integration_test/integration_test.dart';
77
void main() {
88
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
99

10-
testWidgets('$QuillEditor renders and handles input without crashing',
11-
(tester) async {
10+
testWidgets('$QuillEditor renders and handles input without crashing', (
11+
tester,
12+
) async {
1213
// This test ensures that the QuillEditor can be created and accepts input
1314
// without crashing on any platform.
1415
//
1516
// Example fix: https://github.com/singerdmx/flutter-quill/pull/2579
1617

1718
final controller = QuillController.basic();
18-
await tester.pumpWidget(MaterialApp(
19-
home: QuillEditor.basic(controller: controller),
20-
));
19+
await tester.pumpWidget(
20+
MaterialApp(home: QuillEditor.basic(controller: controller)),
21+
);
2122

2223
// Simulate text input to trigger user interactions.
2324
await tester.quillEnterText(find.byType(QuillEditor), 'sample text\n');

example/lib/custom_toolbar.dart

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ class CustomToolbar extends StatelessWidget {
1616
scrollDirection: Axis.horizontal,
1717
child: Wrap(
1818
children: [
19-
QuillToolbarHistoryButton(
20-
isUndo: true,
21-
controller: controller,
22-
),
23-
QuillToolbarHistoryButton(
24-
isUndo: false,
25-
controller: controller,
26-
),
19+
QuillToolbarHistoryButton(isUndo: true, controller: controller),
20+
QuillToolbarHistoryButton(isUndo: false, controller: controller),
2721
QuillToolbarToggleStyleButton(
2822
options: const QuillToolbarToggleStyleButtonOptions(),
2923
controller: controller,
@@ -38,40 +32,22 @@ class CustomToolbar extends StatelessWidget {
3832
controller: controller,
3933
attribute: Attribute.underline,
4034
),
41-
QuillToolbarClearFormatButton(
42-
controller: controller,
43-
),
35+
QuillToolbarClearFormatButton(controller: controller),
4436
const VerticalDivider(),
45-
QuillToolbarImageButton(
46-
controller: controller,
47-
),
48-
QuillToolbarCameraButton(
49-
controller: controller,
50-
),
51-
QuillToolbarVideoButton(
52-
controller: controller,
53-
),
37+
QuillToolbarImageButton(controller: controller),
38+
QuillToolbarCameraButton(controller: controller),
39+
QuillToolbarVideoButton(controller: controller),
5440
const VerticalDivider(),
55-
QuillToolbarColorButton(
56-
controller: controller,
57-
isBackground: false,
58-
),
59-
QuillToolbarColorButton(
60-
controller: controller,
61-
isBackground: true,
62-
),
41+
QuillToolbarColorButton(controller: controller, isBackground: false),
42+
QuillToolbarColorButton(controller: controller, isBackground: true),
6343
const VerticalDivider(),
64-
QuillToolbarSelectHeaderStyleDropdownButton(
65-
controller: controller,
66-
),
44+
QuillToolbarSelectHeaderStyleDropdownButton(controller: controller),
6745
const VerticalDivider(),
6846
QuillToolbarSelectLineHeightStyleDropdownButton(
6947
controller: controller,
7048
),
7149
const VerticalDivider(),
72-
QuillToolbarToggleCheckListButton(
73-
controller: controller,
74-
),
50+
QuillToolbarToggleCheckListButton(controller: controller),
7551
QuillToolbarToggleStyleButton(
7652
controller: controller,
7753
attribute: Attribute.ol,
@@ -88,14 +64,8 @@ class CustomToolbar extends StatelessWidget {
8864
controller: controller,
8965
attribute: Attribute.blockQuote,
9066
),
91-
QuillToolbarIndentButton(
92-
controller: controller,
93-
isIncrease: true,
94-
),
95-
QuillToolbarIndentButton(
96-
controller: controller,
97-
isIncrease: false,
98-
),
67+
QuillToolbarIndentButton(controller: controller, isIncrease: true),
68+
QuillToolbarIndentButton(controller: controller, isIncrease: false),
9969
const VerticalDivider(),
10070
QuillToolbarLinkStyleButton(controller: controller),
10171
],

example/lib/main.dart

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,30 @@ class HomePage extends StatefulWidget {
4242
class _HomePageState extends State<HomePage> {
4343
final QuillController _controller = () {
4444
return QuillController.basic(
45-
config: QuillControllerConfig(
46-
clipboardConfig: QuillClipboardConfig(
47-
enableExternalRichPaste: true,
48-
onImagePaste: (imageBytes) async {
49-
if (kIsWeb) {
50-
// Dart IO is unsupported on the web.
51-
return null;
52-
}
53-
// Save the image somewhere and return the image URL that will be
54-
// stored in the Quill Delta JSON (the document).
55-
final newFileName =
56-
'image-file-${DateTime.now().toIso8601String()}.png';
57-
final newPath = path.join(
58-
io.Directory.systemTemp.path,
59-
newFileName,
60-
);
61-
final file = await io.File(
62-
newPath,
63-
).writeAsBytes(imageBytes, flush: true);
64-
return file.path;
65-
},
45+
config: QuillControllerConfig(
46+
clipboardConfig: QuillClipboardConfig(
47+
enableExternalRichPaste: true,
48+
onImagePaste: (imageBytes) async {
49+
if (kIsWeb) {
50+
// Dart IO is unsupported on the web.
51+
return null;
52+
}
53+
// Save the image somewhere and return the image URL that will be
54+
// stored in the Quill Delta JSON (the document).
55+
final newFileName =
56+
'image-file-${DateTime.now().toIso8601String()}.png';
57+
final newPath = path.join(
58+
io.Directory.systemTemp.path,
59+
newFileName,
60+
);
61+
final file = await io.File(
62+
newPath,
63+
).writeAsBytes(imageBytes, flush: true);
64+
return file.path;
65+
},
66+
),
6667
),
67-
));
68+
);
6869
}();
6970
final FocusNode _editorFocusNode = FocusNode();
7071
final ScrollController _editorScrollController = ScrollController();
@@ -86,9 +87,13 @@ class _HomePageState extends State<HomePage> {
8687
icon: const Icon(Icons.output),
8788
tooltip: 'Print Delta JSON to log',
8889
onPressed: () {
89-
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
90-
content:
91-
Text('The JSON Delta has been printed to the console.')));
90+
ScaffoldMessenger.of(context).showSnackBar(
91+
const SnackBar(
92+
content: Text(
93+
'The JSON Delta has been printed to the console.',
94+
),
95+
),
96+
);
9297
debugPrint(jsonEncode(_controller.document.toDelta().toJson()));
9398
},
9499
),
@@ -108,9 +113,7 @@ class _HomePageState extends State<HomePage> {
108113
onPressed: () {
109114
_controller.document.insert(
110115
_controller.selection.extentOffset,
111-
TimeStampEmbed(
112-
DateTime.now().toString(),
113-
),
116+
TimeStampEmbed(DateTime.now().toString()),
114117
);
115118

116119
_controller.updateSelection(
@@ -128,7 +131,7 @@ class _HomePageState extends State<HomePage> {
128131
final isDesktop = {
129132
TargetPlatform.linux,
130133
TargetPlatform.windows,
131-
TargetPlatform.macOS
134+
TargetPlatform.macOS,
132135
}.contains(defaultTargetPlatform);
133136
if (isDesktop) {
134137
_editorFocusNode.requestFocus();
@@ -193,9 +196,7 @@ class _HomePageState extends State<HomePage> {
193196
}
194197

195198
class TimeStampEmbed extends Embeddable {
196-
const TimeStampEmbed(
197-
String value,
198-
) : super(timeStampType, value);
199+
const TimeStampEmbed(String value) : super(timeStampType, value);
199200

200201
static const String timeStampType = 'timeStamp';
201202

@@ -215,10 +216,7 @@ class TimeStampEmbedBuilder extends EmbedBuilder {
215216
}
216217

217218
@override
218-
Widget build(
219-
BuildContext context,
220-
EmbedContext embedContext,
221-
) {
219+
Widget build(BuildContext context, EmbedContext embedContext) {
222220
return Row(
223221
children: [
224222
const Icon(Icons.access_time_rounded),

0 commit comments

Comments
 (0)