mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
opt: continuePlayingPart
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1573,6 +1573,13 @@ List<SettingsModel> get extraSettings => [
|
|||||||
needReboot: true,
|
needReboot: true,
|
||||||
setKey: SettingBoxKey.badCertificateCallback,
|
setKey: SettingBoxKey.badCertificateCallback,
|
||||||
),
|
),
|
||||||
|
SettingsModel(
|
||||||
|
settingsType: SettingsType.sw1tch,
|
||||||
|
title: '显示继续播放分P提示',
|
||||||
|
leading: Icon(Icons.local_parking),
|
||||||
|
setKey: SettingBoxKey.continuePlayingPart,
|
||||||
|
defaultVal: true,
|
||||||
|
),
|
||||||
SettingsModel(
|
SettingsModel(
|
||||||
settingsType: SettingsType.sw1tch,
|
settingsType: SettingsType.sw1tch,
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
|
|||||||
@@ -1830,9 +1830,9 @@ class VideoDetailController extends GetxController
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Map<String, String>> _vttSubtitles = <Map<String, String>>[];
|
late List<Map<String, String>> _vttSubtitles = <Map<String, String>>[];
|
||||||
int? vttSubtitlesIndex;
|
int? vttSubtitlesIndex;
|
||||||
bool showVP = true;
|
late bool showVP = true;
|
||||||
|
|
||||||
void _getSubtitle() {
|
void _getSubtitle() {
|
||||||
_vttSubtitles.clear();
|
_vttSubtitles.clear();
|
||||||
@@ -1865,63 +1865,69 @@ class VideoDetailController extends GetxController
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late bool continuePlayingPart = GStorage.continuePlayingPart;
|
||||||
|
|
||||||
Future _querySubtitles() async {
|
Future _querySubtitles() async {
|
||||||
Map res = await VideoHttp.subtitlesJson(bvid: bvid, cid: cid.value);
|
Map res = await VideoHttp.subtitlesJson(bvid: bvid, cid: cid.value);
|
||||||
// if (!res["status"]) {
|
// if (!res["status"]) {
|
||||||
// SmartDialog.showToast('查询字幕错误,${res["msg"]}');
|
// SmartDialog.showToast('查询字幕错误,${res["msg"]}');
|
||||||
// }
|
// }
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
try {
|
if (continuePlayingPart) {
|
||||||
VideoIntroController videoIntroController =
|
continuePlayingPart = false;
|
||||||
Get.find<VideoIntroController>(tag: heroTag);
|
try {
|
||||||
if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1 &&
|
VideoIntroController videoIntroController =
|
||||||
res['last_play_cid'] != null &&
|
Get.find<VideoIntroController>(tag: heroTag);
|
||||||
res['last_play_cid'] != 0) {
|
if ((videoIntroController.videoDetail.value.pages?.length ?? 0) > 1 &&
|
||||||
if (res['last_play_cid'] != cid.value) {
|
res['last_play_cid'] != null &&
|
||||||
int index = videoIntroController.videoDetail.value.pages!
|
res['last_play_cid'] != 0) {
|
||||||
.indexWhere((item) => item.cid == res['last_play_cid']);
|
if (res['last_play_cid'] != cid.value) {
|
||||||
if (index != -1) {
|
int index = videoIntroController.videoDetail.value.pages!
|
||||||
SmartDialog.showAttach(
|
.indexWhere((item) => item.cid == res['last_play_cid']);
|
||||||
targetContext: childKey.currentContext,
|
if (index != -1) {
|
||||||
alignment: Alignment.topCenter,
|
SmartDialog.showAttach(
|
||||||
maskColor: Colors.transparent,
|
targetContext: childKey.currentContext,
|
||||||
displayTime: Duration(seconds: 4),
|
alignment: Alignment.topCenter,
|
||||||
builder: (context) => GestureDetector(
|
maskColor: Colors.transparent,
|
||||||
onTap: () {
|
displayTime: Duration(seconds: 4),
|
||||||
SmartDialog.dismiss();
|
builder: (context) => GestureDetector(
|
||||||
Part part =
|
onTap: () {
|
||||||
videoIntroController.videoDetail.value.pages![index];
|
SmartDialog.dismiss();
|
||||||
videoIntroController.changeSeasonOrbangu(
|
Part part =
|
||||||
null,
|
videoIntroController.videoDetail.value.pages![index];
|
||||||
bvid,
|
videoIntroController.changeSeasonOrbangu(
|
||||||
part.cid,
|
null,
|
||||||
IdUtils.bv2av(bvid),
|
bvid,
|
||||||
null,
|
part.cid,
|
||||||
);
|
IdUtils.bv2av(bvid),
|
||||||
},
|
null,
|
||||||
child: Container(
|
);
|
||||||
padding:
|
},
|
||||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
child: Container(
|
||||||
margin: const EdgeInsets.only(bottom: 15),
|
padding: const EdgeInsets.symmetric(
|
||||||
decoration: BoxDecoration(
|
horizontal: 8, vertical: 4),
|
||||||
color: Theme.of(context).colorScheme.secondaryContainer,
|
margin: const EdgeInsets.only(bottom: 15),
|
||||||
borderRadius: BorderRadius.circular(8),
|
decoration: BoxDecoration(
|
||||||
),
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
child: Text(
|
borderRadius: BorderRadius.circular(8),
|
||||||
'上次看到第${index + 1}P,点击跳转',
|
),
|
||||||
style: TextStyle(
|
child: Text(
|
||||||
fontSize: 14,
|
'上次看到第${index + 1}P,点击跳转',
|
||||||
color:
|
style: TextStyle(
|
||||||
Theme.of(context).colorScheme.onSecondaryContainer,
|
fontSize: 14,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryContainer,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (_) {}
|
||||||
} catch (_) {}
|
}
|
||||||
|
|
||||||
vttSubtitlesIndex = 0;
|
vttSubtitlesIndex = 0;
|
||||||
if (res["data"] is List && res["data"].isNotEmpty) {
|
if (res["data"] is List && res["data"].isNotEmpty) {
|
||||||
|
|||||||
@@ -287,6 +287,9 @@ class GStorage {
|
|||||||
static bool get badCertificateCallback =>
|
static bool get badCertificateCallback =>
|
||||||
setting.get(SettingBoxKey.badCertificateCallback, defaultValue: false);
|
setting.get(SettingBoxKey.badCertificateCallback, defaultValue: false);
|
||||||
|
|
||||||
|
static bool get continuePlayingPart =>
|
||||||
|
setting.get(SettingBoxKey.continuePlayingPart, defaultValue: true);
|
||||||
|
|
||||||
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
static List<double> get dynamicDetailRatio => List<double>.from(setting
|
||||||
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
|
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
|
||||||
|
|
||||||
@@ -495,6 +498,7 @@ class SettingBoxKey {
|
|||||||
subtitleBgOpaticy = 'subtitleBgOpaticy',
|
subtitleBgOpaticy = 'subtitleBgOpaticy',
|
||||||
subtitleBgStroke = 'subtitleBgStroke',
|
subtitleBgStroke = 'subtitleBgStroke',
|
||||||
badCertificateCallback = 'badCertificateCallback',
|
badCertificateCallback = 'badCertificateCallback',
|
||||||
|
continuePlayingPart = 'continuePlayingPart',
|
||||||
|
|
||||||
// Sponsor Block
|
// Sponsor Block
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
|
|||||||
Reference in New Issue
Block a user