mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-25 19:46:47 +08:00
refa: ugc intro
Closes #879 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:PiliPlus/http/api.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/member_card_info/data.dart';
|
||||
import 'package:PiliPlus/models/common/member/contribute_type.dart';
|
||||
import 'package:PiliPlus/models/dynamics/result.dart';
|
||||
import 'package:PiliPlus/models/member/info.dart';
|
||||
@@ -310,7 +311,10 @@ class MemberHttp {
|
||||
},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {'status': true, 'data': res.data['data']};
|
||||
return {
|
||||
'status': true,
|
||||
'data': MemberCardInfoData.fromJson(res.data['data'])
|
||||
};
|
||||
} else {
|
||||
return {'status': false, 'msg': res.data['message']};
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'package:PiliPlus/models_new/pgc/pgc_rank/pgc_rank_item_model.dart';
|
||||
import 'package:PiliPlus/models_new/triple/pgc_triple.dart';
|
||||
import 'package:PiliPlus/models_new/triple/ugc_triple.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_ai_conclusion/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/video_detail_response.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_note_list/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_play_info/data.dart';
|
||||
@@ -251,30 +252,15 @@ class VideoHttp {
|
||||
}
|
||||
|
||||
// 视频信息 标题、简介
|
||||
static Future videoIntro({required String bvid}) async {
|
||||
static Future<LoadingState<VideoDetailData>> videoIntro(
|
||||
{required String bvid}) async {
|
||||
var res =
|
||||
await Request().get(Api.videoIntro, queryParameters: {'bvid': bvid});
|
||||
VideoDetailResponse result = VideoDetailResponse.fromJson(res.data);
|
||||
if (result.code == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': result.data!,
|
||||
};
|
||||
VideoDetailResponse data = VideoDetailResponse.fromJson(res.data);
|
||||
if (data.code == 0) {
|
||||
return Success(data.data!);
|
||||
} else {
|
||||
// Map errMap = {
|
||||
// -400: '请求错误',
|
||||
// -403: '权限不足',
|
||||
// -404: '视频资源失效',
|
||||
// 62002: '稿件不可见',
|
||||
// 62004: '稿件审核中',
|
||||
// };
|
||||
return {
|
||||
'status': false,
|
||||
'data': result.data,
|
||||
'code': result.code,
|
||||
'msg': result.message,
|
||||
// 'msg': errMap[result.code] ?? '请求异常',
|
||||
};
|
||||
return Error(data.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
36
lib/member_card_info/card.dart
Normal file
36
lib/member_card_info/card.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:PiliPlus/models/model_avatar.dart';
|
||||
|
||||
class Card {
|
||||
String? mid;
|
||||
String? name;
|
||||
String? face;
|
||||
int? fans;
|
||||
int? attention;
|
||||
BaseOfficialVerify? officialVerify;
|
||||
Vip? vip;
|
||||
|
||||
Card({
|
||||
this.mid,
|
||||
this.name,
|
||||
this.face,
|
||||
this.fans,
|
||||
this.attention,
|
||||
this.officialVerify,
|
||||
this.vip,
|
||||
});
|
||||
|
||||
factory Card.fromJson(Map<String, dynamic> json) => Card(
|
||||
mid: json['mid'] as String?,
|
||||
name: json['name'] as String?,
|
||||
face: json['face'] as String?,
|
||||
fans: json['fans'] as int?,
|
||||
attention: json['attention'] as int?,
|
||||
officialVerify: json['official_verify'] == null
|
||||
? null
|
||||
: BaseOfficialVerify.fromJson(
|
||||
json['official_verify'] as Map<String, dynamic>),
|
||||
vip: json['vip'] == null
|
||||
? null
|
||||
: Vip.fromJson(json['vip'] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
31
lib/member_card_info/data.dart
Normal file
31
lib/member_card_info/data.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:PiliPlus/member_card_info/card.dart';
|
||||
|
||||
class MemberCardInfoData {
|
||||
Card? card;
|
||||
bool? following;
|
||||
int? archiveCount;
|
||||
int? articleCount;
|
||||
int? follower;
|
||||
int? likeNum;
|
||||
|
||||
MemberCardInfoData({
|
||||
this.card,
|
||||
this.following,
|
||||
this.archiveCount,
|
||||
this.articleCount,
|
||||
this.follower,
|
||||
this.likeNum,
|
||||
});
|
||||
|
||||
factory MemberCardInfoData.fromJson(Map<String, dynamic> json) =>
|
||||
MemberCardInfoData(
|
||||
card: json['card'] == null
|
||||
? null
|
||||
: Card.fromJson(json['card'] as Map<String, dynamic>),
|
||||
following: json['following'] as bool?,
|
||||
archiveCount: json['archive_count'] as int?,
|
||||
articleCount: json['article_count'] as int?,
|
||||
follower: json['follower'] as int?,
|
||||
likeNum: json['like_num'] as int?,
|
||||
);
|
||||
}
|
||||
@@ -12,18 +12,18 @@ abstract class CommonIntroController extends GetxController {
|
||||
String bvid = Get.parameters['bvid']!;
|
||||
|
||||
// 是否点赞
|
||||
RxBool hasLike = false.obs;
|
||||
final RxBool hasLike = false.obs;
|
||||
// 投币数量
|
||||
final RxNum coinNum = RxNum(0);
|
||||
// 是否投币
|
||||
bool get hasCoin => coinNum.value != 0;
|
||||
// 是否收藏
|
||||
RxBool hasFav = false.obs;
|
||||
final RxBool hasFav = false.obs;
|
||||
|
||||
List<VideoTagItem>? videoTags;
|
||||
final Rx<List<VideoTagItem>?> videoTags = Rx<List<VideoTagItem>?>(null);
|
||||
|
||||
Set? favIds;
|
||||
Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
final Rx<FavFolderData> favFolderData = FavFolderData().obs;
|
||||
|
||||
AccountService accountService = Get.find<AccountService>();
|
||||
|
||||
@@ -54,10 +54,10 @@ abstract class CommonIntroController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> queryVideoTags() async {
|
||||
videoTags = null;
|
||||
videoTags.value = null;
|
||||
var result = await UserHttp.videoTags(bvid: bvid);
|
||||
if (result['status']) {
|
||||
videoTags = result['data'];
|
||||
videoTags.value = result['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,31 +63,30 @@ class VideoDetailController extends GetxController
|
||||
with GetTickerProviderStateMixin {
|
||||
/// 路由传参
|
||||
String bvid = Get.parameters['bvid']!;
|
||||
RxInt cid = int.parse(Get.parameters['cid']!).obs;
|
||||
RxInt danmakuCid = 0.obs;
|
||||
String heroTag = Get.arguments['heroTag'];
|
||||
// 视频详情
|
||||
RxMap videoItem = {}.obs;
|
||||
final RxInt cid = int.parse(Get.parameters['cid']!).obs;
|
||||
final RxInt danmakuCid = 0.obs;
|
||||
final heroTag = Get.arguments['heroTag'];
|
||||
final RxString cover = ''.obs;
|
||||
// 视频类型 默认投稿视频
|
||||
SearchType videoType = Get.arguments['videoType'] ?? SearchType.video;
|
||||
final videoType = Get.arguments['videoType'] ?? SearchType.video;
|
||||
|
||||
/// tabs相关配置
|
||||
late TabController tabCtr;
|
||||
|
||||
// 请求返回的视频信息
|
||||
late PlayUrlModel data;
|
||||
Rx<LoadingState> videoState = LoadingState.loading().obs;
|
||||
final Rx<LoadingState> videoState = LoadingState.loading().obs;
|
||||
|
||||
/// 播放器配置 画质 音质 解码格式
|
||||
late VideoQuality currentVideoQa;
|
||||
AudioQuality? currentAudioQa;
|
||||
late VideoDecodeFormatType currentDecodeFormats;
|
||||
// 是否开始自动播放 存在多p的情况下,第二p需要为true
|
||||
RxBool autoPlay = true.obs;
|
||||
final RxBool autoPlay = true.obs;
|
||||
// 封面图的展示
|
||||
RxBool isShowCover = true.obs;
|
||||
final RxBool isShowCover = true.obs;
|
||||
|
||||
RxInt oid = 0.obs;
|
||||
final RxInt oid = 0.obs;
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
final childKey = GlobalKey<ScaffoldState>();
|
||||
@@ -116,13 +115,13 @@ class VideoDetailController extends GetxController
|
||||
: plPlayerController.showBangumiReply;
|
||||
|
||||
int? seasonCid;
|
||||
late RxInt seasonIndex = 0.obs;
|
||||
late final RxInt seasonIndex = 0.obs;
|
||||
|
||||
PlayerStatus? playerStatus;
|
||||
StreamSubscription<Duration>? positionSubscription;
|
||||
|
||||
late final scrollKey = GlobalKey<ExtendedNestedScrollViewState>();
|
||||
late RxString direction = 'horizontal'.obs;
|
||||
late final RxString direction = 'horizontal'.obs;
|
||||
late final RxDouble scrollRatio = 0.0.obs;
|
||||
late final ScrollController scrollCtr = ScrollController()
|
||||
..addListener(scrollListener);
|
||||
@@ -235,7 +234,7 @@ class VideoDetailController extends GetxController
|
||||
// 页面来源 稍后再看 收藏夹
|
||||
String sourceType = 'normal';
|
||||
late bool _mediaDesc = false;
|
||||
late RxList<MediaListItemModel> mediaList = <MediaListItemModel>[].obs;
|
||||
late final RxList<MediaListItemModel> mediaList = <MediaListItemModel>[].obs;
|
||||
late String watchLaterTitle = '';
|
||||
bool get isPlayAll =>
|
||||
const ['watchLater', 'fav', 'archive', 'playlist'].contains(sourceType);
|
||||
@@ -255,18 +254,21 @@ class VideoDetailController extends GetxController
|
||||
super.onInit();
|
||||
var keys = Get.arguments.keys.toList();
|
||||
if (keys.isNotEmpty) {
|
||||
if (keys.contains('videoItem')) {
|
||||
if (keys.contains('pic')) {
|
||||
cover.value = Get.arguments['pic'];
|
||||
} else if (keys.contains('videoItem')) {
|
||||
var args = Get.arguments['videoItem'];
|
||||
try {
|
||||
if (args.pic != null && args.pic != '') {
|
||||
videoItem['pic'] = args.pic;
|
||||
} else if (args.cover != null && args.cover != '') {
|
||||
videoItem['pic'] = args.cover;
|
||||
cover.value = args.pic;
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
if (keys.contains('pic')) {
|
||||
videoItem['pic'] = Get.arguments['pic'];
|
||||
} catch (_) {
|
||||
try {
|
||||
if (args.cover != null && args.cover != '') {
|
||||
cover.value = args.cover;
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ class PgcIntroController extends CommonIntroController {
|
||||
..danmakuCid.value = cid
|
||||
..queryVideoUrl();
|
||||
if (cover is String && cover.isNotEmpty) {
|
||||
videoDetailCtr.videoItem['pic'] = cover;
|
||||
videoDetailCtr.cover.value = cover;
|
||||
}
|
||||
|
||||
// 重新请求评论
|
||||
|
||||
@@ -271,7 +271,6 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
||||
onTap: () => handleState(pgcIntroController.actionLikeVideo),
|
||||
onLongPress: pgcIntroController.actionOneThree,
|
||||
selectStatus: pgcIntroController.hasLike.value,
|
||||
isLoading: false,
|
||||
semanticsLabel: '点赞',
|
||||
text: NumUtil.numFormat(item.stat!.likes),
|
||||
needAnim: true,
|
||||
@@ -297,7 +296,6 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
||||
selectIcon: const Icon(FontAwesomeIcons.b),
|
||||
onTap: () => handleState(pgcIntroController.actionCoinVideo),
|
||||
selectStatus: pgcIntroController.hasCoin,
|
||||
isLoading: false,
|
||||
semanticsLabel: '投币',
|
||||
text: NumUtil.numFormat(item.stat!.coins),
|
||||
needAnim: true,
|
||||
@@ -312,7 +310,6 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
||||
onLongPress: () => pgcIntroController.showFavBottomSheet(context,
|
||||
type: 'longPress'),
|
||||
selectStatus: pgcIntroController.hasFav.value,
|
||||
isLoading: false,
|
||||
semanticsLabel: '收藏',
|
||||
text: NumUtil.numFormat(item.stat!.favorite),
|
||||
needAnim: true,
|
||||
@@ -323,7 +320,6 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
||||
selectIcon: const Icon(FontAwesomeIcons.reply),
|
||||
onTap: () => videoDetailCtr.tabCtr.animateTo(1),
|
||||
selectStatus: false,
|
||||
isLoading: false,
|
||||
semanticsLabel: '评论',
|
||||
text: NumUtil.numFormat(item.stat!.reply),
|
||||
),
|
||||
@@ -331,7 +327,6 @@ class _PgcIntroPageState extends State<PgcIntroPage>
|
||||
icon: const Icon(FontAwesomeIcons.shareFromSquare),
|
||||
onTap: () => pgcIntroController.actionShareVideo(context),
|
||||
selectStatus: false,
|
||||
isLoading: false,
|
||||
semanticsLabel: '转发',
|
||||
text: NumUtil.numFormat(item.stat!.share),
|
||||
),
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/http/member.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/member_card_info/data.dart';
|
||||
import 'package:PiliPlus/models_new/triple/ugc_triple.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_ai_conclusion/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_ai_conclusion/model_result.dart';
|
||||
@@ -42,75 +43,69 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class VideoIntroController extends CommonIntroController {
|
||||
// 视频详情 上个页面传入
|
||||
Map videoItem = {};
|
||||
late final RxMap staffRelations = {}.obs;
|
||||
String heroTag = '';
|
||||
|
||||
// 视频详情 请求返回
|
||||
Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
|
||||
late ExpandableController expandableCtr;
|
||||
|
||||
final RxBool status = true.obs;
|
||||
final Rx<VideoDetailData> videoDetail = VideoDetailData().obs;
|
||||
|
||||
// up主粉丝数
|
||||
RxMap<String, dynamic> userStat = RxMap<String, dynamic>({'follower': '-'});
|
||||
final Rx<MemberCardInfoData> userStat = MemberCardInfoData().obs;
|
||||
// 关注状态 默认未关注
|
||||
late final RxMap followStatus = {}.obs;
|
||||
late final RxMap staffRelations = {}.obs;
|
||||
|
||||
// 是否点踩
|
||||
RxBool hasDislike = false.obs;
|
||||
final RxBool hasDislike = false.obs;
|
||||
|
||||
// 是否稍后再看
|
||||
RxBool hasLater = false.obs;
|
||||
final RxBool hasLater = false.obs;
|
||||
|
||||
// 关注状态 默认未关注
|
||||
RxMap followStatus = {}.obs;
|
||||
|
||||
RxInt lastPlayCid = 0.obs;
|
||||
final RxInt lastPlayCid = 0.obs;
|
||||
|
||||
// 同时观看
|
||||
final bool isShowOnlineTotal = Pref.enableOnlineTotal;
|
||||
late final RxString total = '1'.obs;
|
||||
Timer? timer;
|
||||
String heroTag = '';
|
||||
AiConclusionResult? aiConclusionResult;
|
||||
RxMap<String, dynamic> queryVideoIntroData =
|
||||
RxMap<String, dynamic>({"status": true});
|
||||
|
||||
ExpandableController? expandableCtr;
|
||||
|
||||
late final showArgueMsg = Pref.showArgueMsg;
|
||||
late final enableAi = Pref.enableAi;
|
||||
late final horizontalMemberPage = Pref.horizontalMemberPage;
|
||||
|
||||
AiConclusionResult? aiConclusionResult;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
bool alwaysExapndIntroPanel = Pref.alwaysExapndIntroPanel;
|
||||
expandableCtr =
|
||||
ExpandableController(initialExpanded: alwaysExapndIntroPanel);
|
||||
if (!alwaysExapndIntroPanel && Pref.exapndIntroPanelH) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (Get.context!.orientation == Orientation.landscape &&
|
||||
expandableCtr.expanded == false) {
|
||||
expandableCtr.toggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
if (heroTag.isEmpty) {
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
}
|
||||
} catch (_) {}
|
||||
if (Get.arguments.isNotEmpty) {
|
||||
if (Get.arguments.containsKey('videoItem')) {
|
||||
var args = Get.arguments['videoItem'];
|
||||
var keys = Get.arguments.keys.toList();
|
||||
try {
|
||||
if (args.pic != null && args.pic != '') {
|
||||
videoItem['pic'] = args.pic;
|
||||
} else if (args.cover != null && args.cover != '') {
|
||||
videoItem['pic'] = args.cover;
|
||||
}
|
||||
} catch (_) {}
|
||||
if (args.title is String) {
|
||||
videoItem['title'] = args.title;
|
||||
} else {
|
||||
String str = '';
|
||||
for (Map map in args.title) {
|
||||
str += map['text'];
|
||||
}
|
||||
videoItem['title'] = str;
|
||||
try {
|
||||
var videoItem = Get.arguments['videoItem'];
|
||||
if (videoItem != null) {
|
||||
if (videoItem.title case String e) {
|
||||
videoDetail.value.title = e;
|
||||
} else if (videoItem.title case List list) {
|
||||
videoDetail.value.title =
|
||||
list.fold<String>('', (prev, val) => prev + val['text']);
|
||||
}
|
||||
videoItem
|
||||
..['stat'] = keys.contains('stat') ? args.stat : null
|
||||
..['pubdate'] = keys.contains('pubdate') ? args.pubdate : null
|
||||
..['owner'] = keys.contains('owner') ? args.owner : null;
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
lastPlayCid.value = int.parse(Get.parameters['cid']!);
|
||||
startTimer();
|
||||
queryVideoIntro();
|
||||
@@ -119,9 +114,9 @@ class VideoIntroController extends CommonIntroController {
|
||||
// 获取视频简介&分p
|
||||
Future<void> queryVideoIntro() async {
|
||||
queryVideoTags();
|
||||
var result = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (result['status']) {
|
||||
VideoDetailData data = result['data'];
|
||||
var res = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (res.isSuccess) {
|
||||
VideoDetailData data = res.data;
|
||||
videoPlayerServiceHandler.onVideoDetailChange(data, data.cid!, heroTag);
|
||||
if (videoDetail.value.ugcSeason?.id == data.ugcSeason?.id) {
|
||||
// keep reversed season
|
||||
@@ -134,15 +129,13 @@ class VideoIntroController extends CommonIntroController {
|
||||
..isPageReversed = videoDetail.value.isPageReversed;
|
||||
}
|
||||
videoDetail.value = data;
|
||||
videoItem['staff'] = data.staff;
|
||||
try {
|
||||
final videoDetailController =
|
||||
Get.find<VideoDetailController>(tag: heroTag);
|
||||
if (videoDetailController.videoItem['pic'] == null ||
|
||||
videoDetailController.videoItem['pic'] == '' ||
|
||||
if (videoDetailController.cover.value.isEmpty ||
|
||||
(videoDetailController.videoUrl.isNullOrEmpty &&
|
||||
!videoDetailController.isQuerying)) {
|
||||
videoDetailController.videoItem['pic'] = data.pic;
|
||||
videoDetailController.cover.value = data.pic ?? '';
|
||||
}
|
||||
if (videoDetailController.showReply) {
|
||||
try {
|
||||
@@ -157,12 +150,12 @@ class VideoIntroController extends CommonIntroController {
|
||||
lastPlayCid.value == 0) {
|
||||
lastPlayCid.value = videoDetail.value.pages!.first.cid!;
|
||||
}
|
||||
queryUserStat();
|
||||
queryUserStat(data.staff);
|
||||
} else {
|
||||
SmartDialog.showToast(
|
||||
"${result['code']} ${result['msg']} ${result['data']}");
|
||||
res.toast();
|
||||
status.value = false;
|
||||
}
|
||||
queryVideoIntroData.addAll(result);
|
||||
|
||||
if (accountService.isLogin.value) {
|
||||
queryAllStatus();
|
||||
queryFollowStatus();
|
||||
@@ -170,15 +163,11 @@ class VideoIntroController extends CommonIntroController {
|
||||
}
|
||||
|
||||
// 获取up主粉丝数
|
||||
Future<void> queryUserStat() async {
|
||||
if (videoItem['staff']?.isNotEmpty == true) {
|
||||
Future<void> queryUserStat(List<Staff>? staff) async {
|
||||
if (staff?.isNotEmpty == true) {
|
||||
Request().get(
|
||||
Api.relations,
|
||||
queryParameters: {
|
||||
'fids': (videoItem['staff'] as List<Staff>)
|
||||
.map((item) => item.mid)
|
||||
.join(',')
|
||||
},
|
||||
queryParameters: {'fids': staff!.map((item) => item.mid).join(',')},
|
||||
).then((res) {
|
||||
if (res.data['code'] == 0) {
|
||||
staffRelations.addAll({
|
||||
@@ -194,7 +183,7 @@ class VideoIntroController extends CommonIntroController {
|
||||
var result =
|
||||
await MemberHttp.memberCardInfo(mid: videoDetail.value.owner!.mid!);
|
||||
if (result['status']) {
|
||||
userStat.addAll(result['data']);
|
||||
userStat.value = result['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,8 +312,7 @@ class VideoIntroController extends CommonIntroController {
|
||||
return;
|
||||
}
|
||||
|
||||
int copyright =
|
||||
(queryVideoIntroData['data'] as VideoDetailData?)?.copyright ?? 1;
|
||||
int copyright = videoDetail.value.copyright ?? 1;
|
||||
if ((copyright != 1 && coinNum.value >= 1) || coinNum.value >= 2) {
|
||||
SmartDialog.showToast('达到投币上限啦~');
|
||||
return;
|
||||
@@ -528,7 +516,8 @@ class VideoIntroController extends CommonIntroController {
|
||||
|
||||
// 查询关注状态
|
||||
Future<void> queryFollowStatus() async {
|
||||
if (videoDetail.value.owner == null) {
|
||||
if (videoDetail.value.owner == null ||
|
||||
videoDetail.value.staff?.isNotEmpty == true) {
|
||||
return;
|
||||
}
|
||||
var result = await UserHttp.hasFollow(videoDetail.value.owner!.mid!);
|
||||
@@ -588,7 +577,7 @@ class VideoIntroController extends CommonIntroController {
|
||||
PageUtils.toVideoPage(
|
||||
'bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
if (cover != null) 'pic': cover,
|
||||
'pic': cover,
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
);
|
||||
@@ -608,8 +597,10 @@ class VideoIntroController extends CommonIntroController {
|
||||
..queryVideoUrl();
|
||||
|
||||
if (this.bvid != bvid) {
|
||||
aiConclusionResult = null;
|
||||
|
||||
if (cover is String && cover.isNotEmpty) {
|
||||
videoDetailCtr.videoItem['pic'] = cover;
|
||||
videoDetailCtr.cover.value = cover;
|
||||
}
|
||||
|
||||
// 重新请求相关视频
|
||||
@@ -672,8 +663,7 @@ class VideoIntroController extends CommonIntroController {
|
||||
@override
|
||||
void onClose() {
|
||||
canelTimer();
|
||||
expandableCtr?.dispose();
|
||||
expandableCtr = null;
|
||||
expandableCtr.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@ class ActionItem extends StatefulWidget {
|
||||
final Icon? selectIcon;
|
||||
final VoidCallback? onTap;
|
||||
final VoidCallback? onLongPress;
|
||||
final bool? isLoading;
|
||||
final String? text;
|
||||
final bool selectStatus;
|
||||
final String semanticsLabel;
|
||||
@@ -26,7 +25,6 @@ class ActionItem extends StatefulWidget {
|
||||
this.selectIcon,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.isLoading,
|
||||
this.text,
|
||||
this.selectStatus = false,
|
||||
this.needAnim = false,
|
||||
@@ -178,26 +176,22 @@ class ActionItemState extends State<ActionItem>
|
||||
],
|
||||
),
|
||||
if (widget.text != null)
|
||||
AnimatedOpacity(
|
||||
opacity: widget.isLoading! ? 0 : 1,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder:
|
||||
(Widget child, Animation<double> animation) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
widget.text!,
|
||||
key: ValueKey<String>(widget.text!),
|
||||
style: TextStyle(
|
||||
color: widget.selectStatus
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
),
|
||||
semanticsLabel: "",
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder:
|
||||
(Widget child, Animation<double> animation) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
widget.text!,
|
||||
key: ValueKey(widget.text!),
|
||||
style: TextStyle(
|
||||
color: widget.selectStatus
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.outline,
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
),
|
||||
semanticsLabel: "",
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -751,7 +751,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
context,
|
||||
[
|
||||
videoDetailController
|
||||
.videoItem['pic']
|
||||
.cover.value
|
||||
],
|
||||
);
|
||||
break;
|
||||
@@ -772,8 +772,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
child: Text('查看笔记'),
|
||||
),
|
||||
if (videoDetailController
|
||||
.videoItem['pic'] !=
|
||||
null)
|
||||
.cover.value.isNotEmpty)
|
||||
const PopupMenuItem<String>(
|
||||
value: 'savePic',
|
||||
child: Text('保存封面'),
|
||||
@@ -1288,7 +1287,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
case 'savePic':
|
||||
ImageUtil.downloadImg(
|
||||
context,
|
||||
[videoDetailController.videoItem['pic']],
|
||||
[videoDetailController.cover.value],
|
||||
);
|
||||
break;
|
||||
}
|
||||
@@ -1304,7 +1303,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
value: 'note',
|
||||
child: Text('查看笔记'),
|
||||
),
|
||||
if (videoDetailController.videoItem['pic'] != null)
|
||||
if (videoDetailController.cover.value.isNotEmpty)
|
||||
const PopupMenuItem<String>(
|
||||
value: 'savePic',
|
||||
child: Text('保存封面'),
|
||||
@@ -1584,10 +1583,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
onTap: handlePlay,
|
||||
child: Obx(
|
||||
() => CachedNetworkImage(
|
||||
imageUrl: (videoDetailController.videoItem['pic']
|
||||
as String?)
|
||||
?.http2https ??
|
||||
'',
|
||||
imageUrl:
|
||||
videoDetailController.cover.value.http2https,
|
||||
width: videoWidth,
|
||||
height: videoHeight,
|
||||
fit: BoxFit.cover,
|
||||
@@ -1857,7 +1854,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
videoIntroController: videoIntroController,
|
||||
type: EpisodeType.part,
|
||||
list: [videoIntroController.videoDetail.value.pages!],
|
||||
cover: videoDetailController.videoItem['pic'],
|
||||
cover: videoDetailController.cover.value,
|
||||
bvid: videoDetailController.bvid,
|
||||
aid: IdUtils.bv2av(videoDetailController.bvid),
|
||||
cid: videoDetailController.cid.value,
|
||||
@@ -1905,7 +1902,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
videoIntroController: videoIntroController,
|
||||
type: EpisodeType.season,
|
||||
initialTabIndex: videoDetailController.seasonIndex.value,
|
||||
cover: videoDetailController.videoItem['pic'],
|
||||
cover: videoDetailController.cover.value,
|
||||
seasonId:
|
||||
videoIntroController.videoDetail.value.ugcSeason!.id,
|
||||
list: videoIntroController
|
||||
@@ -2034,7 +2031,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
: episodes is List<Part>
|
||||
? EpisodeType.part
|
||||
: EpisodeType.pgc,
|
||||
cover: videoDetailController.videoItem['pic'],
|
||||
cover: videoDetailController.cover.value,
|
||||
enableSlide: enableSlide,
|
||||
initialTabIndex: index ?? 0,
|
||||
bvid: bvid,
|
||||
|
||||
@@ -145,14 +145,14 @@ class HeaderControlState extends State<HeaderControl> {
|
||||
leading: const Icon(Icons.note_alt_outlined, size: 20),
|
||||
title: const Text('查看笔记', style: titleStyle),
|
||||
),
|
||||
if (widget.videoDetailCtr.videoItem['pic'] != null)
|
||||
if (widget.videoDetailCtr.cover.value.isNotEmpty)
|
||||
ListTile(
|
||||
dense: true,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
ImageUtil.downloadImg(
|
||||
context,
|
||||
[widget.videoDetailCtr.videoItem['pic']],
|
||||
[widget.videoDetailCtr.cover.value],
|
||||
);
|
||||
},
|
||||
leading: const Icon(Icons.image_outlined, size: 20),
|
||||
|
||||
@@ -167,7 +167,6 @@ class PiliScheme {
|
||||
PageUtils.toVideoPage(
|
||||
'bvid=$bvid&cid=${queryParameters['cid']}',
|
||||
arguments: {
|
||||
'pic': null,
|
||||
'heroTag': Utils.makeHeroTag(aid),
|
||||
if (queryParameters['dm_progress'] != null)
|
||||
'progress': int.tryParse(queryParameters['dm_progress']!),
|
||||
@@ -877,7 +876,6 @@ class PiliScheme {
|
||||
PageUtils.toVideoPage(
|
||||
'bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
'pic': null,
|
||||
'heroTag': Utils.makeHeroTag(aid),
|
||||
if (progress != null) 'progress': int.tryParse(progress),
|
||||
},
|
||||
|
||||
@@ -55,7 +55,6 @@ class UrlUtils {
|
||||
PageUtils.toVideoPage(
|
||||
'bvid=$bvid&cid=$cid',
|
||||
arguments: <String, String?>{
|
||||
'pic': '',
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
preventDuplicates: false,
|
||||
|
||||
Reference in New Issue
Block a user