mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: custom show argue msg
Closes #63 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -49,6 +49,7 @@ class VideoDetailData {
|
|||||||
Map<String, int>? rights;
|
Map<String, int>? rights;
|
||||||
Owner? owner;
|
Owner? owner;
|
||||||
Stat? stat;
|
Stat? stat;
|
||||||
|
String? argueMsg;
|
||||||
String? videoDynamic;
|
String? videoDynamic;
|
||||||
int? cid;
|
int? cid;
|
||||||
Dimension? dimension;
|
Dimension? dimension;
|
||||||
@@ -87,6 +88,7 @@ class VideoDetailData {
|
|||||||
this.rights,
|
this.rights,
|
||||||
this.owner,
|
this.owner,
|
||||||
this.stat,
|
this.stat,
|
||||||
|
this.argueMsg,
|
||||||
this.videoDynamic,
|
this.videoDynamic,
|
||||||
this.cid,
|
this.cid,
|
||||||
this.dimension,
|
this.dimension,
|
||||||
@@ -128,6 +130,7 @@ class VideoDetailData {
|
|||||||
Map.from(json["rights"]!).map((k, v) => MapEntry<String, int>(k, v));
|
Map.from(json["rights"]!).map((k, v) => MapEntry<String, int>(k, v));
|
||||||
owner = json["owner"] == null ? null : Owner.fromJson(json["owner"]);
|
owner = json["owner"] == null ? null : Owner.fromJson(json["owner"]);
|
||||||
stat = json["stat"] == null ? null : Stat.fromJson(json["stat"]);
|
stat = json["stat"] == null ? null : Stat.fromJson(json["stat"]);
|
||||||
|
argueMsg = json['argue_info']?['argue_msg'];
|
||||||
videoDynamic = json["dynamic"];
|
videoDynamic = json["dynamic"];
|
||||||
cid = json["cid"];
|
cid = json["cid"];
|
||||||
dimension = json["dimension"] == null
|
dimension = json["dimension"] == null
|
||||||
@@ -485,7 +488,6 @@ class Stat {
|
|||||||
int? like;
|
int? like;
|
||||||
int? dislike;
|
int? dislike;
|
||||||
String? evaluation;
|
String? evaluation;
|
||||||
String? argueMsg;
|
|
||||||
|
|
||||||
Stat({
|
Stat({
|
||||||
this.aid,
|
this.aid,
|
||||||
@@ -500,7 +502,6 @@ class Stat {
|
|||||||
this.like,
|
this.like,
|
||||||
this.dislike,
|
this.dislike,
|
||||||
this.evaluation,
|
this.evaluation,
|
||||||
this.argueMsg,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fromRawJson(String str) => Stat.fromJson(json.decode(str));
|
fromRawJson(String str) => Stat.fromJson(json.decode(str));
|
||||||
@@ -520,7 +521,6 @@ class Stat {
|
|||||||
like = json["like"];
|
like = json["like"];
|
||||||
dislike = json["dislike"];
|
dislike = json["dislike"];
|
||||||
evaluation = json["evaluation"];
|
evaluation = json["evaluation"];
|
||||||
argueMsg = json["argue_msg"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@@ -538,7 +538,6 @@ class Stat {
|
|||||||
data["like"] = like;
|
data["like"] = like;
|
||||||
data["dislike"] = dislike;
|
data["dislike"] = dislike;
|
||||||
data["evaluation"] = evaluation;
|
data["evaluation"] = evaluation;
|
||||||
data["argue_msg"] = argueMsg;
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -395,6 +395,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SetSwitchItem(
|
||||||
|
title: '显示视频警告/争议信息',
|
||||||
|
leading: const Icon(Icons.warning_amber_rounded),
|
||||||
|
setKey: SettingBoxKey.showArgueMsg,
|
||||||
|
defaultVal: true,
|
||||||
|
),
|
||||||
Obx(
|
Obx(
|
||||||
() => ListTile(
|
() => ListTile(
|
||||||
enableFeedback: true,
|
enableFeedback: true,
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ class VideoIntroController extends GetxController
|
|||||||
|
|
||||||
ExpandableController? expandableCtr;
|
ExpandableController? expandableCtr;
|
||||||
|
|
||||||
|
late final showArgueMsg = GStorage.showArgueMsg;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|||||||
@@ -427,6 +427,41 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
if (videoIntroController.videoDetail.value.argueMsg?.isNotEmpty ==
|
||||||
|
true &&
|
||||||
|
videoIntroController.showArgueMsg) ...[
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||||
|
child: Text.rich(
|
||||||
|
TextSpan(children: [
|
||||||
|
WidgetSpan(
|
||||||
|
alignment: PlaceholderAlignment.middle,
|
||||||
|
child: Icon(
|
||||||
|
size: 17,
|
||||||
|
Icons.warning_rounded,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text:
|
||||||
|
' ${videoIntroController.videoDetail.value.argueMsg}')
|
||||||
|
]),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
|
|||||||
@@ -145,6 +145,9 @@ class GStorage {
|
|||||||
static double get danmakuLineHeight =>
|
static double get danmakuLineHeight =>
|
||||||
setting.get(SettingBoxKey.danmakuLineHeight, defaultValue: 1.6);
|
setting.get(SettingBoxKey.danmakuLineHeight, defaultValue: 1.6);
|
||||||
|
|
||||||
|
static bool get showArgueMsg =>
|
||||||
|
setting.get(SettingBoxKey.showArgueMsg, defaultValue: true);
|
||||||
|
|
||||||
static List<double> get dynamicDetailRatio =>
|
static List<double> get dynamicDetailRatio =>
|
||||||
setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]);
|
setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]);
|
||||||
|
|
||||||
@@ -346,6 +349,7 @@ class SettingBoxKey {
|
|||||||
horizontalSeasonPanel = 'horizontalSeasonPanel',
|
horizontalSeasonPanel = 'horizontalSeasonPanel',
|
||||||
horizontalMemberPage = 'horizontalMemberPage',
|
horizontalMemberPage = 'horizontalMemberPage',
|
||||||
replyLengthLimit = 'replyLengthLimit',
|
replyLengthLimit = 'replyLengthLimit',
|
||||||
|
showArgueMsg = 'showArgueMsg',
|
||||||
|
|
||||||
// Sponsor Block
|
// Sponsor Block
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
|
|||||||
Reference in New Issue
Block a user