Skip to content

Commit 4d63bc8

Browse files
committed
🐛 Fix assets reduced under the WeChat Moment mode when previewing
1 parent 9c54b6a commit 4d63bc8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/src/delegates/asset_picker_viewer_builder_delegate.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,14 @@ class DefaultAssetPickerViewerBuilderDelegate
595595
'Viewer provider must not be null'
596596
'when the special type is not WeChat moment.',
597597
);
598+
// Check whether any videos in selected assets.
599+
final bool _hasVideos = selectedAssets?.any(
600+
(AssetEntity e) => e.type == AssetType.video,
601+
) ??
602+
false;
598603
return MaterialButton(
599604
minWidth: () {
600-
if (isWeChatMoment) {
605+
if (isWeChatMoment && _hasVideos) {
601606
return 48.0;
602607
}
603608
return provider!.isSelectedNotEmpty ? 48.0 : 20.0;
@@ -610,7 +615,7 @@ class DefaultAssetPickerViewerBuilderDelegate
610615
),
611616
child: Text(
612617
() {
613-
if (isWeChatMoment) {
618+
if (isWeChatMoment && _hasVideos) {
614619
return Constants.textDelegate.confirm;
615620
}
616621
if (provider!.isSelectedNotEmpty) {
@@ -628,7 +633,7 @@ class DefaultAssetPickerViewerBuilderDelegate
628633
),
629634
),
630635
onPressed: () {
631-
if (isWeChatMoment) {
636+
if (isWeChatMoment && _hasVideos) {
632637
Navigator.of(context).pop(<AssetEntity>[currentAsset]);
633638
return;
634639
}

0 commit comments

Comments
 (0)