mod: 收藏视频相关 issues #51 #534

This commit is contained in:
guozhigq
2024-02-12 10:07:29 +08:00
parent 1c8e7e53a5
commit 89026e671c
3 changed files with 100 additions and 87 deletions

View File

@ -322,7 +322,7 @@ class VideoHttp {
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']}; return {'status': true, 'data': res.data['data']};
} else { } else {
return {'status': false, 'data': []}; return {'status': false, 'data': [], 'msg': res.data['message']};
} }
} }

View File

@ -130,7 +130,9 @@ class VideoContent extends StatelessWidget {
return Expanded( return Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(10, 2, 6, 0), padding: const EdgeInsets.fromLTRB(10, 2, 6, 0),
child: Column( child: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
@ -147,7 +149,8 @@ class VideoContent extends StatelessWidget {
Text( Text(
videoItem.intro, videoItem.intro,
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),
), ),
@ -156,29 +159,39 @@ class VideoContent extends StatelessWidget {
Text( Text(
Utils.dateFormat(videoItem.favTime), Utils.dateFormat(videoItem.favTime),
style: TextStyle( style: TextStyle(
fontSize: 11, color: Theme.of(context).colorScheme.outline), fontSize: 11,
color: Theme.of(context).colorScheme.outline),
), ),
if (videoItem.owner.name != '') ...[ if (videoItem.owner.name != '') ...[
Text( Text(
videoItem.owner.name, videoItem.owner.name,
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, fontSize:
Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),
), ),
], ],
Row( Padding(
padding: const EdgeInsets.only(top: 2),
child: Row(
children: [ children: [
StatView( StatView(
theme: 'gray', theme: 'gray',
view: videoItem.cntInfo['play'], view: videoItem.cntInfo['play'],
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
StatDanMu(theme: 'gray', danmu: videoItem.cntInfo['danmaku']), StatDanMu(
theme: 'gray', danmu: videoItem.cntInfo['danmaku']),
const Spacer(), const Spacer(),
SizedBox( ],
width: 26, ),
height: 26, ),
],
),
Positioned(
right: 0,
bottom: -4,
child: IconButton( child: IconButton(
style: ButtonStyle( style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero), padding: MaterialStateProperty.all(EdgeInsets.zero),
@ -196,9 +209,8 @@ class VideoContent extends StatelessWidget {
child: Text( child: Text(
'取消', '取消',
style: TextStyle( style: TextStyle(
color: Theme.of(context) color:
.colorScheme Theme.of(context).colorScheme.outline),
.outline),
)), )),
TextButton( TextButton(
onPressed: () async { onPressed: () async {
@ -221,8 +233,6 @@ class VideoContent extends StatelessWidget {
), ),
], ],
), ),
],
),
), ),
); );
} }

View File

@ -298,7 +298,6 @@ class VideoIntroController extends GetxController {
await queryVideoInFolder(); await queryVideoInFolder();
int defaultFolderId = favFolderData.value.list!.first.id!; int defaultFolderId = favFolderData.value.list!.first.id!;
int favStatus = favFolderData.value.list!.first.favState!; int favStatus = favFolderData.value.list!.first.favState!;
print('favStatus: $favStatus');
var result = await VideoHttp.favVideo( var result = await VideoHttp.favVideo(
aid: IdUtils.bv2av(bvid), aid: IdUtils.bv2av(bvid),
addIds: favStatus == 0 ? '$defaultFolderId' : '', addIds: favStatus == 0 ? '$defaultFolderId' : '',
@ -310,6 +309,8 @@ class VideoIntroController extends GetxController {
await queryHasFavVideo(); await queryHasFavVideo();
SmartDialog.showToast('✅ 操作成功'); SmartDialog.showToast('✅ 操作成功');
} }
} else {
SmartDialog.showToast(result['msg']);
} }
return; return;
} }
@ -340,6 +341,8 @@ class VideoIntroController extends GetxController {
await queryHasFavVideo(); await queryHasFavVideo();
SmartDialog.showToast('✅ 操作成功'); SmartDialog.showToast('✅ 操作成功');
} }
} else {
SmartDialog.showToast(result['msg']);
} }
} }