@@ -263,6 +263,13 @@ class DefaultAssetPickerViewerBuilderDelegate
263
263
bool get isWeChatMoment =>
264
264
specialPickerType == SpecialPickerType .wechatMoment;
265
265
266
+ /// Whether there are videos in preview/selected assets.
267
+ /// 当前正在预览或已选的资源是否有视频
268
+ bool get hasVideo =>
269
+ previewAssets.any ((AssetEntity e) => e.type == AssetType .video) ||
270
+ (selectedAssets? .any ((AssetEntity e) => e.type == AssetType .video) ??
271
+ false );
272
+
266
273
@override
267
274
void initStateAndTicker (
268
275
AssetPickerViewerState <AssetEntity , AssetPathEntity > s,
@@ -595,14 +602,9 @@ class DefaultAssetPickerViewerBuilderDelegate
595
602
'Viewer provider must not be null'
596
603
'when the special type is not WeChat moment.' ,
597
604
);
598
- // Check whether any videos in selected assets.
599
- final bool _hasVideos = selectedAssets? .any (
600
- (AssetEntity e) => e.type == AssetType .video,
601
- ) ??
602
- false ;
603
605
return MaterialButton (
604
606
minWidth: () {
605
- if (isWeChatMoment && _hasVideos ) {
607
+ if (isWeChatMoment && hasVideo ) {
606
608
return 48.0 ;
607
609
}
608
610
return provider! .isSelectedNotEmpty ? 48.0 : 20.0 ;
@@ -615,7 +617,7 @@ class DefaultAssetPickerViewerBuilderDelegate
615
617
),
616
618
child: Text (
617
619
() {
618
- if (isWeChatMoment && _hasVideos ) {
620
+ if (isWeChatMoment && hasVideo ) {
619
621
return Constants .textDelegate.confirm;
620
622
}
621
623
if (provider! .isSelectedNotEmpty) {
@@ -633,7 +635,7 @@ class DefaultAssetPickerViewerBuilderDelegate
633
635
),
634
636
),
635
637
onPressed: () {
636
- if (isWeChatMoment && _hasVideos ) {
638
+ if (isWeChatMoment && hasVideo ) {
637
639
Navigator .of (context).pop (< AssetEntity > [currentAsset]);
638
640
return ;
639
641
}
@@ -784,7 +786,8 @@ class DefaultAssetPickerViewerBuilderDelegate
784
786
),
785
787
),
786
788
appBar (context),
787
- if (selectedAssets != null ) bottomDetailBuilder (context),
789
+ if (selectedAssets != null || (isWeChatMoment && hasVideo))
790
+ bottomDetailBuilder (context),
788
791
],
789
792
),
790
793
),
0 commit comments