diff --git a/lib/http/video.dart b/lib/http/video.dart index d0faabaa..0df814be 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -51,7 +51,7 @@ class VideoHttp { (i['owner'] != null && !blackMidsList.contains(i['owner']['mid']))) { RecVideoItemModel videoItem = RecVideoItemModel.fromJson(i); - if (!RecommendFilter.filter(videoItem)){ + if (!RecommendFilter.filter(videoItem)) { list.add(videoItem); } } @@ -98,7 +98,7 @@ class VideoHttp { (i['args'] != null && !blackMidsList.contains(i['args']['up_mid']))) { RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i); - if (!RecommendFilter.filter(videoItem)){ + if (!RecommendFilter.filter(videoItem)) { list.add(videoItem); } } @@ -217,7 +217,7 @@ class VideoHttp { List list = []; for (var i in res.data['data']) { HotVideoItemModel videoItem = HotVideoItemModel.fromJson(i); - if (!RecommendFilter.filter(videoItem, relatedVideos: true)){ + if (!RecommendFilter.filter(videoItem, relatedVideos: true)) { list.add(videoItem); } } @@ -322,7 +322,7 @@ class VideoHttp { if (res.data['code'] == 0) { return {'status': true, 'data': res.data['data']}; } else { - return {'status': false, 'data': []}; + return {'status': false, 'data': [], 'msg': res.data['message']}; } } diff --git a/lib/pages/fav_detail/widget/fav_video_card.dart b/lib/pages/fav_detail/widget/fav_video_card.dart index a4f22f6b..a3c1e8e5 100644 --- a/lib/pages/fav_detail/widget/fav_video_card.dart +++ b/lib/pages/fav_detail/widget/fav_video_card.dart @@ -130,97 +130,107 @@ class VideoContent extends StatelessWidget { return Expanded( child: Padding( padding: const EdgeInsets.fromLTRB(10, 2, 6, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + child: Stack( children: [ - Text( - videoItem.title, - textAlign: TextAlign.start, - style: const TextStyle( - fontWeight: FontWeight.w500, - letterSpacing: 0.3, - ), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - if (videoItem.ogv != null) ...[ - Text( - videoItem.intro, - style: TextStyle( - fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, - color: Theme.of(context).colorScheme.outline, - ), - ), - ], - const Spacer(), - Text( - Utils.dateFormat(videoItem.favTime), - style: TextStyle( - fontSize: 11, color: Theme.of(context).colorScheme.outline), - ), - if (videoItem.owner.name != '') ...[ - Text( - videoItem.owner.name, - style: TextStyle( - fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, - color: Theme.of(context).colorScheme.outline, - ), - ), - ], - Row( + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - StatView( - theme: 'gray', - view: videoItem.cntInfo['play'], + Text( + videoItem.title, + textAlign: TextAlign.start, + style: const TextStyle( + fontWeight: FontWeight.w500, + letterSpacing: 0.3, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, ), - const SizedBox(width: 8), - StatDanMu(theme: 'gray', danmu: videoItem.cntInfo['danmaku']), - const Spacer(), - SizedBox( - width: 26, - height: 26, - child: IconButton( - style: ButtonStyle( - padding: MaterialStateProperty.all(EdgeInsets.zero), - ), - onPressed: () { - showDialog( - context: Get.context!, - builder: (context) { - return AlertDialog( - title: const Text('提示'), - content: const Text('要取消收藏吗?'), - actions: [ - TextButton( - onPressed: () => Get.back(), - child: Text( - '取消', - style: TextStyle( - color: Theme.of(context) - .colorScheme - .outline), - )), - TextButton( - onPressed: () async { - await callFn!(); - Get.back(); - }, - child: const Text('确定取消'), - ) - ], - ); - }, - ); - }, - icon: Icon( - Icons.clear_outlined, + if (videoItem.ogv != null) ...[ + Text( + videoItem.intro, + style: TextStyle( + fontSize: + Theme.of(context).textTheme.labelMedium!.fontSize, color: Theme.of(context).colorScheme.outline, - size: 18, ), ), + ], + const Spacer(), + Text( + Utils.dateFormat(videoItem.favTime), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.outline), + ), + if (videoItem.owner.name != '') ...[ + Text( + videoItem.owner.name, + style: TextStyle( + fontSize: + Theme.of(context).textTheme.labelMedium!.fontSize, + color: Theme.of(context).colorScheme.outline, + ), + ), + ], + Padding( + padding: const EdgeInsets.only(top: 2), + child: Row( + children: [ + StatView( + theme: 'gray', + view: videoItem.cntInfo['play'], + ), + const SizedBox(width: 8), + StatDanMu( + theme: 'gray', danmu: videoItem.cntInfo['danmaku']), + const Spacer(), + ], + ), ), ], ), + Positioned( + right: 0, + bottom: -4, + child: IconButton( + style: ButtonStyle( + padding: MaterialStateProperty.all(EdgeInsets.zero), + ), + onPressed: () { + showDialog( + context: Get.context!, + builder: (context) { + return AlertDialog( + title: const Text('提示'), + content: const Text('要取消收藏吗?'), + actions: [ + TextButton( + onPressed: () => Get.back(), + child: Text( + '取消', + style: TextStyle( + color: + Theme.of(context).colorScheme.outline), + )), + TextButton( + onPressed: () async { + await callFn!(); + Get.back(); + }, + child: const Text('确定取消'), + ) + ], + ); + }, + ); + }, + icon: Icon( + Icons.clear_outlined, + color: Theme.of(context).colorScheme.outline, + size: 18, + ), + ), + ), ], ), ), diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index fc92fb56..4672b4bd 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -298,7 +298,6 @@ class VideoIntroController extends GetxController { await queryVideoInFolder(); int defaultFolderId = favFolderData.value.list!.first.id!; int favStatus = favFolderData.value.list!.first.favState!; - print('favStatus: $favStatus'); var result = await VideoHttp.favVideo( aid: IdUtils.bv2av(bvid), addIds: favStatus == 0 ? '$defaultFolderId' : '', @@ -310,6 +309,8 @@ class VideoIntroController extends GetxController { await queryHasFavVideo(); SmartDialog.showToast('✅ 操作成功'); } + } else { + SmartDialog.showToast(result['msg']); } return; } @@ -340,6 +341,8 @@ class VideoIntroController extends GetxController { await queryHasFavVideo(); SmartDialog.showToast('✅ 操作成功'); } + } else { + SmartDialog.showToast(result['msg']); } }