@@ -359,6 +359,16 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
359
359
/// Android设备的选择器布局
360
360
Widget androidLayout (BuildContext context);
361
361
362
+ /// Loading indicator.
363
+ /// 加载指示器
364
+ ///
365
+ /// Subclasses need to implement this due to the generic type limitation, and
366
+ /// not all delegates use [AssetPickerProvider] .
367
+ ///
368
+ /// See also:
369
+ /// - [DefaultAssetPickerBuilderDelegate.loadingIndicator] as an example.
370
+ Widget loadingIndicator (BuildContext context);
371
+
362
372
/// GIF image type indicator.
363
373
/// GIF 类型图片指示
364
374
Widget gifIndicator (BuildContext context, Asset asset) {
@@ -424,24 +434,6 @@ abstract class AssetPickerBuilderDelegate<Asset, Path> {
424
434
);
425
435
}
426
436
427
- /// Loading indicator.
428
- /// 加载指示器
429
- Widget loadingIndicator (BuildContext context) {
430
- return Selector <AssetPickerProvider <Asset , Path >, bool >(
431
- selector: (_, AssetPickerProvider <Asset , Path > p) => p.isAssetsEmpty,
432
- builder: (BuildContext context, bool isAssetsEmpty, Widget ? w) {
433
- if (loadingIndicatorBuilder != null ) {
434
- return loadingIndicatorBuilder !(context, isAssetsEmpty);
435
- }
436
- return Center (child: isAssetsEmpty ? emptyIndicator (context) : w);
437
- },
438
- child: PlatformProgressIndicator (
439
- color: theme.iconTheme.color,
440
- size: context.mediaQuery.size.width / gridCount / 3 ,
441
- ),
442
- );
443
- }
444
-
445
437
/// Item widgets when the thumb data load failed.
446
438
/// 资源缩略数据加载失败时使用的部件
447
439
Widget failedItemBuilder (BuildContext context) {
@@ -1018,6 +1010,23 @@ class DefaultAssetPickerBuilderDelegate
1018
1010
);
1019
1011
}
1020
1012
1013
+ @override
1014
+ Widget loadingIndicator (BuildContext context) {
1015
+ return Selector <DefaultAssetPickerProvider , bool >(
1016
+ selector: (_, DefaultAssetPickerProvider p) => p.isAssetsEmpty,
1017
+ builder: (BuildContext context, bool isAssetsEmpty, Widget ? w) {
1018
+ if (loadingIndicatorBuilder != null ) {
1019
+ return loadingIndicatorBuilder !(context, isAssetsEmpty);
1020
+ }
1021
+ return Center (child: isAssetsEmpty ? emptyIndicator (context) : w);
1022
+ },
1023
+ child: PlatformProgressIndicator (
1024
+ color: theme.iconTheme.color,
1025
+ size: context.mediaQuery.size.width / gridCount / 3 ,
1026
+ ),
1027
+ );
1028
+ }
1029
+
1021
1030
@override
1022
1031
Widget assetsGridBuilder (BuildContext context) {
1023
1032
return Selector <DefaultAssetPickerProvider , AssetPathEntity ?>(
0 commit comments