Skip to content

Commit 4261bd2

Browse files
committed
🎨 Format Dart files
1 parent 581343b commit 4261bd2

File tree

8 files changed

+37
-48
lines changed

8 files changed

+37
-48
lines changed

‎analysis_options.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ analyzer:
1010
unnecessary_import: error
1111
unawaited_futures: error
1212

13+
formatter:
14+
trailing_commas: preserve
15+
1316
linter:
1417
rules:
1518
# always_use_package_imports: true

‎packages/core/lib/utils/color.dart‎

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,26 @@ Map<int, String> accentSwatchFromPrimaryHex(String primaryHex) {
4040
final baseDark = primary * primary;
4141
final baseTriad = primary.tetrad();
4242
return {
43-
100:
44-
_mix(baseDark, baseTriad[3], 15).saturate(80).lighten(48).toHexString(),
45-
200:
46-
_mix(baseDark, baseTriad[3], 15).saturate(80).lighten(36).toHexString(),
47-
400: _mix(baseDark, baseTriad[3], 15)
48-
.saturate(100)
49-
.lighten(31)
50-
.toHexString(),
51-
700: _mix(baseDark, baseTriad[3], 15)
52-
.saturate(100)
53-
.lighten(28)
54-
.toHexString(),
43+
100: _mix(
44+
baseDark,
45+
baseTriad[3],
46+
15,
47+
).saturate(80).lighten(48).toHexString(),
48+
200: _mix(
49+
baseDark,
50+
baseTriad[3],
51+
15,
52+
).saturate(80).lighten(36).toHexString(),
53+
400: _mix(
54+
baseDark,
55+
baseTriad[3],
56+
15,
57+
).saturate(100).lighten(31).toHexString(),
58+
700: _mix(
59+
baseDark,
60+
baseTriad[3],
61+
15,
62+
).saturate(100).lighten(28).toHexString(),
5563
};
5664
}
5765

@@ -98,11 +106,7 @@ extension _ColorExt on Color {
98106
}
99107

100108
// https://github.com/bgrins/TinyColor/blob/96592a5cacdbf4d4d16cd7d39d4d6dd28da9bd5f/tinycolor.js#L701
101-
Color _mix(
102-
Color color1,
103-
Color color2,
104-
int amount,
105-
) {
109+
Color _mix(Color color1, Color color2, int amount) {
106110
assert(amount >= 0 && amount <= 100);
107111
final p = amount / 100;
108112
final c1 = color1.toRgbColor();

‎packages/core/lib/utils/string.dart‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@ String camelCase(String s) => s.camelCase();
2121
String snakeCase(String s) => s.snakeCase();
2222

2323
List<String> _intoWords(String path) {
24-
const symbols = [
25-
' ',
26-
'.',
27-
'/',
28-
'_',
29-
r'\',
30-
'-',
31-
'@',
32-
];
24+
const symbols = [' ', '.', '/', '_', r'\', '-', '@'];
3325
final upperAlphaRegex = RegExp(r'[A-Z]');
3426
final lowerAlphaRegex = RegExp(r'[a-z]');
3527
final buffer = StringBuffer();

‎packages/core/pubspec.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
meta: ^1.7.0
1717
path: ^1.8.0
1818
yaml: ^3.0.0
19-
mime: ">=1.0.0 <3.0.0"
19+
mime: '>=1.0.0 <3.0.0'
2020
xml: ^6.0.0
2121
dartx: ^1.0.0
2222
color: ^3.0.0
@@ -26,7 +26,7 @@ dependencies:
2626
logging: ^1.3.0
2727

2828
dart_style: ^3.0.0
29-
archive: ">=3.4.0 <5.0.0"
29+
archive: '>=3.4.0 <5.0.0'
3030
args: ^2.0.0
3131
pub_semver: ^2.0.0
3232
vector_graphics_compiler: ^1.1.9

‎packages/core/scripts/generate_facts.dart‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ late final Directory dir;
88

99
void main() async {
1010
dir = File.fromUri(Platform.script).parent.parent.directory('test_resources');
11-
final configFiles =
12-
dir.listSync().whereType<File>().where((e) => e.extension == '.yaml');
11+
final configFiles = dir.listSync().whereType<File>().where(
12+
(e) => e.extension == '.yaml',
13+
);
1314
for (final file in configFiles) {
1415
final File pubspecFile;
1516
final File? buildFile;

‎packages/core/test/assets_gen_integrations_test.dart‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@ void main() {
234234

235235
final integrationWithPackage = RiveIntegration('package_name');
236236
expect(
237-
integrationWithPackage.classOutput
238-
.contains('\'packages/package_name/\$_assetName\','),
237+
integrationWithPackage.classOutput.contains(
238+
'\'packages/package_name/\$_assetName\',',
239+
),
239240
isTrue,
240241
);
241242
});

‎packages/core/test/assets_gen_test.dart‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ void main() {
6565
"@Deprecated('Do not specify package for a generated library asset')",
6666
),
6767
);
68-
expect(
69-
content,
70-
contains('String? package = package,'),
71-
);
68+
expect(content, contains('String? package = package,'));
7269
});
7370

7471
test('Assets with directory path enabled', () async {

‎packages/core/test/gen_test_helper.dart‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ Future<(String, String)> expectedAssetsGen(
8181
build: build,
8282
);
8383
final (actual, expected) = results;
84-
expect(
85-
generated.readAsStringSync(),
86-
isNotEmpty,
87-
);
84+
expect(generated.readAsStringSync(), isNotEmpty);
8885
expect(actual, expected);
8986
return (actual, expected);
9087
}
@@ -163,10 +160,7 @@ Future<(String, String)> runFontsGen(
163160
final config = loadPubspecConfig(pubspecFile, buildFile: buildFile);
164161
final formatter = buildDartFormatterFromConfig(config);
165162

166-
final actual = generateFonts(
167-
FontsGenConfig.fromConfig(config),
168-
formatter,
169-
);
163+
final actual = generateFonts(FontsGenConfig.fromConfig(config), formatter);
170164
final expected = formatter.format(File(fact).readAsStringSync());
171165
return (actual, expected);
172166
}
@@ -189,10 +183,7 @@ Future<(String, String)> expectedFontsGen(
189183
}
190184

191185
/// Verify generated package name.
192-
String? expectedPackageNameGen(
193-
String pubspec,
194-
String? fact,
195-
) {
186+
String? expectedPackageNameGen(String pubspec, String? fact) {
196187
final pubspecFile = File(pubspec);
197188
final config = AssetsGenConfig.fromConfig(
198189
pubspecFile,

0 commit comments

Comments
 (0)