opt: continuePlayingPart

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-04 09:10:33 +08:00
parent b7b4432d71
commit 14f2c34d21
3 changed files with 65 additions and 48 deletions

View File

@@ -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,

View File

@@ -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,12 +1865,16 @@ 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']) {
if (continuePlayingPart) {
continuePlayingPart = false;
try { try {
VideoIntroController videoIntroController = VideoIntroController videoIntroController =
Get.find<VideoIntroController>(tag: heroTag); Get.find<VideoIntroController>(tag: heroTag);
@@ -1900,8 +1904,8 @@ class VideoDetailController extends GetxController
); );
}, },
child: Container( child: Container(
padding: padding: const EdgeInsets.symmetric(
const EdgeInsets.symmetric(horizontal: 8, vertical: 4), horizontal: 8, vertical: 4),
margin: const EdgeInsets.only(bottom: 15), margin: const EdgeInsets.only(bottom: 15),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondaryContainer, color: Theme.of(context).colorScheme.secondaryContainer,
@@ -1911,8 +1915,9 @@ class VideoDetailController extends GetxController
'上次看到第${index + 1}P点击跳转', '上次看到第${index + 1}P点击跳转',
style: TextStyle( style: TextStyle(
fontSize: 14, fontSize: 14,
color: color: Theme.of(context)
Theme.of(context).colorScheme.onSecondaryContainer, .colorScheme
.onSecondaryContainer,
), ),
), ),
), ),
@@ -1922,6 +1927,7 @@ class VideoDetailController extends GetxController
} }
} }
} catch (_) {} } catch (_) {}
}
vttSubtitlesIndex = 0; vttSubtitlesIndex = 0;
if (res["data"] is List && res["data"].isNotEmpty) { if (res["data"] is List && res["data"].isNotEmpty) {

View File

@@ -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',