Skip to content

Commit afa0170

Browse files
committed
Dart format: Use 3.8.0 formatter with 100 char length and preserve trailing commas
1 parent 72098db commit afa0170

File tree

12 files changed

+128
-153
lines changed

12 files changed

+128
-153
lines changed

analysis_options.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
# RydMike v2.3.0 : https://gist.github.com/rydmike/fdb53ddd933c37d20e6f3188a936cd4c
2525
include: all_lint_rules.yaml
2626

27-
# This project uses 80 char line length.
27+
# This project uses 100 char line length and preserves trailing commas.
2828
formatter:
2929
page_width: 100
30+
trailing_commas: preserve
3031

3132
analyzer:
3233
exclude:

lib/app/constants/app_data.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ abstract final class AppData {
3131

3232
// Check if this is a Web-WASM build, Web-JS build or native VM build.
3333
static const bool isRunningWithWasm = bool.fromEnvironment('dart.tool.dart2wasm');
34-
static const String buildType =
35-
isRunningWithWasm
36-
? ', WasmGC'
37-
: kIsWeb
38-
? ', JS'
39-
: ', native VM';
34+
static const String buildType = isRunningWithWasm
35+
? ', WasmGC'
36+
: kIsWeb
37+
? ', JS'
38+
: ', native VM';
4039

4140
static const String packageVersion = '$versionMajor.$versionMinor.$versionPatch';
4241
static const String flutterVersionNum = FlutterVersion.version ?? '';

lib/app/models/shape_borders.dart

Lines changed: 39 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -171,105 +171,92 @@ enum ShapeBorders {
171171
case ShapeBorders.circular:
172172
return RoundedRectangleBorder(
173173
borderRadius: BorderRadius.all(Radius.circular(radius)),
174-
side:
175-
lineWidth > 0
176-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
177-
: BorderSide.none,
174+
side: lineWidth > 0
175+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
176+
: BorderSide.none,
178177
);
179178
case ShapeBorders.roundedSuperellipseBorder:
180179
return RoundedSuperellipseBorder(
181180
borderRadius: BorderRadius.all(Radius.circular(radius)),
182-
side:
183-
lineWidth > 0
184-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
185-
: BorderSide.none,
181+
side: lineWidth > 0
182+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
183+
: BorderSide.none,
186184
);
187185
case ShapeBorders.continuous:
188186
return ContinuousRectangleBorder(
189187
borderRadius: BorderRadius.all(Radius.circular(radius)),
190-
side:
191-
lineWidth > 0
192-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
193-
: BorderSide.none,
188+
side: lineWidth > 0
189+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
190+
: BorderSide.none,
194191
);
195192
case ShapeBorders.continuousSquircle:
196193
return ContinuousRectangleBorder(
197194
borderRadius: BorderRadius.all(Radius.circular(radius * 2.3529)),
198-
side:
199-
lineWidth > 0
200-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
201-
: BorderSide.none,
195+
side: lineWidth > 0
196+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
197+
: BorderSide.none,
202198
);
203199
case ShapeBorders.squircleBorder:
204200
return SquircleBorder(
205201
borderRadius: BorderRadius.all(Radius.circular(radius)),
206-
side:
207-
lineWidth > 0
208-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
209-
: BorderSide.none,
202+
side: lineWidth > 0
203+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
204+
: BorderSide.none,
210205
);
211206
case ShapeBorders.figmaSquircle:
212207
return SmoothRectangleBorder(
213208
borderRadius: SmoothBorderRadius(cornerRadius: radius, cornerSmoothing: smoothness),
214-
side:
215-
lineWidth > 0
216-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
217-
: BorderSide.none,
209+
side: lineWidth > 0
210+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
211+
: BorderSide.none,
218212
);
219213
case ShapeBorders.smoothCorner:
220214
return smooth.SmoothRectangleBorder(
221215
smoothness: smoothness,
222216
borderRadius: BorderRadius.circular(radius),
223-
side:
224-
lineWidth > 0
225-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
226-
: BorderSide.none,
217+
side: lineWidth > 0
218+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
219+
: BorderSide.none,
227220
);
228221
case ShapeBorders.cupertinoCorners:
229222
return cuper.SquircleBorder(
230223
radius: BorderRadius.all(Radius.circular(radius)),
231-
side:
232-
lineWidth > 0
233-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
234-
: BorderSide.none,
224+
side: lineWidth > 0
225+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
226+
: BorderSide.none,
235227
);
236228
case ShapeBorders.superEllipse:
237229
return SuperellipseShape(
238230
borderRadius: BorderRadius.all(Radius.circular(radius)),
239-
side:
240-
lineWidth > 0
241-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
242-
: BorderSide.none,
231+
side: lineWidth > 0
232+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
233+
: BorderSide.none,
243234
);
244235
case ShapeBorders.stadium:
245236
return StadiumBorder(
246-
side:
247-
lineWidth > 0
248-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
249-
: BorderSide.none,
237+
side: lineWidth > 0
238+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
239+
: BorderSide.none,
250240
);
251241
case ShapeBorders.squircleStadiumBorder:
252242
return SquircleStadiumBorder(
253-
side:
254-
lineWidth > 0
255-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
256-
: BorderSide.none,
243+
side: lineWidth > 0
244+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
245+
: BorderSide.none,
257246
);
258247
case ShapeBorders.simonSquircle:
259248
return SimonSquircleBorder(
260249
radius: radius,
261-
side:
262-
lineWidth > 0
263-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
264-
: BorderSide.none,
250+
side: lineWidth > 0
251+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
252+
: BorderSide.none,
265253
);
266254
case ShapeBorders.beveled:
267255
return BeveledRectangleBorder(
268256
borderRadius: BorderRadius.all(Radius.circular(radius)),
269-
side:
270-
lineWidth > 0
271-
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
272-
: BorderSide.none,
257+
side: lineWidth > 0
258+
? BorderSide(width: lineWidth, color: lineColor, strokeAlign: strokeAlign)
259+
: BorderSide.none,
273260
);
274261
}
275262
}

lib/app/utils/flex_color_extension.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ extension FlexColorExtensions on Color {
3434
if (amount > 100) return Colors.white;
3535
// HSLColor returns saturation 1 for black, we want 0 instead to be able
3636
// lighten black color up along the grey scale from black.
37-
final HSLColor hsl =
38-
this == const Color(0xFF000000)
39-
? HSLColor.fromColor(this).withSaturation(0)
40-
: HSLColor.fromColor(this);
37+
final HSLColor hsl = this == const Color(0xFF000000)
38+
? HSLColor.fromColor(this).withSaturation(0)
39+
: HSLColor.fromColor(this);
4140
return hsl.withLightness(math.min(1, math.max(0, hsl.lightness + amount / 100))).toColor();
4241
}
4342

lib/app/widgets/app/color_card.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,20 @@ class ColorCard extends StatelessWidget {
4444
height: effectiveSize.height,
4545
child: Tooltip(
4646
waitDuration: const Duration(milliseconds: 700),
47-
message:
48-
color != textColor
49-
? 'Color #${color.hexCode}.'
50-
'\nTap box to copy RGB value to Clipboard.'
51-
: '',
47+
message: color != textColor
48+
? 'Color #${color.hexCode}.'
49+
'\nTap box to copy RGB value to Clipboard.'
50+
: '',
5251
child: Card(
5352
margin: EdgeInsets.zero,
5453
clipBehavior: Clip.antiAlias,
5554
color: color,
5655
child: InkWell(
57-
onTap:
58-
color != textColor
59-
? () {
60-
unawaited(copyColorToClipboard(context, color));
61-
}
62-
: null,
56+
onTap: color != textColor
57+
? () {
58+
unawaited(copyColorToClipboard(context, color));
59+
}
60+
: null,
6361
child: Center(
6462
child: Text(
6563
label,

lib/app/widgets/app/color_picker_inkwell.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,20 @@ class ColorPickerInkWellDialog extends StatelessWidget {
199199
onHover?.call(value);
200200
},
201201
hoverColor: Colors.transparent,
202-
onTap:
203-
enabled
204-
? () async {
205-
if (await colorPicker.showPickerDialog(
206-
context,
207-
insetPadding: const EdgeInsets.all(16),
208-
barrierColor: Colors.black.withValues(alpha: 0.05),
209-
constraints: const BoxConstraints(minHeight: 570, minWidth: 450, maxWidth: 450),
210-
)) {
211-
wasCancelled(false);
212-
} else {
213-
wasCancelled(true);
214-
}
202+
onTap: enabled
203+
? () async {
204+
if (await colorPicker.showPickerDialog(
205+
context,
206+
insetPadding: const EdgeInsets.all(16),
207+
barrierColor: Colors.black.withValues(alpha: 0.05),
208+
constraints: const BoxConstraints(minHeight: 570, minWidth: 450, maxWidth: 450),
209+
)) {
210+
wasCancelled(false);
211+
} else {
212+
wasCancelled(true);
215213
}
216-
: null,
214+
}
215+
: null,
217216
child: child,
218217
);
219218
}

lib/app/widgets/app/copy_color_to_clipboard.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ Future<void> copyColorToClipboard(BuildContext context, Color color) async {
3030
child: Text(
3131
'#${color.hexCode}',
3232
style: TextStyle(
33-
color:
34-
ThemeData.estimateBrightnessForColor(color) == Brightness.light
35-
? Colors.black
36-
: Colors.white,
33+
color: ThemeData.estimateBrightnessForColor(color) == Brightness.light
34+
? Colors.black
35+
: Colors.white,
3736
),
3837
),
3938
),

lib/app/widgets/app/link_text_span.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ class LinkTextSpan extends TextSpan {
1616
// stateful widget that then hands the recognizer to the TextSpan.
1717
LinkTextSpan({super.style, required Uri uri, required String super.text})
1818
: super(
19-
recognizer:
20-
TapGestureRecognizer()
21-
..onTap = () {
22-
launchUrl(uri);
23-
},
19+
recognizer: TapGestureRecognizer()
20+
..onTap = () {
21+
launchUrl(uri);
22+
},
2423
);
2524
}

lib/app/widgets/universal/list_tile_reveal.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,13 @@ class _ListTileRevealState extends State<ListTileReveal> {
152152
transitionBuilder: (Widget child, Animation<double> animation) {
153153
return SizeTransition(sizeFactor: animation, child: child);
154154
},
155-
child:
156-
(_isOpen && widget.subtitle != null && widget.enabled)
157-
? ListTile(
158-
dense: (widget.dense ?? false) || (widget.subtitleDense ?? false),
159-
subtitle: widget.subtitle,
160-
onTap: widget.enabled ? _handleTap : null,
161-
)
162-
: const SizedBox.shrink(),
155+
child: (_isOpen && widget.subtitle != null && widget.enabled)
156+
? ListTile(
157+
dense: (widget.dense ?? false) || (widget.subtitleDense ?? false),
158+
subtitle: widget.subtitle,
159+
onTap: widget.enabled ? _handleTap : null,
160+
)
161+
: const SizedBox.shrink(),
163162
),
164163
],
165164
);

lib/home/widgets/shape_border_popup_menu.dart

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,36 +54,34 @@ class ShapeBorderPopupMenu extends StatelessWidget {
5454
onChanged?.call(selected);
5555
},
5656
enabled: enabled,
57-
itemBuilder:
58-
(BuildContext context) => <PopupMenuItem<ShapeBorders>>[
59-
for (int i = 0; i < ShapeBorders.values.length; i++)
60-
PopupMenuItem<ShapeBorders>(
61-
value: ShapeBorders.values[i],
62-
child: ListTile(
63-
dense: true,
64-
contentPadding: EdgeInsets.zero,
65-
leading:
66-
type == ShapeBorders.values[i]
67-
? IconTheme(
68-
data: selectedIconTheme,
69-
child: ColorSchemeBox(
70-
backgroundColor: scheme.primary,
71-
borderColor: Colors.transparent,
72-
child: _TooltipIcon(index: i),
73-
),
74-
)
75-
: IconTheme(
76-
data: unSelectedIconTheme,
77-
child: ColorSchemeBox(
78-
backgroundColor: Colors.transparent,
79-
borderColor: scheme.primary,
80-
child: _TooltipIcon(index: i),
81-
),
82-
),
83-
title: Text(ShapeBorders.values[i].type, style: txtStyle),
84-
),
85-
),
86-
],
57+
itemBuilder: (BuildContext context) => <PopupMenuItem<ShapeBorders>>[
58+
for (int i = 0; i < ShapeBorders.values.length; i++)
59+
PopupMenuItem<ShapeBorders>(
60+
value: ShapeBorders.values[i],
61+
child: ListTile(
62+
dense: true,
63+
contentPadding: EdgeInsets.zero,
64+
leading: type == ShapeBorders.values[i]
65+
? IconTheme(
66+
data: selectedIconTheme,
67+
child: ColorSchemeBox(
68+
backgroundColor: scheme.primary,
69+
borderColor: Colors.transparent,
70+
child: _TooltipIcon(index: i),
71+
),
72+
)
73+
: IconTheme(
74+
data: unSelectedIconTheme,
75+
child: ColorSchemeBox(
76+
backgroundColor: Colors.transparent,
77+
borderColor: scheme.primary,
78+
child: _TooltipIcon(index: i),
79+
),
80+
),
81+
title: Text(ShapeBorders.values[i].type, style: txtStyle),
82+
),
83+
),
84+
],
8785
child: ListTileReveal(
8886
enabled: enabled,
8987
contentPadding: contentPadding,

0 commit comments

Comments
 (0)