mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
committed by
GitHub
parent
1d723b704b
commit
89e6d5c160
@@ -8,7 +8,6 @@ Future<void> showMemberReportDialog(
|
||||
required Object? name,
|
||||
required Object mid,
|
||||
}) {
|
||||
final List<bool> reasonList = List.generate(3, (_) => false);
|
||||
final Set<int> reason = {};
|
||||
int? reasonV2;
|
||||
|
||||
@@ -44,12 +43,11 @@ Future<void> showMemberReportDialog(
|
||||
(index) => Builder(
|
||||
builder: (context) => CheckboxListTile(
|
||||
dense: true,
|
||||
value: reasonList[index],
|
||||
value: reason.contains(index + 1),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
onChanged: (value) {
|
||||
reasonList[index] = value!;
|
||||
if (value) {
|
||||
if (value!) {
|
||||
reason.add(index + 1);
|
||||
} else {
|
||||
reason.remove(index + 1);
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
class Subtitle {
|
||||
String? lan;
|
||||
late String lan;
|
||||
String? lanDoc;
|
||||
String? subtitleUrl;
|
||||
String? subtitleUrlV2;
|
||||
|
||||
Subtitle({
|
||||
this.lan,
|
||||
this.lanDoc,
|
||||
this.subtitleUrl,
|
||||
this.subtitleUrlV2,
|
||||
});
|
||||
bool isAi = false;
|
||||
|
||||
Subtitle.fromJson(Map<String, dynamic> json) {
|
||||
lan = json["lan"];
|
||||
lanDoc = '${json["lan_doc"]}${lan!.startsWith('ai') ? '(AI)' : ''}';
|
||||
isAi = json["type"] == 1;
|
||||
lanDoc = '${json["lan_doc"]}${isAi ? '(AI)' : ''}';
|
||||
subtitleUrl = json["subtitle_url"];
|
||||
subtitleUrlV2 = json["subtitle_url_v2"];
|
||||
}
|
||||
|
||||
@@ -7,22 +7,19 @@ class SubtitleInfo {
|
||||
|
||||
SubtitleInfo({this.lan, this.lanDoc, this.subtitles});
|
||||
|
||||
SubtitleInfo.fromJson(Map<String, dynamic> json) {
|
||||
lan = json['lan'] as String?;
|
||||
lanDoc = json['lan_doc'] as String?;
|
||||
final List? list = json['subtitles'];
|
||||
if (list != null && list.isNotEmpty) {
|
||||
subtitles = <Subtitle>[];
|
||||
int index = 0;
|
||||
for (var e in list) {
|
||||
final item = Subtitle.fromJson(e);
|
||||
if (item.lan!.contains('zh')) {
|
||||
subtitles!.insert(index, item);
|
||||
index++;
|
||||
} else {
|
||||
subtitles!.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
factory SubtitleInfo.fromJson(Map<String, dynamic> json) => SubtitleInfo(
|
||||
lan: json['lan'] as String?,
|
||||
lanDoc: json['lan_doc'] as String?,
|
||||
subtitles:
|
||||
(json['subtitles'] as List<dynamic>?)
|
||||
?.map((e) => Subtitle.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
?..sort((a, b) {
|
||||
final aHasZh = a.lan.contains('zh');
|
||||
final bHasZh = b.lan.contains('zh');
|
||||
if (aHasZh != bHasZh) return aHasZh ? -1 : 1;
|
||||
if (a.isAi != b.isAi) return a.isAi ? 1 : -1;
|
||||
return 0;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1504,22 +1504,22 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
|
||||
if (playInfo.subtitle?.subtitles?.isNotEmpty == true) {
|
||||
int idx = 0;
|
||||
subtitles.value = playInfo.subtitle!.subtitles!;
|
||||
|
||||
SubtitlePrefType preference =
|
||||
SubtitlePrefType.values[Pref.subtitlePreferenceV2];
|
||||
if (preference != SubtitlePrefType.off) {
|
||||
idx = subtitles.indexWhere((i) => !i.lan!.startsWith('ai')) + 1;
|
||||
if (idx == 0) {
|
||||
if (preference == SubtitlePrefType.on ||
|
||||
(Utils.isMobile &&
|
||||
preference == SubtitlePrefType.auto &&
|
||||
(await FlutterVolumeController.getVolume() ?? 0) <= 0)) {
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
final idx = switch (SubtitlePrefType.values[Pref
|
||||
.subtitlePreferenceV2]) {
|
||||
SubtitlePrefType.off => 0,
|
||||
SubtitlePrefType.on => 1,
|
||||
SubtitlePrefType.withoutAi =>
|
||||
subtitles.first.lan.startsWith('ai') ? 0 : 1,
|
||||
SubtitlePrefType.auto =>
|
||||
!subtitles.first.lan.startsWith('ai') ||
|
||||
(Utils.isMobile &&
|
||||
(await FlutterVolumeController.getVolume() ?? 0.0) <=
|
||||
0.0)
|
||||
? 1
|
||||
: 0,
|
||||
};
|
||||
setSubtitle(idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1487,29 +1487,36 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
IgnorePointer(
|
||||
child: Obx(() {
|
||||
final int value =
|
||||
plPlayerController.sliderPositionSeconds.value;
|
||||
final int max =
|
||||
plPlayerController.durationSeconds.value.inSeconds;
|
||||
final int buffer =
|
||||
plPlayerController.bufferedSeconds.value;
|
||||
if (value > max || max <= 0) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return ProgressBar(
|
||||
progress: Duration(seconds: value),
|
||||
buffered: Duration(seconds: buffer),
|
||||
total: Duration(seconds: max),
|
||||
progressBarColor: primary,
|
||||
baseBarColor: Colors.white.withValues(alpha: 0.2),
|
||||
bufferedBarColor: primary.withValues(alpha: 0.4),
|
||||
timeLabelLocation: TimeLabelLocation.none,
|
||||
thumbColor: primary,
|
||||
barHeight: 3.5,
|
||||
thumbRadius: draggingFixedProgressBar.value ? 7 : 2.5,
|
||||
);
|
||||
}),
|
||||
child: RepaintBoundary.wrap(
|
||||
Obx(() {
|
||||
final int value =
|
||||
plPlayerController.sliderPositionSeconds.value;
|
||||
final int max = plPlayerController
|
||||
.durationSeconds
|
||||
.value
|
||||
.inSeconds;
|
||||
final int buffer =
|
||||
plPlayerController.bufferedSeconds.value;
|
||||
if (value > max || max <= 0) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return ProgressBar(
|
||||
progress: Duration(seconds: value),
|
||||
buffered: Duration(seconds: buffer),
|
||||
total: Duration(seconds: max),
|
||||
progressBarColor: primary,
|
||||
baseBarColor: const Color(0x33FFFFFF),
|
||||
bufferedBarColor: primary.withValues(alpha: 0.4),
|
||||
timeLabelLocation: TimeLabelLocation.none,
|
||||
thumbColor: primary,
|
||||
barHeight: 3.5,
|
||||
thumbRadius: draggingFixedProgressBar.value
|
||||
? 7
|
||||
: 2.5,
|
||||
);
|
||||
}),
|
||||
0,
|
||||
),
|
||||
),
|
||||
if (plPlayerController.enableSponsorBlock &&
|
||||
videoDetailController.segmentProgressList.isNotEmpty)
|
||||
@@ -1518,15 +1525,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
right: 0,
|
||||
bottom: 0.75,
|
||||
child: IgnorePointer(
|
||||
child: RepaintBoundary(
|
||||
child: CustomPaint(
|
||||
key: const Key('segmentList'),
|
||||
child: RepaintBoundary.wrap(
|
||||
CustomPaint(
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors:
|
||||
videoDetailController.segmentProgressList,
|
||||
),
|
||||
),
|
||||
1,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -1538,15 +1545,15 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
right: 0,
|
||||
bottom: 0.75,
|
||||
child: IgnorePointer(
|
||||
child: RepaintBoundary(
|
||||
child: CustomPaint(
|
||||
key: const Key('viewPointList'),
|
||||
child: RepaintBoundary.wrap(
|
||||
CustomPaint(
|
||||
size: const Size(double.infinity, 3.5),
|
||||
painter: SegmentProgressBar(
|
||||
segmentColors:
|
||||
videoDetailController.viewPointList,
|
||||
),
|
||||
),
|
||||
2,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user