diff --git a/lib/models/video_detail_res.dart b/lib/models/video_detail_res.dart index 72ea23a2..87470c2a 100644 --- a/lib/models/video_detail_res.dart +++ b/lib/models/video_detail_res.dart @@ -49,6 +49,7 @@ class VideoDetailData { Map? rights; Owner? owner; Stat? stat; + String? argueMsg; String? videoDynamic; int? cid; Dimension? dimension; @@ -87,6 +88,7 @@ class VideoDetailData { this.rights, this.owner, this.stat, + this.argueMsg, this.videoDynamic, this.cid, this.dimension, @@ -128,6 +130,7 @@ class VideoDetailData { Map.from(json["rights"]!).map((k, v) => MapEntry(k, v)); owner = json["owner"] == null ? null : Owner.fromJson(json["owner"]); stat = json["stat"] == null ? null : Stat.fromJson(json["stat"]); + argueMsg = json['argue_info']?['argue_msg']; videoDynamic = json["dynamic"]; cid = json["cid"]; dimension = json["dimension"] == null @@ -485,7 +488,6 @@ class Stat { int? like; int? dislike; String? evaluation; - String? argueMsg; Stat({ this.aid, @@ -500,7 +502,6 @@ class Stat { this.like, this.dislike, this.evaluation, - this.argueMsg, }); fromRawJson(String str) => Stat.fromJson(json.decode(str)); @@ -520,7 +521,6 @@ class Stat { like = json["like"]; dislike = json["dislike"]; evaluation = json["evaluation"]; - argueMsg = json["argue_msg"]; } Map toJson() { @@ -538,7 +538,6 @@ class Stat { data["like"] = like; data["dislike"] = dislike; data["evaluation"] = evaluation; - data["argue_msg"] = argueMsg; return data; } } diff --git a/lib/pages/setting/extra_setting.dart b/lib/pages/setting/extra_setting.dart index c237af89..b4edc1bb 100644 --- a/lib/pages/setting/extra_setting.dart +++ b/lib/pages/setting/extra_setting.dart @@ -395,6 +395,12 @@ class _ExtraSettingState extends State { ); }, ), + SetSwitchItem( + title: '显示视频警告/争议信息', + leading: const Icon(Icons.warning_amber_rounded), + setKey: SettingBoxKey.showArgueMsg, + defaultVal: true, + ), Obx( () => ListTile( enableFeedback: true, diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 623179c9..621d1033 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -80,6 +80,8 @@ class VideoIntroController extends GetxController ExpandableController? expandableCtr; + late final showArgueMsg = GStorage.showArgueMsg; + @override void onInit() { super.onInit(); diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index c1fca201..00144edf 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -427,6 +427,41 @@ class _VideoInfoState extends State 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), GestureDetector( behavior: HitTestBehavior.translucent, diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 20572e6a..a3c365bc 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -145,6 +145,9 @@ class GStorage { static double get danmakuLineHeight => setting.get(SettingBoxKey.danmakuLineHeight, defaultValue: 1.6); + static bool get showArgueMsg => + setting.get(SettingBoxKey.showArgueMsg, defaultValue: true); + static List get dynamicDetailRatio => setting.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]); @@ -346,6 +349,7 @@ class SettingBoxKey { horizontalSeasonPanel = 'horizontalSeasonPanel', horizontalMemberPage = 'horizontalMemberPage', replyLengthLimit = 'replyLengthLimit', + showArgueMsg = 'showArgueMsg', // Sponsor Block enableSponsorBlock = 'enableSponsorBlock',