Skip to content

Commit 6d28b67

Browse files
committed
💬 Comments update with grammar correction.
1 parent 46502a1 commit 6d28b67

10 files changed

+46
-165
lines changed

lib/src/constants/zoom_page_transition.dart

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
///
55
import 'package:flutter/material.dart';
66

7-
// Zooms and fades a new page in, zooming out the previous page. This transition
8-
// is designed to match the Android 10 activity transition.
7+
// TODO(Alex): Implement new transition after the new one released.
98
class ZoomPageTransition extends StatefulWidget {
109
const ZoomPageTransition({
1110
Key key,
@@ -14,14 +13,11 @@ class ZoomPageTransition extends StatefulWidget {
1413
this.child,
1514
}) : super(key: key);
1615

17-
// The scrim obscures the old page by becoming increasingly opaque.
1816
static final Tween<double> _scrimOpacityTween = Tween<double>(
1917
begin: 0.0,
2018
end: 0.60,
2119
);
2220

23-
// A curve sequence that is similar to the 'fastOutExtraSlowIn' curve used in
24-
// the native transition.
2521
static final List<TweenSequenceItem<double>>
2622
fastOutExtraSlowInTweenSequenceItems = <TweenSequenceItem<double>>[
2723
TweenSequenceItem<double>(
@@ -61,10 +57,6 @@ class _ZoomPageTransitionState extends State<ZoomPageTransition> {
6157
});
6258
}
6359

64-
// This check ensures that the animation reverses the original animation if
65-
// the transition were interruped midway. This prevents a disjointed
66-
// experience since the reverse animation uses different fade and scaling
67-
// curves.
6860
bool get _transitionWasInterrupted {
6961
bool wasInProgress = false;
7062
bool isInProgress = false;

lib/src/delegates/text_delegate.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/// Text delegate that controls text in widgets.
77
/// 控制部件中的文字实现
88
abstract class TextDelegate {
9-
/// Confirm string for confirm button.
9+
/// Confirm string for the confirm button.
1010
/// 确认按钮的字段
1111
String confirm;
1212

@@ -18,7 +18,7 @@ abstract class TextDelegate {
1818
/// 编辑按钮的字段
1919
String edit;
2020

21-
/// Placeholder when there's nothing can displayed in the picker.
21+
/// Placeholder when there's nothing can display in the picker.
2222
/// 选择器没有可显示的内容时的占位字段
2323
String emptyPlaceHolder;
2424

@@ -46,12 +46,12 @@ abstract class TextDelegate {
4646
/// 选择按钮的字段
4747
String select;
4848

49-
/// Un-supported asset type string for asset that belongs to [AssetType.other].
49+
/// Un-supported asset type string for assets that belongs to [AssetType.other].
5050
/// 未支持的资源类型的字段
5151
String unSupportedAssetType;
5252

53-
/// This is used in video asset item in picker, in order to display
54-
/// the duration of the video or audio type of asset.
53+
/// This is used in video asset item in the picker, in order
54+
/// to display the duration of the video or audio type of asset.
5555
/// 该字段用在选择器视频或音频部件上,用于显示视频或音频资源的时长。
5656
String durationIndicatorBuilder(Duration duration);
5757
}

lib/src/provider/asset_entity_image_provider.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class AssetEntityImageProvider extends ImageProvider<AssetEntityImageProvider> {
8080
/// 从图片后缀判断图片类型
8181
///
8282
/// ⚠ Not all the system version support read file name from the entity,
83-
/// so this method might not working sometime.
83+
/// so this method might not work sometime.
8484
/// 并非所有的系统版本都支持读取文件名,所以该方法有时无法返回正确的type。
8585
ImageFileType _getType() {
8686
ImageFileType type;

lib/src/provider/asset_picker_provider.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class AssetPickerProvider extends ChangeNotifier {
6969
super.dispose();
7070
}
7171

72-
/// Whether there's any assets on the devices.
72+
/// Whether there're any assets on the devices.
7373
/// 设备上是否有资源文件
7474
bool _isAssetsEmpty = false;
7575

@@ -83,7 +83,7 @@ class AssetPickerProvider extends ChangeNotifier {
8383
notifyListeners();
8484
}
8585

86-
/// Whether there's any assets that can be displayed.
86+
/// Whether there're any assets that can be displayed.
8787
/// 是否有资源可供显示
8888
bool _hasAssetsToDisplay = false;
8989

@@ -98,11 +98,11 @@ class AssetPickerProvider extends ChangeNotifier {
9898
notifyListeners();
9999
}
100100

101-
/// Whether there's more assets waiting for load.
101+
/// Whether there're more assets waiting for load.
102102
/// 是否还有更多资源可以加载
103103
bool get hasMoreToLoad => _currentAssets.length < _totalAssetsCount;
104104

105-
/// Current page for assets list.
105+
/// The current page for assets list.
106106
/// 当前加载的资源列表分页数
107107
int get currentAssetsListPage =>
108108
(math.max(1, _currentAssets.length) / pageSize).ceil();
@@ -122,7 +122,7 @@ class AssetPickerProvider extends ChangeNotifier {
122122
notifyListeners();
123123
}
124124

125-
/// If path switcher was opened.
125+
/// If path switcher opened.
126126
/// 是否正在进行路径选择
127127
bool _isSwitchingPath = false;
128128

@@ -200,7 +200,7 @@ class AssetPickerProvider extends ChangeNotifier {
200200
Future<void> getAssetPathList() async {
201201
final List<AssetPathEntity> _list = await PhotoManager.getAssetPathList(
202202
type: requestType,
203-
// Enable need title for audio and image to get proper display.
203+
// Enable need title for audios and image to get proper display.
204204
filterOption: FilterOptionGroup()
205205
..setOption(
206206
AssetType.audio,

lib/src/provider/asset_picker_viewer_provider.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AssetPickerViewerProvider extends ChangeNotifier {
1414
_currentlySelectedAssets = List<AssetEntity>.from(assets);
1515
}
1616

17-
/// Selected assets in viewer.
17+
/// Selected assets in the viewer.
1818
/// 查看器中已选择的资源
1919
List<AssetEntity> _currentlySelectedAssets;
2020

lib/src/widget/asset_picker.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ class AssetPicker extends StatelessWidget {
4747
/// 资源选择器状态保持
4848
final AssetPickerProvider provider;
4949

50-
/// Assets count for picker.
50+
/// Assets count for the picker.
5151
/// 资源网格数
5252
final int gridCount;
5353

54-
/// Main color for picker.
54+
/// Main color for the picker.
5555
/// 选择器的主题色
5656
final Color themeColor;
5757

5858
/// Theme for the picker.
5959
/// 选择器的主题
6060
///
61-
/// Usually the WeChat uses the dark version (dark background color) for the picker,
62-
/// but some developer wants a light theme version for some reasons.
61+
/// Usually the WeChat uses the dark version (dark background color) for the picker.
62+
/// However, some developer wants a light theme version for some reasons.
6363
/// 通常情况下微信选择器使用的是暗色(暗色背景)的主题,但某些情况下开发者需要亮色或自定义主题。
6464
final ThemeData pickerTheme;
6565

66-
/// Static method to push with navigator.
66+
/// Static method to push with the navigator.
6767
/// 跳转至选择器的静态方法
6868
static Future<List<AssetEntity>> pickAssets(
6969
BuildContext context, {
@@ -142,7 +142,7 @@ class AssetPicker extends StatelessWidget {
142142
}
143143
}
144144

145-
/// Unregister observe callback with assets changes.
145+
/// Unregister the observation callback with assets changes.
146146
/// 取消注册资源(图库)变化的监听回调
147147
static void unregisterObserve([ValueChanged<MethodCall> callback]) {
148148
try {
@@ -161,7 +161,7 @@ class AssetPicker extends StatelessWidget {
161161
/// 选择器是否为单选模式
162162
bool get isSingleAssetMode => provider.maxAssets == 1;
163163

164-
/// Space between asset item widget.
164+
/// Space between assets item widget.
165165
/// 资源部件之间的间隔
166166
double get itemSpacing => 2.0;
167167

@@ -227,7 +227,7 @@ class AssetPicker extends StatelessWidget {
227227
),
228228
);
229229

230-
/// [ThemeData] for picker.
230+
/// [ThemeData] for the picker.
231231
/// 选择器使用的主题
232232
ThemeData get theme => pickerTheme ?? themeData(themeColor);
233233

@@ -296,7 +296,7 @@ class AssetPicker extends StatelessWidget {
296296
),
297297
);
298298

299-
/// Item widget for path entity selector.
299+
/// Item widgets for path entity selector.
300300
/// 路径单独条目选择组件
301301
Widget pathEntityWidget(AssetPathEntity pathEntity) {
302302
return Material(
@@ -498,7 +498,7 @@ class AssetPicker extends StatelessWidget {
498498
/// Confirm button.
499499
/// 确认按钮
500500
///
501-
/// It'll pop with [AssetPickerProvider.selectedAssets] when there're any assets were chosen.
501+
/// It'll pop with [AssetPickerProvider.selectedAssets] when there're any assets chosen.
502502
/// 当有资源已选时,点击按钮将把已选资源通过路由返回。
503503
Widget confirmButton(BuildContext context) => Consumer<AssetPickerProvider>(
504504
builder: (BuildContext _, AssetPickerProvider provider, Widget __) {
@@ -754,7 +754,7 @@ class AssetPicker extends StatelessWidget {
754754
);
755755
}
756756

757-
/// Item widget when [AssetEntity.thumbData] load failed.
757+
/// Item widgets when [AssetEntity.thumbData] load failed.
758758
/// 资源缩略数据加载失败时使用的部件
759759
Widget get _failedItem => Center(
760760
child: Text(
@@ -820,7 +820,7 @@ class AssetPicker extends StatelessWidget {
820820
),
821821
);
822822

823-
/// Item builder for audio type of asset.
823+
/// The item builder for audio type of asset.
824824
/// 音频资源的部件构建
825825
Widget audioItemBuilder(
826826
BuildContext context,
@@ -859,7 +859,7 @@ class AssetPicker extends StatelessWidget {
859859
);
860860
}
861861

862-
/// Item builder for image and video type of asset.
862+
/// The item builder for images and video type of asset.
863863
/// 图片和视频资源的部件构建
864864
Widget imageAndVideoItemBuilder(
865865
BuildContext context,

lib/src/widget/asset_picker_viewer.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ class AssetPickerViewer extends StatefulWidget {
4848
/// 资源选择器的状态保持
4949
final AssetPickerProvider selectorProvider;
5050

51-
/// Theme for viewer.
51+
/// Theme for the viewer.
5252
/// 主题
5353
final ThemeData themeData;
5454

5555
@override
5656
AssetPickerViewerState createState() => AssetPickerViewerState();
5757

58-
/// Static method to push with navigator.
58+
/// Static method to push with the navigator.
5959
/// 跳转至选择预览的静态方法
6060
static Future<List<AssetEntity>> pushToViewer(
6161
BuildContext context, {
@@ -110,7 +110,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
110110
/// [StreamController] for viewing page index update.
111111
/// 用于更新当前正在浏览的资源页码的流控制器
112112
///
113-
/// The main purpose is to narrow down build parts when page index is changing, prevent
113+
/// The main purpose is narrow down build parts when page index is changing, prevent
114114
/// widely [setState] and causing other widgets rebuild.
115115
/// 使用 [StreamController] 的主要目的是缩小页码变化时构建组件的范围,
116116
/// 防止滥用 [setState] 导致其他部件重新构建。
@@ -145,11 +145,11 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
145145
/// 当前正在预览的资源索引
146146
int currentIndex;
147147

148-
/// Whether detail widgets is displayed.
148+
/// Whether detail widgets displayed.
149149
/// 详情部件是否显示
150150
bool isDisplayingDetail = true;
151151

152-
/// Getter for current asset.
152+
/// Getter for the current asset.
153153
/// 当前资源的Getter
154154
AssetEntity get currentAsset => widget.assets.elementAt(currentIndex);
155155

@@ -164,8 +164,8 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
164164
@override
165165
void initState() {
166166
super.initState();
167-
// TODO(Alex): Currently hide status bar will cause the viewport shaking. So commented out.
168167

168+
// TODO(Alex): Currently hide status bar will cause the viewport shaking. So commented out.
169169
/// Hide system status bar automatically on iOS.
170170
/// 在iOS设备上自动隐藏状态栏
171171
// if (Platform.isIOS) {
@@ -327,7 +327,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
327327
/// Confirm button.
328328
/// 确认按钮
329329
///
330-
/// It'll pop with [AssetPickerProvider.selectedAssets] when there're any assets were chosen.
330+
/// It'll pop with [AssetPickerProvider.selectedAssets] when there're any assets chosen.
331331
/// The [PhotoSelector] will recognize and pop too.
332332
/// 当有资源已选时,点击按钮将把已选资源通过路由返回。
333333
/// 资源选择器将识别并一同返回。
@@ -375,7 +375,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
375375
),
376376
);
377377

378-
/// Thumb item widget in bottom detail.
378+
/// Thumb item widgets in bottom detail.
379379
/// 底部信息栏单个资源缩略部件
380380
Widget _bottomDetailItem(BuildContext _, int index) {
381381
return Padding(
@@ -454,7 +454,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
454454
);
455455
}
456456

457-
/// Preview item widget for audio.
457+
/// Preview item widgets for audios.
458458
/// 音频的底部预览部件
459459
Widget _audioPreviewItem(AssetEntity asset) {
460460
return ColoredBox(
@@ -463,7 +463,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
463463
);
464464
}
465465

466-
/// Preview item widget for image.
466+
/// Preview item widgets for images.
467467
/// 音频的底部预览部件
468468
Widget _imagePreviewItem(AssetEntity asset) {
469469
return Positioned.fill(
@@ -479,7 +479,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
479479
);
480480
}
481481

482-
/// Preview item widget for video.
482+
/// Preview item widgets for video.
483483
/// 音频的底部预览部件
484484
Widget _videoPreviewItem(AssetEntity asset) {
485485
return Positioned.fill(
@@ -660,7 +660,7 @@ class AssetPickerViewerState extends State<AssetPickerViewer>
660660
),
661661
);
662662

663-
/// Item widget when [AssetEntity.thumbData] load failed.
663+
/// The item widget when [AssetEntity.thumbData] load failed.
664664
/// 资源缩略数据加载失败时使用的部件
665665
Widget get _failedItem => Center(
666666
child: Text(

lib/src/widget/builder/audio_page_builder.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class _AudioPageBuilderState extends State<AudioPageBuilder> {
3434
/// 创建一个[AssetsAudioPlayer]的实例
3535
final AssetsAudioPlayer audioPlayer = AssetsAudioPlayer();
3636

37-
/// Whether the audio is loaded.
37+
/// Whether the audio loaded.
3838
/// 音频是否已经加载完成
3939
bool isLoaded = false;
4040

@@ -67,8 +67,8 @@ class _AudioPageBuilderState extends State<AudioPageBuilder> {
6767
super.dispose();
6868
}
6969

70-
/// Using [audioPlayer] to load content url from asset.
71-
/// 使用[audioPlayer]通过content地址加载资源
70+
/// Using [audioPlayer] to load content url from the asset.
71+
/// 使用 [audioPlayer] 通过content地址加载资源
7272
Future<void> openAudioFile() async {
7373
try {
7474
assetDuration = Duration(seconds: widget.asset.duration);

lib/src/widget/builder/video_page_builder.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class VideoPageBuilder extends StatefulWidget {
2424
}
2525

2626
class _VideoPageBuilderState extends State<VideoPageBuilder> {
27-
/// Controller for video player.
27+
/// Controller for the video player.
2828
/// 视频播放的控制器
2929
VideoPlayerController _controller;
3030

@@ -56,7 +56,7 @@ class _VideoPageBuilderState extends State<VideoPageBuilder> {
5656
super.dispose();
5757
}
5858

59-
/// Get media url from asset, then initialize the controller and add with listener.
59+
/// Get media url from the asset, then initialize the controller and add with a listener.
6060
/// 从资源获取媒体url后初始化,并添加监听。
6161
Future<void> initializeVideoPlayerController() async {
6262
final String url = await widget.asset.getMediaUrl();
@@ -91,8 +91,8 @@ class _VideoPageBuilderState extends State<VideoPageBuilder> {
9191
/// Callback for the play button.
9292
/// 播放按钮的回调
9393
///
94-
/// Normally it only switch play state for the player. If the video reaches the end, then click
95-
/// the button will make the video replay.
94+
/// Normally it only switches play state for the player. If the video reaches the end,
95+
/// then click the button will make the video replay.
9696
/// 一般来说按钮只切换播放暂停。当视频播放结束时,点击按钮将从头开始播放。
9797
Future<void> playButtonCallback() async {
9898
if (_controller.value != null) {

0 commit comments

Comments
 (0)