mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 23:26:14 +08:00
opt change episode
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -67,7 +67,7 @@ class _SelfSizedHorizontalListState extends State<SelfSizedHorizontalList> {
|
||||
padding: widget.padding,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: widget.itemCount,
|
||||
itemBuilder: (c, i) => widget.childBuilder.call(i),
|
||||
itemBuilder: (c, i) => widget.childBuilder(i),
|
||||
separatorBuilder: (c, i) => SizedBox(width: widget.gapSize),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
import 'package:PiliPlus/models_new/media_list/media_list.dart';
|
||||
|
||||
class MediaListData {
|
||||
List<MediaListItemModel>? mediaList;
|
||||
List<MediaListItemModel> mediaList;
|
||||
bool? hasMore;
|
||||
int? totalCount;
|
||||
String? nextStartKey;
|
||||
|
||||
MediaListData({
|
||||
this.mediaList,
|
||||
required this.mediaList,
|
||||
this.hasMore,
|
||||
this.totalCount,
|
||||
this.nextStartKey,
|
||||
});
|
||||
|
||||
factory MediaListData.fromJson(Map<String, dynamic> json) => MediaListData(
|
||||
mediaList: (json['media_list'] as List<dynamic>?)
|
||||
mediaList:
|
||||
(json['media_list'] as List<dynamic>?)
|
||||
?.map((e) => MediaListItemModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
.toList() ??
|
||||
<MediaListItemModel>[],
|
||||
hasMore: json['has_more'] as bool?,
|
||||
totalCount: json['total_count'] as int?,
|
||||
nextStartKey: json['next_start_key'] as String?,
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import 'package:PiliPlus/models/model_owner.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_detail/cnt_info.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/badge.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/coin.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/ogv_info.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/page.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/rights.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
|
||||
class MediaListItemModel {
|
||||
class MediaListItemModel extends BaseEpisodeItem {
|
||||
@override
|
||||
int? get id => aid;
|
||||
int? aid;
|
||||
int? offset;
|
||||
int? index;
|
||||
String? intro;
|
||||
@@ -17,32 +17,27 @@ class MediaListItemModel {
|
||||
int? tid;
|
||||
int? copyRight;
|
||||
CntInfo? cntInfo;
|
||||
String? cover;
|
||||
int? duration;
|
||||
int? pubtime;
|
||||
int? likeState;
|
||||
int? favState;
|
||||
int? page;
|
||||
List<Page>? pages;
|
||||
String? title;
|
||||
int? type;
|
||||
Owner? upper;
|
||||
String? link;
|
||||
String? bvid;
|
||||
String? shortLink;
|
||||
Rights? rights;
|
||||
dynamic elecInfo;
|
||||
Coin? coin;
|
||||
OgvInfo? ogvInfo;
|
||||
double? progressPercent;
|
||||
Badge? badge;
|
||||
bool? forbidFav;
|
||||
int? moreType;
|
||||
int? businessOid;
|
||||
int? cid;
|
||||
|
||||
MediaListItemModel({
|
||||
this.aid,
|
||||
super.aid,
|
||||
this.offset,
|
||||
this.index,
|
||||
this.intro,
|
||||
@@ -50,29 +45,29 @@ class MediaListItemModel {
|
||||
this.tid,
|
||||
this.copyRight,
|
||||
this.cntInfo,
|
||||
this.cover,
|
||||
super.cover,
|
||||
this.duration,
|
||||
this.pubtime,
|
||||
this.likeState,
|
||||
this.favState,
|
||||
this.page,
|
||||
this.pages,
|
||||
this.title,
|
||||
super.title,
|
||||
this.type,
|
||||
this.upper,
|
||||
this.link,
|
||||
this.bvid,
|
||||
super.bvid,
|
||||
this.shortLink,
|
||||
this.rights,
|
||||
this.elecInfo,
|
||||
this.coin,
|
||||
this.ogvInfo,
|
||||
this.progressPercent,
|
||||
this.badge,
|
||||
super.badge,
|
||||
this.forbidFav,
|
||||
this.moreType,
|
||||
this.businessOid,
|
||||
this.cid,
|
||||
super.cid,
|
||||
});
|
||||
|
||||
MediaListItemModel.fromJson(Map<String, dynamic> json) {
|
||||
@@ -106,7 +101,7 @@ class MediaListItemModel {
|
||||
? null
|
||||
: OgvInfo.fromJson(json['ogv_info']);
|
||||
progressPercent = (json['progress_percent'] as num?)?.toDouble();
|
||||
badge = json['badge'] == null ? null : Badge.fromJson(json['badge']);
|
||||
badge = json['badge']?['text'];
|
||||
forbidFav = json['forbid_fav'] as bool?;
|
||||
moreType = json['more_type'] as int?;
|
||||
businessOid = json['business_oid'] as int?;
|
||||
|
||||
@@ -8,11 +8,9 @@ import 'package:PiliPlus/models_new/video/video_detail/episode.dart'
|
||||
class EpisodeItem extends BaseEpisodeItem {
|
||||
BadgeInfo? badgeInfo;
|
||||
int? badgeType;
|
||||
String? cover;
|
||||
Dimension? dimension;
|
||||
int? duration;
|
||||
bool? enableVt;
|
||||
int? epId;
|
||||
String? from;
|
||||
bool? isViewHide;
|
||||
String? link;
|
||||
@@ -39,11 +37,11 @@ class EpisodeItem extends BaseEpisodeItem {
|
||||
this.badgeType,
|
||||
super.bvid,
|
||||
super.cid,
|
||||
this.cover,
|
||||
super.cover,
|
||||
this.dimension,
|
||||
this.duration,
|
||||
this.enableVt,
|
||||
this.epId,
|
||||
super.epId,
|
||||
this.from,
|
||||
super.id,
|
||||
this.isViewHide,
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
import 'package:PiliPlus/models_new/video/video_detail/arc.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/page.dart';
|
||||
|
||||
abstract class BaseEpisodeItem {
|
||||
class BaseEpisodeItem {
|
||||
int? id;
|
||||
int? aid;
|
||||
int? cid;
|
||||
int? epId;
|
||||
String? bvid;
|
||||
String? badge;
|
||||
String? title;
|
||||
String? cover;
|
||||
|
||||
BaseEpisodeItem({
|
||||
this.id,
|
||||
this.aid,
|
||||
this.cid,
|
||||
this.epId,
|
||||
this.bvid,
|
||||
this.badge,
|
||||
this.title,
|
||||
this.cover,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,6 +30,8 @@ class EpisodeItem extends BaseEpisodeItem {
|
||||
Arc? arc;
|
||||
Part? page;
|
||||
List<Part>? pages;
|
||||
@override
|
||||
String? get cover => arc?.pic;
|
||||
|
||||
EpisodeItem({
|
||||
this.seasonId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
|
||||
class Part {
|
||||
int? cid;
|
||||
class Part extends BaseEpisodeItem {
|
||||
int? page;
|
||||
String? from;
|
||||
String? pagePart;
|
||||
@@ -11,10 +11,9 @@ class Part {
|
||||
Dimension? dimension;
|
||||
int? ctime;
|
||||
String? firstFrame;
|
||||
String? badge;
|
||||
|
||||
Part({
|
||||
this.cid,
|
||||
super.cid,
|
||||
this.page,
|
||||
this.from,
|
||||
this.pagePart,
|
||||
@@ -24,7 +23,7 @@ class Part {
|
||||
this.dimension,
|
||||
this.ctime,
|
||||
this.firstFrame,
|
||||
this.badge,
|
||||
super.badge,
|
||||
});
|
||||
|
||||
factory Part.fromJson(Map<String, dynamic> json) => Part(
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
class Choice {
|
||||
int? id;
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
|
||||
class Choice extends BaseEpisodeItem {
|
||||
String? platformAction;
|
||||
String? nativeAction;
|
||||
String? condition;
|
||||
int? cid;
|
||||
String? option;
|
||||
int? isDefault;
|
||||
|
||||
Choice({
|
||||
this.id,
|
||||
super.id,
|
||||
this.platformAction,
|
||||
this.nativeAction,
|
||||
this.condition,
|
||||
this.cid,
|
||||
super.cid,
|
||||
this.option,
|
||||
this.isDefault,
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ class EpisodePanel extends CommonSlidePage {
|
||||
final int initialTabIndex;
|
||||
final bool? isSupportReverse;
|
||||
final bool? isReversed;
|
||||
final Function onChangeEpisode;
|
||||
final ValueChanged<ugc.BaseEpisodeItem> onChangeEpisode;
|
||||
final VoidCallback? onReverse;
|
||||
final VoidCallback? onClose;
|
||||
|
||||
@@ -330,7 +330,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
||||
|
||||
Widget _buildEpisodeItem({
|
||||
required ThemeData theme,
|
||||
required dynamic episode,
|
||||
required ugc.BaseEpisodeItem episode,
|
||||
required int index,
|
||||
required int length,
|
||||
required bool isCurrentIndex,
|
||||
@@ -379,7 +379,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (episode.badge != null && episode.badge == "会员") {
|
||||
if (episode.badge == "会员") {
|
||||
UserInfoData? userInfo = GStorage.userInfo.get('userInfoCache');
|
||||
int vipStatus = userInfo?.vipStatus ?? 0;
|
||||
if (vipStatus != 1) {
|
||||
@@ -392,14 +392,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
|
||||
if (!widget.showTitle) {
|
||||
_currentItemIndex = index;
|
||||
}
|
||||
final isEpisode = episode is ugc.BaseEpisodeItem;
|
||||
widget.onChangeEpisode(
|
||||
episode is pgc.EpisodeItem ? episode.epId : null,
|
||||
isEpisode ? episode.bvid : widget.bvid,
|
||||
episode.cid,
|
||||
isEpisode ? episode.aid : widget.aid,
|
||||
cover,
|
||||
);
|
||||
widget.onChangeEpisode(episode);
|
||||
if (widget.type == EpisodeType.season) {
|
||||
try {
|
||||
Get.find<VideoDetailController>(
|
||||
|
||||
@@ -329,29 +329,23 @@ class VideoDetailController extends GetxController
|
||||
);
|
||||
if (res['status']) {
|
||||
MediaListData data = res['data'];
|
||||
if (data.mediaList?.isNotEmpty == true) {
|
||||
if (data.mediaList.isNotEmpty) {
|
||||
if (isReverse) {
|
||||
mediaList.value = data.mediaList!;
|
||||
try {
|
||||
mediaList.value = data.mediaList;
|
||||
for (var item in mediaList) {
|
||||
if (item.cid != null) {
|
||||
try {
|
||||
Get.find<UgcIntroController>(
|
||||
tag: heroTag,
|
||||
).onChangeEpisode(
|
||||
null,
|
||||
item.bvid,
|
||||
item.cid,
|
||||
item.aid,
|
||||
item.cover,
|
||||
);
|
||||
).onChangeEpisode(item);
|
||||
} catch (_) {}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
} else if (isLoadPrevious) {
|
||||
mediaList.insertAll(0, data.mediaList!);
|
||||
mediaList.insertAll(0, data.mediaList);
|
||||
} else {
|
||||
mediaList.addAll(data.mediaList!);
|
||||
mediaList.addAll(data.mediaList);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -364,11 +358,9 @@ class VideoDetailController extends GetxController
|
||||
if (mediaList.isNotEmpty) {
|
||||
Widget panel() => MediaListPanel(
|
||||
mediaList: mediaList,
|
||||
changeMediaList: (bvid, cid, aid, cover) {
|
||||
onChangeEpisode: (episode) {
|
||||
try {
|
||||
Get.find<UgcIntroController>(
|
||||
tag: heroTag,
|
||||
).onChangeEpisode(null, bvid, cid, aid, cover);
|
||||
Get.find<UgcIntroController>(tag: heroTag).onChangeEpisode(episode);
|
||||
} catch (_) {}
|
||||
},
|
||||
panelTitle: watchLaterTitle,
|
||||
@@ -904,13 +896,7 @@ class VideoDetailController extends GetxController
|
||||
Get.find<UgcIntroController>(tag: heroTag);
|
||||
Part part =
|
||||
ugcIntroController.videoDetail.value.pages![item];
|
||||
ugcIntroController.onChangeEpisode(
|
||||
null,
|
||||
bvid,
|
||||
part.cid,
|
||||
IdUtils.bv2av(bvid),
|
||||
null,
|
||||
);
|
||||
ugcIntroController.onChangeEpisode(part);
|
||||
SmartDialog.showToast('已跳至第${item + 1}P');
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('$e');
|
||||
|
||||
@@ -5,11 +5,14 @@ import 'package:PiliPlus/grpc/bilibili/app/viewunite/pgcanymodel.pb.dart'
|
||||
show ViewPgcAny;
|
||||
import 'package:PiliPlus/grpc/view.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/pgc_lcf.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
||||
import 'package:PiliPlus/models_new/triple/pgc_triple.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart'
|
||||
hide EpisodeItem;
|
||||
import 'package:PiliPlus/models_new/video/video_detail/stat_detail.dart';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
|
||||
@@ -20,6 +23,7 @@ import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -257,7 +261,18 @@ class PgcIntroController extends CommonIntroController {
|
||||
}
|
||||
|
||||
// 修改分P或番剧分集
|
||||
void onChangeEpisode(dynamic epId, bvid, cid, aid, cover) {
|
||||
Future<void> onChangeEpisode(BaseEpisodeItem episode) async {
|
||||
try {
|
||||
final int epId = episode.epId!;
|
||||
final String bvid = episode.bvid ?? this.bvid;
|
||||
final int aid = episode.aid ?? IdUtils.bv2av(bvid);
|
||||
final int? cid =
|
||||
episode.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
if (cid == null) {
|
||||
return;
|
||||
}
|
||||
final String? cover = episode.cover;
|
||||
|
||||
// 重新获取视频资源
|
||||
this.epId = epId;
|
||||
this.bvid = bvid;
|
||||
@@ -271,7 +286,7 @@ class PgcIntroController extends CommonIntroController {
|
||||
..bvid = bvid
|
||||
..cid.value = cid
|
||||
..queryVideoUrl();
|
||||
if (cover is String && cover.isNotEmpty) {
|
||||
if (cover != null && cover.isNotEmpty) {
|
||||
videoDetailCtr.cover.value = cover;
|
||||
}
|
||||
|
||||
@@ -292,6 +307,9 @@ class PgcIntroController extends CommonIntroController {
|
||||
this.cid.value = cid;
|
||||
queryVideoIntro();
|
||||
queryOnlineTotal();
|
||||
} catch (e) {
|
||||
debugPrint('pgc onChangeEpisode: $e');
|
||||
}
|
||||
}
|
||||
|
||||
// 追番
|
||||
@@ -342,14 +360,7 @@ class PgcIntroController extends CommonIntroController {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
final episode = episodes[prevIndex];
|
||||
onChangeEpisode(
|
||||
episode.epId,
|
||||
episode.bvid,
|
||||
episode.cid,
|
||||
episode.aid,
|
||||
episode.cover,
|
||||
);
|
||||
onChangeEpisode(episodes[prevIndex]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -377,14 +388,7 @@ class PgcIntroController extends CommonIntroController {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
final episode = episodes[nextIndex];
|
||||
onChangeEpisode(
|
||||
episode.epId,
|
||||
episode.bvid,
|
||||
episode.cid,
|
||||
episode.aid,
|
||||
episode.cover,
|
||||
);
|
||||
onChangeEpisode(episodes[nextIndex]);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'dart:async';
|
||||
import 'package:PiliPlus/models/user/info.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/new_ep.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart'
|
||||
hide EpisodeItem;
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -23,7 +25,7 @@ class PgcPanel extends StatefulWidget {
|
||||
|
||||
final List<EpisodeItem> pages;
|
||||
final int? cid;
|
||||
final Function onChangeEpisode;
|
||||
final ValueChanged<BaseEpisodeItem> onChangeEpisode;
|
||||
final Function showEpisodes;
|
||||
final String heroTag;
|
||||
final NewEp? newEp;
|
||||
@@ -149,18 +151,10 @@ class _PgcPanelState extends State<PgcPanel> {
|
||||
child: InkWell(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
||||
onTap: () {
|
||||
if (item.badge != null &&
|
||||
item.badge == '会员' &&
|
||||
vipStatus != 1) {
|
||||
if (item.badge == '会员' && vipStatus != 1) {
|
||||
SmartDialog.showToast('需要大会员');
|
||||
}
|
||||
widget.onChangeEpisode(
|
||||
item.epId,
|
||||
item.bvid,
|
||||
item.cid,
|
||||
item.aid,
|
||||
item.cover,
|
||||
);
|
||||
widget.onChangeEpisode(item);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
||||
@@ -465,7 +465,17 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
}
|
||||
|
||||
// 修改分P或番剧分集
|
||||
bool onChangeEpisode(dynamic epid, bvid, cid, aid, cover, [isStein]) {
|
||||
Future<void> onChangeEpisode(BaseEpisodeItem episode, {bool? isStein}) async {
|
||||
try {
|
||||
final String bvid = episode.bvid ?? this.bvid;
|
||||
final int aid = episode.aid ?? IdUtils.bv2av(bvid);
|
||||
final int? cid =
|
||||
episode.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
if (cid == null) {
|
||||
return;
|
||||
}
|
||||
final String? cover = episode.cover;
|
||||
|
||||
// 重新获取视频资源
|
||||
final videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||
|
||||
@@ -475,11 +485,11 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
PageUtils.toVideoPage(
|
||||
'bvid=$bvid&cid=$cid',
|
||||
arguments: {
|
||||
'pic': cover,
|
||||
'pic': ?cover,
|
||||
'heroTag': Utils.makeHeroTag(bvid),
|
||||
},
|
||||
);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +499,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
..updateMediaListHistory(aid)
|
||||
..onReset(isStein)
|
||||
..bvid = bvid
|
||||
..oid.value = aid ?? IdUtils.bv2av(bvid)
|
||||
..oid.value = aid
|
||||
..cid.value = cid
|
||||
..queryVideoUrl();
|
||||
|
||||
@@ -497,7 +507,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
reload = true;
|
||||
aiConclusionResult = null;
|
||||
|
||||
if (cover is String && cover.isNotEmpty) {
|
||||
if (cover != null && cover.isNotEmpty) {
|
||||
videoDetailCtr.cover.value = cover;
|
||||
}
|
||||
|
||||
@@ -526,7 +536,9 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
|
||||
this.cid.value = cid;
|
||||
queryOnlineTotal();
|
||||
return true;
|
||||
} catch (e) {
|
||||
debugPrint('ugc onChangeEpisode: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -538,7 +550,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
/// 播放上一个
|
||||
@override
|
||||
bool prevPlay([bool skipPages = false]) {
|
||||
final List episodes = [];
|
||||
final List<BaseEpisodeItem> episodes = <BaseEpisodeItem>[];
|
||||
bool isPages = false;
|
||||
|
||||
final videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||
@@ -566,7 +578,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
? videoDetail.isPageReversed == true
|
||||
? videoDetail.pages!.last.cid
|
||||
: videoDetail.pages!.first.cid
|
||||
: this.cid.value),
|
||||
: cid.value),
|
||||
);
|
||||
int prevIndex = currentIndex - 1;
|
||||
final PlayRepeat playRepeat = videoDetailCtr.plPlayerController.playRepeat;
|
||||
@@ -583,10 +595,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
final int cid = episodes[prevIndex].cid!;
|
||||
final String rBvid = isPages ? bvid : episodes[prevIndex].bvid;
|
||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[prevIndex].aid!;
|
||||
onChangeEpisode(null, rBvid, cid, rAid, null);
|
||||
onChangeEpisode(episodes[prevIndex]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -594,7 +603,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
@override
|
||||
bool nextPlay([bool skipPages = false]) {
|
||||
try {
|
||||
final List episodes = [];
|
||||
final List<BaseEpisodeItem> episodes = <BaseEpisodeItem>[];
|
||||
bool isPages = false;
|
||||
final videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||
final videoDetail = this.videoDetail.value;
|
||||
@@ -671,10 +680,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
}
|
||||
cid = episodes[nextIndex].cid!;
|
||||
}
|
||||
|
||||
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
||||
onChangeEpisode(null, rBvid, cid, rAid, null);
|
||||
onChangeEpisode(episodes[nextIndex]);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
@@ -703,29 +709,14 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
}
|
||||
|
||||
final firstItem = relatedCtr.loadingState.value.data!.first;
|
||||
try {
|
||||
if (firstItem.cid != null) {
|
||||
onChangeEpisode(
|
||||
null,
|
||||
firstItem.bvid,
|
||||
firstItem.cid,
|
||||
firstItem.aid,
|
||||
firstItem.cover,
|
||||
);
|
||||
} else {
|
||||
SearchHttp.ab2c(aid: firstItem.aid, bvid: firstItem.bvid).then(
|
||||
(cid) => onChangeEpisode(
|
||||
null,
|
||||
firstItem.bvid,
|
||||
cid,
|
||||
firstItem.aid,
|
||||
firstItem.cover,
|
||||
BaseEpisodeItem(
|
||||
aid: firstItem.aid,
|
||||
bvid: firstItem.bvid,
|
||||
cid: firstItem.cid,
|
||||
cover: firstItem.cover,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
SmartDialog.showToast(err.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,6 @@ class _UgcIntroPanelState extends State<UgcIntroPanel>
|
||||
.horizontalSeasonPanel))
|
||||
SeasonPanel(
|
||||
heroTag: widget.heroTag,
|
||||
onChangeEpisode: ugcIntroController.onChangeEpisode,
|
||||
showEpisodes: widget.showEpisodes,
|
||||
ugcIntroController: ugcIntroController,
|
||||
),
|
||||
|
||||
@@ -156,13 +156,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
||||
if (widget.showEpisodes == null) {
|
||||
Get.back();
|
||||
}
|
||||
widget.ugcIntroController.onChangeEpisode(
|
||||
null,
|
||||
widget.bvid,
|
||||
item.cid,
|
||||
IdUtils.bv2av(widget.bvid),
|
||||
widget.cover,
|
||||
);
|
||||
widget.ugcIntroController.onChangeEpisode(item);
|
||||
if (widget.list != null &&
|
||||
widget
|
||||
.ugcIntroController
|
||||
|
||||
@@ -11,13 +11,11 @@ import 'package:get/get.dart';
|
||||
class SeasonPanel extends StatefulWidget {
|
||||
const SeasonPanel({
|
||||
super.key,
|
||||
required this.onChangeEpisode,
|
||||
required this.heroTag,
|
||||
required this.showEpisodes,
|
||||
this.onTap,
|
||||
required this.ugcIntroController,
|
||||
});
|
||||
final Function onChangeEpisode;
|
||||
final String heroTag;
|
||||
final Function showEpisodes;
|
||||
final bool? onTap;
|
||||
|
||||
@@ -6,10 +6,10 @@ import 'package:PiliPlus/common/widgets/image/image_save.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/stat_type.dart';
|
||||
import 'package:PiliPlus/models_new/media_list/media_list.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
import 'package:PiliPlus/pages/common/common_collapse_slide_page.dart';
|
||||
import 'package:PiliPlus/utils/duration_util.dart';
|
||||
import 'package:flutter/material.dart' hide RefreshCallback;
|
||||
@@ -22,7 +22,7 @@ class MediaListPanel extends CommonCollapseSlidePage {
|
||||
const MediaListPanel({
|
||||
super.key,
|
||||
required this.mediaList,
|
||||
this.changeMediaList,
|
||||
required this.onChangeEpisode,
|
||||
this.panelTitle,
|
||||
required this.getBvId,
|
||||
required this.loadMoreMedia,
|
||||
@@ -34,7 +34,7 @@ class MediaListPanel extends CommonCollapseSlidePage {
|
||||
});
|
||||
|
||||
final List<MediaListItemModel> mediaList;
|
||||
final Function? changeMediaList;
|
||||
final ValueChanged<BaseEpisodeItem> onChangeEpisode;
|
||||
final String? panelTitle;
|
||||
final Function getBvId;
|
||||
final VoidCallback loadMoreMedia;
|
||||
@@ -162,20 +162,13 @@ class _MediaListPanelState
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
onTap: () {
|
||||
if (item.type != 2) {
|
||||
SmartDialog.showToast('不支持播放该类型视频');
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
String bvid = item.bvid!;
|
||||
int? aid = item.aid;
|
||||
String cover = item.cover ?? '';
|
||||
final int? cid =
|
||||
item.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||
if (cid != null) {
|
||||
widget.changeMediaList?.call(bvid, cid, aid, cover);
|
||||
}
|
||||
widget.onChangeEpisode(item);
|
||||
},
|
||||
onLongPress: () => imageSaveDialog(
|
||||
title: item.title,
|
||||
@@ -206,12 +199,12 @@ class _MediaListPanelState
|
||||
width: boxConstraints.maxWidth,
|
||||
height: boxConstraints.maxHeight,
|
||||
),
|
||||
if (item.badge?.text?.isNotEmpty == true)
|
||||
if (item.badge?.isNotEmpty == true)
|
||||
PBadge(
|
||||
text: item.badge?.text,
|
||||
text: item.badge,
|
||||
right: 6.0,
|
||||
top: 6.0,
|
||||
type: switch (item.badge?.text) {
|
||||
type: switch (item.badge) {
|
||||
'充电专属' => PBadgeType.error,
|
||||
_ => PBadgeType.primary,
|
||||
},
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/models/member/info.dart';
|
||||
import 'package:PiliPlus/models_new/space/space_archive/item.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
import 'package:PiliPlus/pages/member_video/widgets/video_card_h_member_video.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart';
|
||||
@@ -17,7 +18,6 @@ import 'package:PiliPlus/pages/video/member/controller.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/grid.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/num_util.dart';
|
||||
import 'package:PiliPlus/utils/request_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -200,18 +200,14 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
videoItem: videoItem,
|
||||
bvid: _bvid,
|
||||
onTap: () {
|
||||
final status = widget.ugcIntroController
|
||||
.onChangeEpisode(
|
||||
null,
|
||||
videoItem.bvid,
|
||||
videoItem.cid,
|
||||
IdUtils.bv2av(videoItem.bvid!),
|
||||
videoItem.cover,
|
||||
Get.back();
|
||||
widget.ugcIntroController.onChangeEpisode(
|
||||
BaseEpisodeItem(
|
||||
bvid: videoItem.bvid,
|
||||
cid: videoItem.cid,
|
||||
cover: videoItem.cover,
|
||||
),
|
||||
);
|
||||
if (status) {
|
||||
_bvid = videoItem.bvid;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -11,9 +11,7 @@ import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/main.dart';
|
||||
import 'package:PiliPlus/models/common/episode_panel_type.dart';
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/episode.dart' as pgc;
|
||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/page.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_tag/data.dart';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||
@@ -1771,12 +1769,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
),
|
||||
onPressed: () {
|
||||
ugcIntroController.onChangeEpisode(
|
||||
null,
|
||||
videoDetailController.bvid,
|
||||
item.cid,
|
||||
IdUtils.bv2av(videoDetailController.bvid),
|
||||
null,
|
||||
true,
|
||||
item,
|
||||
isStein: true,
|
||||
);
|
||||
videoDetailController.getSteinEdgeInfo(
|
||||
item.id,
|
||||
@@ -1968,7 +1962,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
child: SeasonPanel(
|
||||
heroTag: heroTag,
|
||||
onTap: false,
|
||||
onChangeEpisode: ugcIntroController.onChangeEpisode,
|
||||
showEpisodes: showEpisodes,
|
||||
ugcIntroController: ugcIntroController,
|
||||
),
|
||||
@@ -2153,22 +2146,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
return;
|
||||
}
|
||||
|
||||
void onChangeEpisode(episode) {
|
||||
final isEpisode = episode is BaseEpisodeItem;
|
||||
final isPgc = episode is pgc.EpisodeItem;
|
||||
ugcIntroController.onChangeEpisode(
|
||||
isPgc ? episode.epId : null,
|
||||
isEpisode ? episode.bvid : bvid,
|
||||
episode.cid,
|
||||
isEpisode ? episode.aid : aid,
|
||||
episode is EpisodeItem
|
||||
? episode.arc?.pic
|
||||
: isPgc
|
||||
? episode.cover
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
final videoDetail = ugcIntroController.videoDetail.value;
|
||||
if (isSeason) {
|
||||
// reverse season
|
||||
@@ -2194,7 +2171,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
.episodes!
|
||||
.first;
|
||||
if (episode.cid != videoDetailController.cid.value) {
|
||||
onChangeEpisode(episode);
|
||||
ugcIntroController.onChangeEpisode(episode);
|
||||
videoDetailController.seasonCid = episode.cid;
|
||||
} else {
|
||||
videoDetailController
|
||||
@@ -2214,7 +2191,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
// switch to first episode
|
||||
var episode = videoDetail.pages!.first;
|
||||
if (episode.cid != videoDetailController.cid.value) {
|
||||
onChangeEpisode(episode);
|
||||
ugcIntroController.onChangeEpisode(episode);
|
||||
} else {
|
||||
videoDetailController.cid.refresh();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
super.initState();
|
||||
duration = Duration(seconds: widget.duration);
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(duration);
|
||||
widget.onSubmitted(duration);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class BackwardSeekIndicatorState extends State<BackwardSeekIndicator> {
|
||||
void increment() {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(duration);
|
||||
widget.onSubmitted(duration);
|
||||
});
|
||||
setState(() {
|
||||
duration += Duration(seconds: widget.duration);
|
||||
|
||||
@@ -26,7 +26,7 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
super.initState();
|
||||
duration = Duration(seconds: widget.duration);
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(duration);
|
||||
widget.onSubmitted(duration);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class ForwardSeekIndicatorState extends State<ForwardSeekIndicator> {
|
||||
void increment() {
|
||||
timer?.cancel();
|
||||
timer = Timer(const Duration(milliseconds: 400), () {
|
||||
widget.onSubmitted.call(duration);
|
||||
widget.onSubmitted(duration);
|
||||
});
|
||||
setState(() {
|
||||
duration += Duration(seconds: widget.duration);
|
||||
|
||||
Reference in New Issue
Block a user