@@ -769,32 +769,37 @@ class DefaultAssetPickerBuilderDelegate
769
769
Positioned .fill (
770
770
child: Selector <DefaultAssetPickerProvider , bool >(
771
771
selector: (_, DefaultAssetPickerProvider p) => p.hasAssetsToDisplay,
772
- builder: (_, bool hasAssetsToDisplay, __) => AnimatedSwitcher (
773
- duration: switchingPathDuration,
774
- child: hasAssetsToDisplay
775
- ? Stack (
776
- children: < Widget > [
777
- RepaintBoundary (
778
- child: Stack (
779
- children: < Widget > [
780
- Positioned .fill (
781
- child: assetsGridBuilder (context),
782
- ),
783
- if ((! isSingleAssetMode || isAppleOS) &&
784
- isPreviewEnabled)
772
+ builder: (_, bool hasAssetsToDisplay, __) {
773
+ final bool shouldDisplayAssets = hasAssetsToDisplay ||
774
+ (allowSpecialItemWhenEmpty &&
775
+ specialItemPosition != SpecialItemPosition .none);
776
+ return AnimatedSwitcher (
777
+ duration: switchingPathDuration,
778
+ child: shouldDisplayAssets
779
+ ? Stack (
780
+ children: < Widget > [
781
+ RepaintBoundary (
782
+ child: Stack (
783
+ children: < Widget > [
785
784
Positioned .fill (
786
- top: null ,
787
- child: bottomActionBar (context),
785
+ child: assetsGridBuilder (context),
788
786
),
789
- ],
787
+ if ((! isSingleAssetMode || isAppleOS) &&
788
+ isPreviewEnabled)
789
+ Positioned .fill (
790
+ top: null ,
791
+ child: bottomActionBar (context),
792
+ ),
793
+ ],
794
+ ),
790
795
),
791
- ),
792
- pathEntityListBackdrop (context),
793
- pathEntityListWidget (context) ,
794
- ],
795
- )
796
- : loadingIndicator (context),
797
- ) ,
796
+ pathEntityListBackdrop (context ),
797
+ pathEntityListWidget (context),
798
+ ] ,
799
+ )
800
+ : loadingIndicator (context),
801
+ );
802
+ } ,
798
803
),
799
804
),
800
805
appBar (context),
@@ -808,9 +813,10 @@ class DefaultAssetPickerBuilderDelegate
808
813
selector: (_, DefaultAssetPickerProvider p) => p.currentPathEntity,
809
814
builder: (_, AssetPathEntity ? path, __) {
810
815
// First, we need the count of the assets.
811
- int totalCount = path! .assetCount;
816
+ int totalCount = path? .assetCount ?? 0 ;
812
817
// If user chose a special item's position, add 1 count.
813
- if (specialItemPosition != SpecialItemPosition .none && path.isAll) {
818
+ if (specialItemPosition != SpecialItemPosition .none &&
819
+ path? .isAll == true ) {
814
820
totalCount += 1 ;
815
821
}
816
822
// Then we use the [totalCount] to calculate how many placeholders we need.
0 commit comments