@@ -810,10 +810,33 @@ class DefaultAssetPickerBuilderDelegate
810
810
return ;
811
811
}
812
812
final AssetPathEntity ? _currentPathEntity = provider.currentPath;
813
+ if (call.arguments is Map ) {
814
+ final Map <dynamic , dynamic > arguments =
815
+ call.arguments as Map <dynamic , dynamic >;
816
+ if (arguments['newCount' ] == 0 ) {
817
+ provider
818
+ ..currentAssets = < AssetEntity > []
819
+ ..currentPath = null
820
+ ..hasAssetsToDisplay = false
821
+ ..isAssetsEmpty = true ;
822
+ return ;
823
+ }
824
+ if (_currentPathEntity == null ) {
825
+ await provider.getPaths ();
826
+ }
827
+ }
813
828
if (_currentPathEntity != null ) {
814
- provider.currentPath = await _currentPathEntity.obtainForNewProperties ();
815
- await provider.switchPath (_currentPathEntity);
829
+ final AssetPathEntity newPath =
830
+ await _currentPathEntity.obtainForNewProperties ();
831
+ provider
832
+ ..currentPath = newPath
833
+ ..hasAssetsToDisplay = newPath.assetCount != 0
834
+ ..isAssetsEmpty = newPath.assetCount == 0
835
+ ..totalAssetsCount = newPath.assetCount;
816
836
isSwitchingPath.value = false ;
837
+ if (newPath.isAll) {
838
+ await provider.getAssetsFromCurrentPath ();
839
+ }
817
840
}
818
841
}
819
842
@@ -1375,7 +1398,7 @@ class DefaultAssetPickerBuilderDelegate
1375
1398
/// Return actual length if current path is all.
1376
1399
/// 如果当前目录是全部内容,则返回实际的内容数量。
1377
1400
final int _length = assets.length + placeholderCount;
1378
- if (! currentPathEntity! .isAll) {
1401
+ if (currentPathEntity? .isAll != true ) {
1379
1402
return _length;
1380
1403
}
1381
1404
switch (specialItemPosition) {
@@ -1679,10 +1702,34 @@ class DefaultAssetPickerBuilderDelegate
1679
1702
1680
1703
@override
1681
1704
Widget pathEntitySelector (BuildContext context) {
1705
+ Widget _text (
1706
+ BuildContext context,
1707
+ String text,
1708
+ String semanticsText,
1709
+ ) {
1710
+ return Flexible (
1711
+ child: ScaleText (
1712
+ text,
1713
+ style: const TextStyle (
1714
+ fontSize: 17 ,
1715
+ fontWeight: FontWeight .normal,
1716
+ ),
1717
+ maxLines: 1 ,
1718
+ overflow: TextOverflow .fade,
1719
+ maxScaleFactor: 1.2 ,
1720
+ semanticsLabel: semanticsText,
1721
+ ),
1722
+ );
1723
+ }
1724
+
1682
1725
return UnconstrainedBox (
1683
1726
child: GestureDetector (
1684
1727
onTap: () {
1685
1728
Feedback .forTap (context);
1729
+ if (isPermissionLimited && provider.isAssetsEmpty) {
1730
+ PhotoManager .presentLimited ();
1731
+ return ;
1732
+ }
1686
1733
isSwitchingPath.value = ! isSwitchingPath.value;
1687
1734
},
1688
1735
child: Container (
@@ -1700,23 +1747,21 @@ class DefaultAssetPickerBuilderDelegate
1700
1747
builder: (_, AssetPathEntity ? p, Widget ? w) => Row (
1701
1748
mainAxisSize: MainAxisSize .min,
1702
1749
children: < Widget > [
1750
+ if (p == null && isPermissionLimited)
1751
+ _text (
1752
+ context,
1753
+ textDelegate.changeAccessibleLimitedAssets,
1754
+ semanticsTextDelegate.changeAccessibleLimitedAssets,
1755
+ ),
1703
1756
if (p != null )
1704
- Flexible (
1705
- child: ScaleText (
1706
- isPermissionLimited && p.isAll
1707
- ? textDelegate.accessiblePathName
1708
- : pathNameBuilder? .call (p) ?? p.name,
1709
- style: const TextStyle (
1710
- fontSize: 17 ,
1711
- fontWeight: FontWeight .normal,
1712
- ),
1713
- maxLines: 1 ,
1714
- overflow: TextOverflow .ellipsis,
1715
- maxScaleFactor: 1.2 ,
1716
- semanticsLabel: isPermissionLimited && p.isAll
1717
- ? semanticsTextDelegate.accessiblePathName
1718
- : pathNameBuilder? .call (p) ?? p.name,
1719
- ),
1757
+ _text (
1758
+ context,
1759
+ isPermissionLimited && p.isAll
1760
+ ? textDelegate.accessiblePathName
1761
+ : pathNameBuilder? .call (p) ?? p.name,
1762
+ isPermissionLimited && p.isAll
1763
+ ? semanticsTextDelegate.accessiblePathName
1764
+ : pathNameBuilder? .call (p) ?? p.name,
1720
1765
),
1721
1766
w! ,
1722
1767
],
0 commit comments