Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/src/delegates/asset_picker_builder_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,9 @@ class DefaultAssetPickerBuilderDelegate
/// Whether the bottom actions bar should display.
bool get hasBottomActions => isPreviewEnabled || !isSingleAssetMode;

/// The tap gesture recognizer for present limited assets.
TapGestureRecognizer? presentLimitedTapGestureRecognizer;

/// The listener to track the scroll position of the [gridScrollController]
/// if [keepScrollOffset] is true.
/// 当 [keepScrollOffset] 为 true 时,跟踪 [gridScrollController] 位置的监听。
Expand All @@ -946,6 +949,13 @@ class DefaultAssetPickerBuilderDelegate
}
}

@override
void initState(AssetPickerState<AssetEntity, AssetPathEntity> state) {
super.initState(state);
presentLimitedTapGestureRecognizer = TapGestureRecognizer()
..onTap = PhotoManager.presentLimited;
}

/// Be aware that the method will do nothing when [keepScrollOffset] is true.
/// 注意当 [keepScrollOffset] 为 true 时方法不会进行释放。
@override
Expand All @@ -955,6 +965,7 @@ class DefaultAssetPickerBuilderDelegate
return;
}
provider.dispose();
presentLimitedTapGestureRecognizer?.dispose();
super.dispose();
}

Expand Down Expand Up @@ -2032,8 +2043,7 @@ class DefaultAssetPickerBuilderDelegate
text: ' '
'${textDelegate.changeAccessibleLimitedAssets}',
style: TextStyle(color: interactiveTextColor(context)),
recognizer: TapGestureRecognizer()
..onTap = PhotoManager.presentLimited,
recognizer: presentLimitedTapGestureRecognizer,
),
],
),
Expand Down
13 changes: 12 additions & 1 deletion lib/src/widget/asset_picker_page_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ class AssetPickerPageRoute<T> extends PageRoute<T> {

final bool Function(TransitionRoute<dynamic>)? canTransitionFromPredicate;

/// The curved animation.
CurvedAnimation? _curvedAnimation;

@override
void dispose() {
_curvedAnimation?.dispose();
super.dispose();
}

@override
bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) =>
canTransitionFromPredicate?.call(previousRoute) ?? false;
Expand All @@ -65,12 +74,14 @@ class AssetPickerPageRoute<T> extends PageRoute<T> {
Animation<double> secondaryAnimation,
Widget child,
) {
_curvedAnimation ??=
CurvedAnimation(curve: transitionCurve, parent: animation);
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(0, 1),
end: Offset.zero,
).animate(
CurvedAnimation(curve: transitionCurve, parent: animation),
_curvedAnimation!,
),
child: ClipRect(child: child), // Clip the overflowed part.
);
Expand Down
1 change: 1 addition & 0 deletions lib/src/widget/builder/image_page_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ class _LivePhotoWidgetState extends State<_LivePhotoWidget> {
_scrollNotificationObserver?.removeListener(_handleScrollNotification);
_controller.pause();
_controller.removeListener(_notify);
_showVideo.dispose();
super.dispose();
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/widget/builder/video_page_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class _VideoPageBuilderState extends State<VideoPageBuilder> {
?..removeListener(videoPlayerListener)
..pause()
..dispose();
isPlaying.dispose();
super.dispose();
}

Expand Down
Loading