File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ that can be found in the LICENSE file. -->
17
17
18
18
- Improve how ` MediaQuery ` is being listened.
19
19
- Stop enabling drag to select when ` maxAssets == 1 ` .
20
+ - Extract ` DefaultAssetPickerProvider.init ` .
20
21
21
22
** Fixes**
22
23
Original file line number Diff line number Diff line change @@ -272,12 +272,7 @@ class DefaultAssetPickerProvider
272
272
this .filterOptions,
273
273
Duration initializeDelayDuration = const Duration (milliseconds: 250 ),
274
274
}) {
275
- Singleton .sortPathDelegate = sortPathDelegate ?? SortPathDelegate .common;
276
- // Call [getAssetList] with route duration when constructing.
277
- Future <void >.delayed (initializeDelayDuration, () async {
278
- await getPaths (onlyAll: true );
279
- await getPaths (onlyAll: false );
280
- });
275
+ init (initializeDelayDuration);
281
276
}
282
277
283
278
@visibleForTesting
@@ -311,6 +306,25 @@ class DefaultAssetPickerProvider
311
306
/// 将会与基础条件进行合并。
312
307
final PMFilter ? filterOptions;
313
308
309
+ /// Initialize the provider.
310
+ void init (Duration initializeDelayDuration) {
311
+ Singleton .sortPathDelegate = sortPathDelegate ?? SortPathDelegate .common;
312
+ // Call [getAssetList] with route duration when constructing.
313
+ Future <void >.delayed (initializeDelayDuration, () async {
314
+ if (_mounted) {
315
+ return ;
316
+ }
317
+
318
+ await getPaths (onlyAll: true );
319
+
320
+ if (_mounted) {
321
+ return ;
322
+ }
323
+
324
+ await getPaths (onlyAll: false );
325
+ });
326
+ }
327
+
314
328
@override
315
329
set currentPath (PathWrapper <AssetPathEntity >? value) {
316
330
if (value == _currentPath) {
You can’t perform that action at this time.
0 commit comments