@@ -704,56 +704,50 @@ class FileAssetPickerBuilder
704
704
final double maxHeight = Screens .height * 0.825 ;
705
705
return Selector <FileAssetPickerProvider , bool >(
706
706
selector: (_, FileAssetPickerProvider p) => p.isSwitchingPath,
707
- builder: (_, bool isSwitchingPath, __) {
708
- return AnimatedPositioned (
707
+ builder: (_, bool isSwitchingPath, Widget ? w) => AnimatedPositioned (
708
+ duration: switchingPathDuration,
709
+ curve: switchingPathCurve,
710
+ top: isAppleOS
711
+ ? ! isSwitchingPath
712
+ ? - maxHeight
713
+ : appBarHeight
714
+ : - (! isSwitchingPath ? maxHeight : 1.0 ),
715
+ child: AnimatedOpacity (
709
716
duration: switchingPathDuration,
710
717
curve: switchingPathCurve,
711
- top: isAppleOS
712
- ? ! isSwitchingPath
713
- ? - maxHeight
714
- : appBarHeight
715
- : - (! isSwitchingPath ? maxHeight : 1.0 ),
716
- child: AnimatedOpacity (
717
- duration: switchingPathDuration,
718
- curve: switchingPathCurve,
719
- opacity: ! isAppleOS || isSwitchingPath ? 1.0 : 0.0 ,
720
- child: Container (
721
- width: Screens .width,
722
- height: maxHeight,
723
- decoration: BoxDecoration (
724
- borderRadius: isAppleOS
725
- ? const BorderRadius .only (
726
- bottomLeft: Radius .circular (10.0 ),
727
- bottomRight: Radius .circular (10.0 ),
728
- )
729
- : null ,
730
- color: theme.colorScheme.background,
731
- ),
732
- child:
733
- Selector <FileAssetPickerProvider , Map <Directory , Uint8List ?>>(
734
- selector: (_, FileAssetPickerProvider p) => p.pathEntityList,
735
- builder: (_, Map <Directory , Uint8List ?> pathEntityList, __) {
736
- return ListView .separated (
737
- padding: const EdgeInsets .only (top: 1.0 ),
738
- itemCount: pathEntityList.length,
739
- itemBuilder: (BuildContext _, int index) {
740
- return pathEntityWidget (
741
- context,
742
- pathEntityList.keys.elementAt (index),
743
- );
744
- },
745
- separatorBuilder: (BuildContext _, int __) => Container (
746
- margin: const EdgeInsets .only (left: 60.0 ),
747
- height: 1.0 ,
748
- color: theme.canvasColor,
749
- ),
750
- );
751
- },
752
- ),
718
+ opacity: ! isAppleOS || isSwitchingPath ? 1.0 : 0.0 ,
719
+ child: Container (
720
+ width: Screens .width,
721
+ height: maxHeight,
722
+ decoration: BoxDecoration (
723
+ borderRadius: isAppleOS
724
+ ? const BorderRadius .vertical (bottom: Radius .circular (10.0 ))
725
+ : null ,
726
+ color: theme.colorScheme.background,
753
727
),
728
+ child: w,
754
729
),
755
- );
756
- },
730
+ ),
731
+ ),
732
+ child: Selector <FileAssetPickerProvider , Map <Directory , Uint8List ?>>(
733
+ selector: (_, FileAssetPickerProvider p) => p.pathEntityList,
734
+ builder: (_, Map <Directory , Uint8List ?> pathEntityList, __) {
735
+ return ListView .separated (
736
+ padding: const EdgeInsets .only (top: 1.0 ),
737
+ itemCount: pathEntityList.length,
738
+ itemBuilder: (_, int index) => pathEntityWidget (
739
+ context: context,
740
+ list: pathEntityList,
741
+ index: index,
742
+ ),
743
+ separatorBuilder: (_, __) => Container (
744
+ margin: const EdgeInsets .only (left: 60.0 ),
745
+ height: 1.0 ,
746
+ color: theme.canvasColor,
747
+ ),
748
+ );
749
+ },
750
+ ),
757
751
);
758
752
}
759
753
@@ -817,15 +811,18 @@ class FileAssetPickerBuilder
817
811
}
818
812
819
813
@override
820
- Widget pathEntityWidget (BuildContext context, Directory path) {
821
- Widget builder (
822
- BuildContext context,
823
- Map <Directory , Uint8List ?> pathEntityList,
824
- Widget ? child,
825
- ) {
826
- final Uint8List ? thumbData = pathEntityList[path];
827
- if (thumbData != null ) {
828
- return Image .memory (thumbData, fit: BoxFit .cover);
814
+ Widget pathEntityWidget ({
815
+ required BuildContext context,
816
+ required Map <Directory , Uint8List ?> list,
817
+ required int index,
818
+ bool isAudio = false ,
819
+ }) {
820
+ final Directory path = list.keys.elementAt (index);
821
+ final Uint8List ? data = list.values.elementAt (index);
822
+
823
+ Widget builder () {
824
+ if (data != null ) {
825
+ return Image .memory (data, fit: BoxFit .cover);
829
826
} else {
830
827
return ColoredBox (
831
828
color: theme.colorScheme.primary.withOpacity (0.12 ),
@@ -843,18 +840,7 @@ class FileAssetPickerBuilder
843
840
child: Row (
844
841
children: < Widget > [
845
842
RepaintBoundary (
846
- child: AspectRatio (
847
- aspectRatio: 1.0 ,
848
- child: Selector <FileAssetPickerProvider ,
849
- Map <Directory , Uint8List ?>>(
850
- selector: (
851
- BuildContext _,
852
- FileAssetPickerProvider provider,
853
- ) =>
854
- provider.pathEntityList,
855
- builder: builder,
856
- ),
857
- ),
843
+ child: AspectRatio (aspectRatio: 1.0 , child: builder ()),
858
844
),
859
845
Expanded (
860
846
child: Padding (
@@ -1096,9 +1082,9 @@ class FileAssetPickerViewerBuilderDelegate
1096
1082
}
1097
1083
1098
1084
void updateAnimation (ExtendedImageGestureState state) {
1099
- final double begin = state.gestureDetails.totalScale;
1100
- final double end = state.gestureDetails.totalScale == 1.0 ? 3.0 : 1.0 ;
1101
- final Offset pointerDownPosition = state.pointerDownPosition;
1085
+ final double begin = state.gestureDetails! .totalScale! ;
1086
+ final double end = state.gestureDetails! .totalScale! == 1.0 ? 3.0 : 1.0 ;
1087
+ final Offset pointerDownPosition = state.pointerDownPosition! ;
1102
1088
1103
1089
_doubleTapAnimation? .removeListener (_doubleTapListener);
1104
1090
_doubleTapAnimationController
0 commit comments