feat: 推荐、相关视频卡片添加拉黑Up功能
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -42,3 +42,4 @@ app.*.map.json
|
|||||||
/android/app/debug
|
/android/app/debug
|
||||||
/android/app/profile
|
/android/app/profile
|
||||||
/android/app/release
|
/android/app/release
|
||||||
|
/*/flutter/[Gg]enerated*[Pp]lugin*
|
||||||
|
@ -3,6 +3,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import '../../http/search.dart';
|
import '../../http/search.dart';
|
||||||
import '../../http/user.dart';
|
import '../../http/user.dart';
|
||||||
|
import '../../http/video.dart';
|
||||||
import '../../utils/utils.dart';
|
import '../../utils/utils.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
import 'badge.dart';
|
import 'badge.dart';
|
||||||
@ -265,7 +266,6 @@ class VideoContent extends StatelessWidget {
|
|||||||
height: 24,
|
height: 24,
|
||||||
child: PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tooltip: '稍后再看',
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
@ -280,10 +280,10 @@ class VideoContent extends StatelessWidget {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
var res = await UserHttp.toViewLater(
|
var res = await UserHttp.toViewLater(
|
||||||
bvid: videoItem.bvid as String);
|
bvid: videoItem.bvid as String);
|
||||||
SmartDialog.showToast(res['msg'] as String);
|
SmartDialog.showToast(res['msg']);
|
||||||
},
|
},
|
||||||
value: 'pause',
|
value: 'pause',
|
||||||
height: 35,
|
height: 40,
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.watch_later_outlined, size: 16),
|
Icon(Icons.watch_later_outlined, size: 16),
|
||||||
@ -292,6 +292,59 @@ class VideoContent extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const PopupMenuDivider(),
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
onTap: () async {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType:
|
||||||
|
SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: Text(
|
||||||
|
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||||
|
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
|
child: Text(
|
||||||
|
'点错了',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await VideoHttp.relationMod(
|
||||||
|
mid: videoItem.owner.mid,
|
||||||
|
act: 5,
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast(
|
||||||
|
res['msg'] ?? '成功');
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
value: 'pause',
|
||||||
|
height: 40,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.block, size: 16),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text('拉黑:${videoItem.owner.name}',
|
||||||
|
style: const TextStyle(fontSize: 13))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
|||||||
import '../../http/dynamics.dart';
|
import '../../http/dynamics.dart';
|
||||||
import '../../http/search.dart';
|
import '../../http/search.dart';
|
||||||
import '../../http/user.dart';
|
import '../../http/user.dart';
|
||||||
|
import '../../http/video.dart';
|
||||||
import '../../models/common/search_type.dart';
|
import '../../models/common/search_type.dart';
|
||||||
import '../../utils/id_utils.dart';
|
import '../../utils/id_utils.dart';
|
||||||
import '../../utils/utils.dart';
|
import '../../utils/utils.dart';
|
||||||
@ -215,15 +216,10 @@ class VideoContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
if (videoItem.goto == 'av' && crossAxisCount == 1) ...[
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
WatchLater(
|
VideoPopupMenu(
|
||||||
size: 32,
|
size: 32,
|
||||||
iconSize: 18,
|
iconSize: 18,
|
||||||
callFn: () async {
|
videoItem: videoItem,
|
||||||
int aid = videoItem.param;
|
|
||||||
var res =
|
|
||||||
await UserHttp.toViewLater(bvid: IdUtils.av2bv(aid));
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -299,15 +295,10 @@ class VideoContent extends StatelessWidget {
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
],
|
],
|
||||||
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
|
||||||
WatchLater(
|
VideoPopupMenu(
|
||||||
size: 24,
|
size: 24,
|
||||||
iconSize: 14,
|
iconSize: 14,
|
||||||
callFn: () async {
|
videoItem: videoItem,
|
||||||
int aid = videoItem.param;
|
|
||||||
var res =
|
|
||||||
await UserHttp.toViewLater(bvid: IdUtils.av2bv(aid));
|
|
||||||
SmartDialog.showToast(res['msg']);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
const SizedBox(height: 24)
|
const SizedBox(height: 24)
|
||||||
@ -349,16 +340,16 @@ class VideoStat extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WatchLater extends StatelessWidget {
|
class VideoPopupMenu extends StatelessWidget {
|
||||||
final double? size;
|
final double? size;
|
||||||
final double? iconSize;
|
final double? iconSize;
|
||||||
final Function? callFn;
|
final dynamic videoItem;
|
||||||
|
|
||||||
const WatchLater({
|
const VideoPopupMenu({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.size,
|
required this.size,
|
||||||
required this.iconSize,
|
required this.iconSize,
|
||||||
this.callFn,
|
required this.videoItem,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -368,7 +359,6 @@ class WatchLater extends StatelessWidget {
|
|||||||
height: size,
|
height: size,
|
||||||
child: PopupMenuButton<String>(
|
child: PopupMenuButton<String>(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
tooltip: '稍后再看',
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
color: Theme.of(context).colorScheme.outline,
|
color: Theme.of(context).colorScheme.outline,
|
||||||
@ -379,9 +369,13 @@ class WatchLater extends StatelessWidget {
|
|||||||
onSelected: (String type) {},
|
onSelected: (String type) {},
|
||||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
|
||||||
PopupMenuItem<String>(
|
PopupMenuItem<String>(
|
||||||
onTap: () => callFn!(),
|
onTap: () async {
|
||||||
|
var res =
|
||||||
|
await UserHttp.toViewLater(bvid: videoItem.bvid as String);
|
||||||
|
SmartDialog.showToast(res['msg']);
|
||||||
|
},
|
||||||
value: 'pause',
|
value: 'pause',
|
||||||
height: 35,
|
height: 40,
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.watch_later_outlined, size: 16),
|
Icon(Icons.watch_later_outlined, size: 16),
|
||||||
@ -390,6 +384,55 @@ class WatchLater extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const PopupMenuDivider(),
|
||||||
|
PopupMenuItem<String>(
|
||||||
|
onTap: () async {
|
||||||
|
SmartDialog.show(
|
||||||
|
useSystem: true,
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: const Text('提示'),
|
||||||
|
content: Text(
|
||||||
|
'确定拉黑:${videoItem.owner.name}(${videoItem.owner.mid})?'
|
||||||
|
'\n\n注:被拉黑的Up可以在隐私设置-黑名单管理中解除'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
|
child: Text(
|
||||||
|
'点错了',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await VideoHttp.relationMod(
|
||||||
|
mid: videoItem.owner.mid,
|
||||||
|
act: 5,
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
SmartDialog.dismiss();
|
||||||
|
SmartDialog.showToast(res['msg'] ?? '成功');
|
||||||
|
},
|
||||||
|
child: const Text('确认'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
value: 'pause',
|
||||||
|
height: 40,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.block, size: 16),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text('拉黑:${videoItem.owner.name}',
|
||||||
|
style: const TextStyle(fontSize: 13))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user