Merge branch 'main' into design
This commit is contained in:
@ -28,7 +28,25 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
episodes = widget.ugcSeason.sections!.first.episodes!;
|
|
||||||
|
/// 根据 cid 找到对应集,找到对应 episodes
|
||||||
|
/// 有多个episodes时,只显示其中一个
|
||||||
|
/// TODO 同时显示多个合集
|
||||||
|
List<SectionItem> sections = widget.ugcSeason.sections!;
|
||||||
|
for (int i = 0; i < sections.length; i++) {
|
||||||
|
List<EpisodeItem> episodesList = sections[i].episodes!;
|
||||||
|
for (int j = 0; j < episodesList.length; j++) {
|
||||||
|
if (episodesList[j].cid == widget.cid) {
|
||||||
|
episodes = episodesList;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 取对应 season_id 的 episodes
|
||||||
|
// episodes = widget.ugcSeason.sections!
|
||||||
|
// .firstWhere((e) => e.seasonId == widget.ugcSeason.id)
|
||||||
|
// .episodes!;
|
||||||
currentIndex = episodes.indexWhere((e) => e.cid == widget.cid);
|
currentIndex = episodes.indexWhere((e) => e.cid == widget.cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +154,7 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(
|
Text(
|
||||||
'${currentIndex + 1}/${widget.ugcSeason.epCount}',
|
'${currentIndex + 1}/${episodes.length}',
|
||||||
style: Theme.of(context).textTheme.labelMedium,
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
|
|||||||
@ -97,7 +97,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
plPlayerController!.pause();
|
|
||||||
plPlayerController!.dispose();
|
plPlayerController!.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -483,10 +483,12 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
size: 15,
|
size: 15,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
fuc: () {
|
fuc: () async {
|
||||||
// 销毁播放器实例
|
// 销毁播放器实例
|
||||||
widget.controller!.dispose(type: 'all');
|
await widget.controller!.dispose(type: 'all');
|
||||||
Get.offAll(const MainApp());
|
if (mounted) {
|
||||||
|
Navigator.popUntil(context, (route) => route.isFirst);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
|||||||
@ -760,36 +760,39 @@ class PlPlayerController {
|
|||||||
|
|
||||||
Future<void> dispose({String type = 'single'}) async {
|
Future<void> dispose({String type = 'single'}) async {
|
||||||
// 每次减1,最后销毁
|
// 每次减1,最后销毁
|
||||||
if (type == 'single') {
|
if (type == 'single' && playerCount.value > 1) {
|
||||||
_playerCount.value -= 1;
|
_playerCount.value -= 1;
|
||||||
_heartDuration = 0;
|
_heartDuration = 0;
|
||||||
if (playerCount.value > 0) {
|
pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
_playerCount.value = 0;
|
||||||
|
try {
|
||||||
_timer?.cancel();
|
_timer?.cancel();
|
||||||
_timerForVolume?.cancel();
|
_timerForVolume?.cancel();
|
||||||
_timerForGettingVolume?.cancel();
|
_timerForGettingVolume?.cancel();
|
||||||
timerForTrackingMouse?.cancel();
|
timerForTrackingMouse?.cancel();
|
||||||
_timerForSeek?.cancel();
|
_timerForSeek?.cancel();
|
||||||
videoFitChangedTimer?.cancel();
|
videoFitChangedTimer?.cancel();
|
||||||
_position.close();
|
// _position.close();
|
||||||
_playerEventSubs?.cancel();
|
_playerEventSubs?.cancel();
|
||||||
_sliderPosition.close();
|
// _sliderPosition.close();
|
||||||
_sliderTempPosition.close();
|
// _sliderTempPosition.close();
|
||||||
_isSliderMoving.close();
|
// _isSliderMoving.close();
|
||||||
_duration.close();
|
// _duration.close();
|
||||||
_buffered.close();
|
// _buffered.close();
|
||||||
_showControls.close();
|
// _showControls.close();
|
||||||
_controlsLock.close();
|
// _controlsLock.close();
|
||||||
|
|
||||||
playerStatus.status.close();
|
// playerStatus.status.close();
|
||||||
dataStatus.status.close();
|
// dataStatus.status.close();
|
||||||
|
|
||||||
removeListeners();
|
removeListeners();
|
||||||
await _videoPlayerController?.dispose();
|
await _videoPlayerController?.dispose();
|
||||||
_videoPlayerController = null;
|
_videoPlayerController = null;
|
||||||
_instance = null;
|
_instance = null;
|
||||||
|
} catch (err) {
|
||||||
|
print(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user