Skip to content

Commit b714de7

Browse files
authored
CI: Action - Code Analysis (#559)
Provides checks for dart code analysis.
1 parent 44ad870 commit b714de7

File tree

10 files changed

+96
-55
lines changed

10 files changed

+96
-55
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout repo
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
- name: Publish
1515
uses: k-paxian/dart-package-publisher@master
1616
with:

.github/workflows/publishable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
name: Publish dry-run with packages
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121
- uses: k-paxian/dart-package-publisher@master
2222
with:
2323
credentialJson: 'MockCredentialJson'

.github/workflows/runnable.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
paths-ignore:
8+
- "**.md"
79
pull_request:
810
branches:
911
- main
@@ -18,8 +20,8 @@ jobs:
1820
matrix:
1921
os: [ ubuntu-latest ]
2022
steps:
21-
- uses: actions/checkout@v3
22-
- uses: actions/setup-java@v3
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-java@v4
2325
with:
2426
distribution: 'zulu'
2527
java-version: '17'
@@ -32,8 +34,10 @@ jobs:
3234
flutter --version
3335
- name: Prepare dependencies
3436
run: flutter pub get
35-
- name: Analyse the repo
36-
run: flutter analyze lib example/lib
37+
- name: Check Dart code formatting
38+
run: dart format . -o none --set-exit-if-changed
39+
- name: Analyze Dart code
40+
run: flutter analyze .
3741
- name: Run tests
3842
run: flutter test
3943
- name: Generate docs
@@ -46,8 +50,8 @@ jobs:
4650
name: Test iOS
4751
runs-on: macos-latest
4852
steps:
49-
- uses: actions/checkout@v3
50-
- uses: actions/setup-java@v3
53+
- uses: actions/checkout@v4
54+
- uses: actions/setup-java@v4
5155
with:
5256
distribution: 'zulu'
5357
java-version: '17'
@@ -64,8 +68,8 @@ jobs:
6468
name: Test Android
6569
runs-on: ubuntu-latest
6670
steps:
67-
- uses: actions/checkout@v3
68-
- uses: actions/setup-java@v3
71+
- uses: actions/checkout@v4
72+
- uses: actions/setup-java@v4
6973
with:
7074
distribution: 'zulu'
7175
java-version: '17'

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ that can be found in the LICENSE file. -->
77
> [!IMPORTANT]
88
> See the [Migration Guide](guides/migration_guide.md) for the details of breaking changes between versions.
99
10+
## 9.0.1
11+
12+
### Improvements
13+
14+
- Improve code formatting.
15+
1016
## 9.0.0
1117

1218
### Breaking changes

example/l10n.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
arb-dir: lib/l10n
2-
# format: true
2+
format: true
33
output-class: AppLocalizations
44
output-dir: lib/l10n/gen
55
output-localization-file: app_localizations.dart

example/lib/l10n/gen/app_localizations.dart

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ import 'app_localizations_zh.dart';
6060
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
6161
/// property.
6262
abstract class AppLocalizations {
63-
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
63+
AppLocalizations(String locale)
64+
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
6465

6566
final String localeName;
6667

6768
static AppLocalizations? of(BuildContext context) {
6869
return Localizations.of<AppLocalizations>(context, AppLocalizations);
6970
}
7071

71-
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
72+
static const LocalizationsDelegate<AppLocalizations> delegate =
73+
_AppLocalizationsDelegate();
7274

7375
/// A list of this localizations delegate along with the default localizations
7476
/// delegates.
@@ -80,7 +82,8 @@ abstract class AppLocalizations {
8082
/// Additional delegates can be added by appending to this list in
8183
/// MaterialApp. This list does not have to be used at all if a custom list
8284
/// of delegates is preferred or required.
83-
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
85+
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
86+
<LocalizationsDelegate<dynamic>>[
8487
delegate,
8588
GlobalMaterialLocalizations.delegate,
8689
GlobalCupertinoLocalizations.delegate,
@@ -412,7 +415,8 @@ abstract class AppLocalizations {
412415
String get customPickerInstagramLayoutDescription;
413416
}
414417

415-
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
418+
class _AppLocalizationsDelegate
419+
extends LocalizationsDelegate<AppLocalizations> {
416420
const _AppLocalizationsDelegate();
417421

418422
@override
@@ -421,25 +425,25 @@ class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations>
421425
}
422426

423427
@override
424-
bool isSupported(Locale locale) => <String>['en', 'zh'].contains(locale.languageCode);
428+
bool isSupported(Locale locale) =>
429+
<String>['en', 'zh'].contains(locale.languageCode);
425430

426431
@override
427432
bool shouldReload(_AppLocalizationsDelegate old) => false;
428433
}
429434

430435
AppLocalizations lookupAppLocalizations(Locale locale) {
431-
432-
433436
// Lookup logic when only language code is specified.
434437
switch (locale.languageCode) {
435-
case 'en': return AppLocalizationsEn();
436-
case 'zh': return AppLocalizationsZh();
438+
case 'en':
439+
return AppLocalizationsEn();
440+
case 'zh':
441+
return AppLocalizationsZh();
437442
}
438443

439444
throw FlutterError(
440-
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
441-
'an issue with the localizations generation tool. Please file an issue '
442-
'on GitHub with a reproducible sample app and the gen-l10n configuration '
443-
'that was used.'
444-
);
445+
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
446+
'an issue with the localizations generation tool. Please file an issue '
447+
'on GitHub with a reproducible sample app and the gen-l10n configuration '
448+
'that was used.');
445449
}

example/lib/l10n/gen/app_localizations_en.dart

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class AppLocalizationsEn extends AppLocalizations {
4242
String get pickMethodVideoName => 'Video picker';
4343

4444
@override
45-
String get pickMethodVideoDescription => 'Only pick video from device. (Includes Live Photos on iOS and macOS.)';
45+
String get pickMethodVideoDescription =>
46+
'Only pick video from device. (Includes Live Photos on iOS and macOS.)';
4647

4748
@override
4849
String get pickMethodAudioName => 'Audio picker';
@@ -54,13 +55,15 @@ class AppLocalizationsEn extends AppLocalizations {
5455
String get pickMethodCameraName => 'Pick from camera';
5556

5657
@override
57-
String get pickMethodCameraDescription => 'Allow to pick an asset through camera.';
58+
String get pickMethodCameraDescription =>
59+
'Allow to pick an asset through camera.';
5860

5961
@override
6062
String get pickMethodCameraAndStayName => 'Pick from camera and stay';
6163

6264
@override
63-
String get pickMethodCameraAndStayDescription => 'Take a photo or video with the camera picker, select the result and stay in the entities list.';
65+
String get pickMethodCameraAndStayDescription =>
66+
'Take a photo or video with the camera picker, select the result and stay in the entities list.';
6467

6568
@override
6669
String get pickMethodCommonName => 'Common picker';
@@ -72,49 +75,58 @@ class AppLocalizationsEn extends AppLocalizations {
7275
String get pickMethodThreeItemsGridName => '3 items grid';
7376

7477
@override
75-
String get pickMethodThreeItemsGridDescription => 'Picker will served as 3 items on cross axis. (pageSize must be a multiple of the gridCount)';
78+
String get pickMethodThreeItemsGridDescription =>
79+
'Picker will served as 3 items on cross axis. (pageSize must be a multiple of the gridCount)';
7680

7781
@override
7882
String get pickMethodCustomFilterOptionsName => 'Custom filter options';
7983

8084
@override
81-
String get pickMethodCustomFilterOptionsDescription => 'Add filter options for the picker.';
85+
String get pickMethodCustomFilterOptionsDescription =>
86+
'Add filter options for the picker.';
8287

8388
@override
8489
String get pickMethodPrependItemName => 'Prepend special item';
8590

8691
@override
87-
String get pickMethodPrependItemDescription => 'A special item will prepend to the assets grid.';
92+
String get pickMethodPrependItemDescription =>
93+
'A special item will prepend to the assets grid.';
8894

8995
@override
9096
String get pickMethodNoPreviewName => 'No preview';
9197

9298
@override
93-
String get pickMethodNoPreviewDescription => 'You cannot preview assets during the picking, the behavior is like the WhatsApp/MegaTok pattern.';
99+
String get pickMethodNoPreviewDescription =>
100+
'You cannot preview assets during the picking, the behavior is like the WhatsApp/MegaTok pattern.';
94101

95102
@override
96103
String get pickMethodKeepScrollOffsetName => 'Keep scroll offset';
97104

98105
@override
99-
String get pickMethodKeepScrollOffsetDescription => 'Pick assets from same scroll position.';
106+
String get pickMethodKeepScrollOffsetDescription =>
107+
'Pick assets from same scroll position.';
100108

101109
@override
102110
String get pickMethodChangeLanguagesName => 'Change Languages';
103111

104112
@override
105-
String get pickMethodChangeLanguagesDescription => 'Pass AssetPickerTextDelegate to change between languages (e.g. EnglishAssetPickerTextDelegate).';
113+
String get pickMethodChangeLanguagesDescription =>
114+
'Pass AssetPickerTextDelegate to change between languages (e.g. EnglishAssetPickerTextDelegate).';
106115

107116
@override
108117
String get pickMethodPreventGIFPickedName => 'Prevent GIF being picked';
109118

110119
@override
111-
String get pickMethodPreventGIFPickedDescription => 'Use selectPredicate to banned GIF picking when tapped.';
120+
String get pickMethodPreventGIFPickedDescription =>
121+
'Use selectPredicate to banned GIF picking when tapped.';
112122

113123
@override
114-
String get pickMethodCustomizableThemeName => 'Customizable theme (ThemeData)';
124+
String get pickMethodCustomizableThemeName =>
125+
'Customizable theme (ThemeData)';
115126

116127
@override
117-
String get pickMethodCustomizableThemeDescription => 'Picking assets with the light theme or with a different color.';
128+
String get pickMethodCustomizableThemeDescription =>
129+
'Picking assets with the light theme or with a different color.';
118130

119131
@override
120132
String get pickMethodPathNameBuilderName => 'Path name builder';
@@ -126,16 +138,20 @@ class AppLocalizationsEn extends AppLocalizations {
126138
String get pickMethodWeChatMomentName => 'WeChat Moment';
127139

128140
@override
129-
String get pickMethodWeChatMomentDescription => 'Pick assets with images or only 1 video.';
141+
String get pickMethodWeChatMomentDescription =>
142+
'Pick assets with images or only 1 video.';
130143

131144
@override
132-
String get pickMethodCustomImagePreviewThumbSizeName => 'Custom image preview thumb size';
145+
String get pickMethodCustomImagePreviewThumbSizeName =>
146+
'Custom image preview thumb size';
133147

134148
@override
135-
String get pickMethodCustomImagePreviewThumbSizeDescription => 'You can reduce the thumb size to get faster load speed.';
149+
String get pickMethodCustomImagePreviewThumbSizeDescription =>
150+
'You can reduce the thumb size to get faster load speed.';
136151

137152
@override
138-
String get customPickerNotice => 'This page contains customized pickers with different asset types, different UI layouts, or some use case for specific apps. Contribute to add your custom picker are welcomed.\nPickers in this page are located at the lib/customs/pickers folder.';
153+
String get customPickerNotice =>
154+
'This page contains customized pickers with different asset types, different UI layouts, or some use case for specific apps. Contribute to add your custom picker are welcomed.\nPickers in this page are located at the lib/customs/pickers folder.';
139155

140156
@override
141157
String get customPickerCallThePickerButton => '🎁 Call the Picker';
@@ -144,13 +160,15 @@ class AppLocalizationsEn extends AppLocalizations {
144160
String get customPickerDirectoryAndFileName => 'Directory+File picker';
145161

146162
@override
147-
String get customPickerDirectoryAndFileDescription => 'This is a custom picker built for `File`.\nBy browsing this picker, we want you to know that you can build your own picker components using the entity\'s type you desired.\n\nIn this page, picker will grab files from `getApplicationDocumentsDirectory`, then check whether it contains images. Put files into the path to see how this custom picker work.';
163+
String get customPickerDirectoryAndFileDescription =>
164+
'This is a custom picker built for `File`.\nBy browsing this picker, we want you to know that you can build your own picker components using the entity\'s type you desired.\n\nIn this page, picker will grab files from `getApplicationDocumentsDirectory`, then check whether it contains images. Put files into the path to see how this custom picker work.';
148165

149166
@override
150167
String get customPickerMultiTabName => 'Multi tab picker';
151168

152169
@override
153-
String get customPickerMultiTabDescription => 'The picker contains multiple tab with different types of assets for the picking at the same time.';
170+
String get customPickerMultiTabDescription =>
171+
'The picker contains multiple tab with different types of assets for the picking at the same time.';
154172

155173
@override
156174
String get customPickerMultiTabTab1 => 'All';
@@ -165,5 +183,6 @@ class AppLocalizationsEn extends AppLocalizations {
165183
String get customPickerInstagramLayoutName => 'Instagram layout picker';
166184

167185
@override
168-
String get customPickerInstagramLayoutDescription => 'The picker reproduces Instagram layout with preview and scroll animations. It\'s also published as the package insta_assets_picker.';
186+
String get customPickerInstagramLayoutDescription =>
187+
'The picker reproduces Instagram layout with preview and scroll animations. It\'s also published as the package insta_assets_picker.';
169188
}

example/lib/l10n/gen/app_localizations_zh.dart

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ class AppLocalizationsZh extends AppLocalizations {
7272
String get pickMethodThreeItemsGridName => '横向 3 格';
7373

7474
@override
75-
String get pickMethodThreeItemsGridDescription => '选择器每行为 3 格。(pageSize 必须为 gridCount 的倍数)';
75+
String get pickMethodThreeItemsGridDescription =>
76+
'选择器每行为 3 格。(pageSize 必须为 gridCount 的倍数)';
7677

7778
@override
7879
String get pickMethodCustomFilterOptionsName => '自定义过滤条件';
@@ -90,7 +91,8 @@ class AppLocalizationsZh extends AppLocalizations {
9091
String get pickMethodNoPreviewName => '禁止预览';
9192

9293
@override
93-
String get pickMethodNoPreviewDescription => '无法预览选择的资源,与 WhatsApp/MegaTok 的行为类似。';
94+
String get pickMethodNoPreviewDescription =>
95+
'无法预览选择的资源,与 WhatsApp/MegaTok 的行为类似。';
9496

9597
@override
9698
String get pickMethodKeepScrollOffsetName => '保持滚动位置';
@@ -102,13 +104,15 @@ class AppLocalizationsZh extends AppLocalizations {
102104
String get pickMethodChangeLanguagesName => '更改语言';
103105

104106
@override
105-
String get pickMethodChangeLanguagesDescription => '传入 AssetPickerTextDelegate 手动更改选择器的语言(例如 EnglishAssetPickerTextDelegate)。';
107+
String get pickMethodChangeLanguagesDescription =>
108+
'传入 AssetPickerTextDelegate 手动更改选择器的语言(例如 EnglishAssetPickerTextDelegate)。';
106109

107110
@override
108111
String get pickMethodPreventGIFPickedName => '禁止选择 GIF 图片';
109112

110113
@override
111-
String get pickMethodPreventGIFPickedDescription => '通过 selectPredicate 来禁止 GIF 图片在点击时被选择。';
114+
String get pickMethodPreventGIFPickedDescription =>
115+
'通过 selectPredicate 来禁止 GIF 图片在点击时被选择。';
112116

113117
@override
114118
String get pickMethodCustomizableThemeName => '自定义主题 (ThemeData)';
@@ -132,10 +136,12 @@ class AppLocalizationsZh extends AppLocalizations {
132136
String get pickMethodCustomImagePreviewThumbSizeName => '自定义图片预览的缩略图大小';
133137

134138
@override
135-
String get pickMethodCustomImagePreviewThumbSizeDescription => '通过降低缩略图的质量来获得更快的加载速度。';
139+
String get pickMethodCustomImagePreviewThumbSizeDescription =>
140+
'通过降低缩略图的质量来获得更快的加载速度。';
136141

137142
@override
138-
String get customPickerNotice => '本页面包含了多种方式、不同界面和特定应用的自定义选择器。欢迎贡献添加你自定义的选择器。\n该页面的所有选择器的代码位于 lib/customs/pickers 目录。';
143+
String get customPickerNotice =>
144+
'本页面包含了多种方式、不同界面和特定应用的自定义选择器。欢迎贡献添加你自定义的选择器。\n该页面的所有选择器的代码位于 lib/customs/pickers 目录。';
139145

140146
@override
141147
String get customPickerCallThePickerButton => '🎁 开始选择资源';
@@ -144,13 +150,15 @@ class AppLocalizationsZh extends AppLocalizations {
144150
String get customPickerDirectoryAndFileName => 'Directory+File 选择器';
145151

146152
@override
147-
String get customPickerDirectoryAndFileDescription => '为 `File` 构建的自定义选择器。\n通过阅读该选择器的源码,你可以学习如何完全以你自定义的资源类型来构建并选择器的界面。\n\n该选择器会从 `getApplicationDocumentsDirectory` 目录获取资源,然后检查它是否包含图片。你需要将图片放在该目录来查看选择器的效果。';
153+
String get customPickerDirectoryAndFileDescription =>
154+
'为 `File` 构建的自定义选择器。\n通过阅读该选择器的源码,你可以学习如何完全以你自定义的资源类型来构建并选择器的界面。\n\n该选择器会从 `getApplicationDocumentsDirectory` 目录获取资源,然后检查它是否包含图片。你需要将图片放在该目录来查看选择器的效果。';
148155

149156
@override
150157
String get customPickerMultiTabName => '多 Tab 选择器';
151158

152159
@override
153-
String get customPickerMultiTabDescription => '该选择器会以多 Tab 的形式同时展示多种资源类型的选择器。';
160+
String get customPickerMultiTabDescription =>
161+
'该选择器会以多 Tab 的形式同时展示多种资源类型的选择器。';
154162

155163
@override
156164
String get customPickerMultiTabTab1 => '全部';
@@ -165,5 +173,6 @@ class AppLocalizationsZh extends AppLocalizations {
165173
String get customPickerInstagramLayoutName => 'Instagram 布局的选择器';
166174

167175
@override
168-
String get customPickerInstagramLayoutDescription => '该选择器以 Instagram 的布局模式构建,在选择时可以同时预览。其已发布为单独的 package:insta_assets_picker。';
176+
String get customPickerInstagramLayoutDescription =>
177+
'该选择器以 Instagram 的布局模式构建,在选择时可以同时预览。其已发布为单独的 package:insta_assets_picker。';
169178
}

lib/src/delegates/asset_picker_text_delegate.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,4 +1127,3 @@ class KoreanAssetPickerTextDelegate extends AssetPickerTextDelegate {
11271127
@override
11281128
String get sUnitAssetCountLabel => '개';
11291129
}
1130-

0 commit comments

Comments
 (0)