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

View File

@ -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']);
}
}