File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -12,19 +12,22 @@ import 'package:wechat_assets_picker/wechat_assets_picker.dart';
12
12
/// [ChangeNotifier] for assets picker.
13
13
/// 资源选择器的 provider model
14
14
class AssetPickerProvider extends ChangeNotifier {
15
- /// Call [getAssetList] when constructing.
16
- /// 构造时开始获取资源
15
+ /// Call [getAssetList] with route duration when constructing.
16
+ /// 构造时根据路由时长延时获取资源
17
17
AssetPickerProvider ({
18
18
this .maxAssets = 9 ,
19
19
this .pageSize = 320 ,
20
20
this .pathThumbSize = 80 ,
21
21
this .requestType = RequestType .image,
22
22
List <AssetEntity > selectedAssets,
23
+ Duration routeDuration,
23
24
}) {
24
25
if (selectedAssets? .isNotEmpty ?? false ) {
25
26
_selectedAssets = List <AssetEntity >.from (selectedAssets);
26
27
}
27
- getAssetList ();
28
+ Future <void >.delayed (routeDuration).then (
29
+ (dynamic _) => getAssetList (),
30
+ );
28
31
}
29
32
30
33
/// Maximum count for asset selection.
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ class AssetPicker extends StatelessWidget {
64
64
Color themeColor = C .themeColor,
65
65
TextDelegate textDelegate,
66
66
Curve routeCurve = Curves .easeIn,
67
- Duration routeDuration = const Duration (milliseconds: 500 ),
67
+ Duration routeDuration = const Duration (milliseconds: 300 ),
68
68
}) async {
69
69
assert (
70
70
pageSize % gridCount == 0 || pageSize == null ,
@@ -79,6 +79,7 @@ class AssetPicker extends StatelessWidget {
79
79
pathThumbSize: pathThumbSize,
80
80
selectedAssets: selectedAssets,
81
81
requestType: requestType,
82
+ routeDuration: routeDuration,
82
83
);
83
84
final Widget picker = AssetPicker (
84
85
key: key,
You can’t perform that action at this time.
0 commit comments