Skip to content

Commit 9caea36

Browse files
committed
🧑‍💻 Add more comments and notices
1 parent 8202233 commit 9caea36

10 files changed

+48
-17
lines changed

README-ZH.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,9 @@ Future<dio.MultipartFile> multipartFileFromAssetEntity(AssetEntity entity) async
433433
更多用法请查看示例中的 `Custom` 页面,
434434
该页面包含一个以 `<File, Directory>` 为类型基础的选择器。
435435

436-
你可以在「Custom」页面尝试自定义的选择器。
437-
目前我们提供了一个基于 `Directory``File`
438-
(与 `photo_manager` 完全无关)实现的选择器,
439-
以及一个多 Tab 页切换的选择器。
436+
想要了解如何完全自定义主题、widget 和布局,前往 [示例](example/lib/customs/pickers)
437+
查看已有的自定义选择器的实现。
438+
440439
如果你觉得你的实现有价值或能帮助到其他人,欢迎以 PR 的形式进行提交。
441440
更多细节请阅读 [贡献自定义实现][]
442441

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,10 @@ You can extend them and use your own
448448
type with generic type `<A: Asset, P: Path>`,
449449
then implement abstract methods.
450450

451-
We've defined a picker that integrates with `Directory` and `File`
452-
(completely out of the `photo_manager` scope),
453-
and a picker with multiple tabs switching in the "Custom" page.
451+
To know about how to fully customize themes, widgets or layouts.
452+
See how to customize delegates in the custom pickers page in the
453+
[example](example/lib/customs/pickers).
454+
454455
You can submit PRs to create your own implementation
455456
if you found your implementation might be useful for others.
456457
See [Contribute custom implementations][] for more details.

example/lib/l10n/app_en.arb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"navSingle": "Single",
88
"navCustom": "Custom",
99
"selectedAssetsText": "Selected Assets",
10+
"pickMethodNotice": "Pickers in this page are located at the {dist}, defined by `pickMethods`.",
1011
"pickMethodImageName": "Image picker",
1112
"pickMethodImageDescription": "Only pick image from device.",
1213
"pickMethodVideoName": "Video picker",
@@ -33,15 +34,15 @@
3334
"pickMethodChangeLanguagesDescription": "Pass AssetPickerTextDelegate to change between languages (e.g. EnglishAssetPickerTextDelegate).",
3435
"pickMethodPreventGIFPickedName": "Prevent GIF being picked",
3536
"pickMethodPreventGIFPickedDescription": "Use selectPredicate to banned GIF picking when tapped.",
36-
"pickMethodCustomizableThemeName": "Customizable theme",
37+
"pickMethodCustomizableThemeName": "Customizable theme (ThemeData)",
3738
"pickMethodCustomizableThemeDescription": "Picking assets with the light theme or with a different color.",
3839
"pickMethodPathNameBuilderName": "Path name builder",
3940
"pickMethodPathNameBuilderDescription": "Add \uD83C\uDF6D after paths name.",
4041
"pickMethodWeChatMomentName": "WeChat Moment",
4142
"pickMethodWeChatMomentDescription": "Pick assets with images or only 1 video.",
4243
"pickMethodCustomImagePreviewThumbSizeName": "Custom image preview thumb size",
4344
"pickMethodCustomImagePreviewThumbSizeDescription": "You can reduce the thumb size to get faster load speed.",
44-
"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.",
45+
"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.",
4546
"customPickerCallThePickerButton": "\uD83C\uDF81 Call the Picker",
4647
"customPickerDirectoryAndFileName": "Directory+File picker",
4748
"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 `getExternalStorageDirectory`, then check whether it contains images. Put files into the path to see how this custom picker work.",

example/lib/l10n/app_zh.arb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"navSingle": "单选",
88
"navCustom": "自定义",
99
"selectedAssetsText": "已选的资源",
10+
"pickMethodNotice": "该页面的所有选择器的代码位于 {dist},由 `pickMethods` 定义。",
1011
"pickMethodCommonName": "常用选择",
1112
"pickMethodCommonDescription": "选择图片和视频。",
1213
"pickMethodImageName": "图片选择",
@@ -33,15 +34,15 @@
3334
"pickMethodChangeLanguagesDescription": "传入 AssetPickerTextDelegate 手动更改选择器的语言(例如 EnglishAssetPickerTextDelegate)。",
3435
"pickMethodPreventGIFPickedName": "禁止选择 GIF 图片",
3536
"pickMethodPreventGIFPickedDescription": "通过 selectPredicate 来禁止 GIF 图片在点击时被选择。",
36-
"pickMethodCustomizableThemeName": "自定义主题",
37+
"pickMethodCustomizableThemeName": "自定义主题 (ThemeData)",
3738
"pickMethodCustomizableThemeDescription": "可以用亮色或其他颜色及自定义的主题进行选择。",
3839
"pickMethodPathNameBuilderName": "构建路径名称",
3940
"pickMethodPathNameBuilderDescription": "在路径后添加 \uD83C\uDF6D 进行自定义。",
4041
"pickMethodWeChatMomentName": "微信朋友圈模式",
4142
"pickMethodWeChatMomentDescription": "允许选择图片或仅 1 个视频。",
4243
"pickMethodCustomImagePreviewThumbSizeName": "自定义图片预览的缩略图大小",
4344
"pickMethodCustomImagePreviewThumbSizeDescription": "通过降低缩略图的质量来获得更快的加载速度。",
44-
"customPickerNotice": "本页面包含了多种方式、不同界面和特定应用的自定义选择器。欢迎贡献添加你自定义的选择器。",
45+
"customPickerNotice": "本页面包含了多种方式、不同界面和特定应用的自定义选择器。欢迎贡献添加你自定义的选择器。\n该页面的所有选择器的代码位于 lib/customs/pickers 目录。",
4546
"customPickerCallThePickerButton": "\uD83C\uDF81 开始选择资源",
4647
"customPickerDirectoryAndFileName": "Directory+File 选择器",
4748
"customPickerDirectoryAndFileDescription": "为 `File` 构建的自定义选择器。\n通过阅读该选择器的源码,你可以学习如何完全以你自定义的资源类型来构建并选择器的界面。\n\n该选择器会从 `getExternalStorageDirectory` 目录获取资源,然后检查它是否包含图片。你需要将图片放在该目录来查看选择器的效果。",

example/lib/l10n/gen/app_localizations.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ abstract class AppLocalizations {
135135
/// **'Selected Assets'**
136136
String get selectedAssetsText;
137137

138+
/// No description provided for @pickMethodNotice.
139+
///
140+
/// In en, this message translates to:
141+
/// **'Pickers in this page are located at the {dist}, defined by `pickMethods`.'**
142+
String pickMethodNotice(Object dist);
143+
138144
/// No description provided for @pickMethodImageName.
139145
///
140146
/// In en, this message translates to:
@@ -294,7 +300,7 @@ abstract class AppLocalizations {
294300
/// No description provided for @pickMethodCustomizableThemeName.
295301
///
296302
/// In en, this message translates to:
297-
/// **'Customizable theme'**
303+
/// **'Customizable theme (ThemeData)'**
298304
String get pickMethodCustomizableThemeName;
299305

300306
/// No description provided for @pickMethodCustomizableThemeDescription.
@@ -342,7 +348,7 @@ abstract class AppLocalizations {
342348
/// No description provided for @customPickerNotice.
343349
///
344350
/// In en, this message translates to:
345-
/// **'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.'**
351+
/// **'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.'**
346352
String get customPickerNotice;
347353

348354
/// No description provided for @customPickerCallThePickerButton.

example/lib/l10n/gen/app_localizations_en.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class AppLocalizationsEn extends AppLocalizations {
2727
@override
2828
String get selectedAssetsText => 'Selected Assets';
2929

30+
@override
31+
String pickMethodNotice(Object dist) {
32+
return 'Pickers in this page are located at the $dist, defined by `pickMethods`.';
33+
}
34+
3035
@override
3136
String get pickMethodImageName => 'Image picker';
3237

@@ -106,7 +111,7 @@ class AppLocalizationsEn extends AppLocalizations {
106111
String get pickMethodPreventGIFPickedDescription => 'Use selectPredicate to banned GIF picking when tapped.';
107112

108113
@override
109-
String get pickMethodCustomizableThemeName => 'Customizable theme';
114+
String get pickMethodCustomizableThemeName => 'Customizable theme (ThemeData)';
110115

111116
@override
112117
String get pickMethodCustomizableThemeDescription => 'Picking assets with the light theme or with a different color.';
@@ -130,7 +135,7 @@ class AppLocalizationsEn extends AppLocalizations {
130135
String get pickMethodCustomImagePreviewThumbSizeDescription => 'You can reduce the thumb size to get faster load speed.';
131136

132137
@override
133-
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.';
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.';
134139

135140
@override
136141
String get customPickerCallThePickerButton => '🎁 Call the Picker';

example/lib/l10n/gen/app_localizations_zh.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class AppLocalizationsZh extends AppLocalizations {
2727
@override
2828
String get selectedAssetsText => '已选的资源';
2929

30+
@override
31+
String pickMethodNotice(Object dist) {
32+
return '该页面的所有选择器的代码位于 $dist,由 `pickMethods` 定义。';
33+
}
34+
3035
@override
3136
String get pickMethodImageName => '图片选择';
3237

@@ -106,7 +111,7 @@ class AppLocalizationsZh extends AppLocalizations {
106111
String get pickMethodPreventGIFPickedDescription => '通过 selectPredicate 来禁止 GIF 图片在点击时被选择。';
107112

108113
@override
109-
String get pickMethodCustomizableThemeName => '自定义主题';
114+
String get pickMethodCustomizableThemeName => '自定义主题 (ThemeData)';
110115

111116
@override
112117
String get pickMethodCustomizableThemeDescription => '可以用亮色或其他颜色及自定义的主题进行选择。';
@@ -130,7 +135,7 @@ class AppLocalizationsZh extends AppLocalizations {
130135
String get pickMethodCustomImagePreviewThumbSizeDescription => '通过降低缩略图的质量来获得更快的加载速度。';
131136

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

135140
@override
136141
String get customPickerCallThePickerButton => '🎁 开始选择资源';

example/lib/pages/multi_assets_page.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class MultiAssetsPage extends StatefulWidget {
1818

1919
class _MultiAssetsPageState extends State<MultiAssetsPage>
2020
with AutomaticKeepAliveClientMixin, ExamplePageMixin {
21+
@override
22+
String get noticeText => 'lib/pages/multi_assets_page.dart';
23+
2124
@override
2225
int get maxAssetsCount => 9;
2326

example/lib/pages/page_mixin.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:wechat_assets_picker/wechat_assets_picker.dart'
99
DefaultAssetPickerProvider,
1010
DefaultAssetPickerBuilderDelegate;
1111

12+
import '../constants/extensions.dart';
1213
import '../constants/picker_method.dart';
1314
import '../widgets/method_list_view.dart';
1415
import '../widgets/selected_assets_list_view.dart';
@@ -31,6 +32,8 @@ mixin ExamplePageMixin<T extends StatefulWidget> on State<T> {
3132

3233
List<PickMethod> pickMethods(BuildContext context);
3334

35+
String get noticeText;
36+
3437
/// These fields are for the keep scroll position feature.
3538
late DefaultAssetPickerProvider keepScrollProvider =
3639
DefaultAssetPickerProvider();
@@ -69,6 +72,10 @@ mixin ExamplePageMixin<T extends StatefulWidget> on State<T> {
6972
super.build(context);
7073
return Column(
7174
children: <Widget>[
75+
Padding(
76+
padding: const EdgeInsets.all(20.0),
77+
child: Text(context.l10n.pickMethodNotice(noticeText)),
78+
),
7279
Expanded(
7380
child: MethodListView(
7481
pickMethods: pickMethods(context),

example/lib/pages/single_assets_page.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class SingleAssetPage extends StatefulWidget {
1818

1919
class _SingleAssetPageState extends State<SingleAssetPage>
2020
with AutomaticKeepAliveClientMixin, ExamplePageMixin {
21+
@override
22+
String get noticeText => 'lib/pages/single_assets_page.dart';
23+
2124
@override
2225
int get maxAssetsCount => 1;
2326

0 commit comments

Comments
 (0)