@@ -1659,32 +1659,57 @@ class DefaultAssetPickerBuilderDelegate
1659
1659
int index,
1660
1660
AssetEntity asset,
1661
1661
) {
1662
- final AssetEntityImageProvider imageProvider = AssetEntityImageProvider (
1663
- asset,
1664
- isOriginal: false ,
1665
- thumbnailSize: gridThumbnailSize,
1666
- );
1667
- SpecialImageType ? type;
1668
- if (imageProvider.imageFileType == ImageFileType .gif) {
1669
- type = SpecialImageType .gif;
1670
- } else if (imageProvider.imageFileType == ImageFileType .heic) {
1671
- type = SpecialImageType .heic;
1672
- }
1673
- return Stack (
1674
- children: < Widget > [
1675
- Positioned .fill (
1676
- child: RepaintBoundary (
1677
- child: AssetEntityGridItemBuilder (
1678
- image: imageProvider,
1679
- failedItemBuilder: failedItemBuilder,
1662
+ return LocallyAvailableBuilder (
1663
+ asset: asset,
1664
+ builder: (context, asset) {
1665
+ final imageProvider = AssetEntityImageProvider (
1666
+ asset,
1667
+ isOriginal: false ,
1668
+ thumbnailSize: gridThumbnailSize,
1669
+ );
1670
+ SpecialImageType ? type;
1671
+ if (imageProvider.imageFileType == ImageFileType .gif) {
1672
+ type = SpecialImageType .gif;
1673
+ } else if (imageProvider.imageFileType == ImageFileType .heic) {
1674
+ type = SpecialImageType .heic;
1675
+ }
1676
+ return Stack (
1677
+ children: < Widget > [
1678
+ Positioned .fill (
1679
+ child: RepaintBoundary (
1680
+ child: AssetEntityGridItemBuilder (
1681
+ image: imageProvider,
1682
+ failedItemBuilder: failedItemBuilder,
1683
+ ),
1684
+ ),
1680
1685
),
1686
+ if (type == SpecialImageType .gif) // 如果为GIFåˆ™æ˜¾ç¤ºæ ‡è¯†
1687
+ gifIndicator (context, asset),
1688
+ if (asset.type == AssetType .video) // å¦‚æžœä¸ºè§†é¢‘åˆ™æ˜¾ç¤ºæ ‡è¯†
1689
+ videoIndicator (context, asset),
1690
+ ],
1691
+ );
1692
+ },
1693
+ progressBuilder: (context, state, progress) => Row (
1694
+ mainAxisAlignment: MainAxisAlignment .center,
1695
+ children: [
1696
+ Icon (
1697
+ state == PMRequestState .failed
1698
+ ? Icons .cloud_off
1699
+ : Icons .cloud_download_outlined,
1700
+ color: context.iconTheme.color? .withOpacity (.4 ),
1701
+ size: 24.0 ,
1681
1702
),
1682
- ),
1683
- if (type == SpecialImageType .gif) // 如果为GIFåˆ™æ˜¾ç¤ºæ ‡è¯†
1684
- gifIndicator (context, asset),
1685
- if (asset.type == AssetType .video) // å¦‚æžœä¸ºè§†é¢‘åˆ™æ˜¾ç¤ºæ ‡è¯†
1686
- videoIndicator (context, asset),
1687
- ],
1703
+ if (state != PMRequestState .success && state != PMRequestState .failed)
1704
+ ScaleText (
1705
+ ' ${((progress ?? 0 ) * 100 ).toInt ()}%' ,
1706
+ style: TextStyle (
1707
+ color: context.textTheme.bodyMedium? .color? .withOpacity (.4 ),
1708
+ fontSize: 12.0 ,
1709
+ ),
1710
+ ),
1711
+ ],
1712
+ ),
1688
1713
);
1689
1714
}
1690
1715
0 commit comments