feat: live feedback (#2456)

This commit is contained in:
My-Responsitories
2026-07-21 08:49:37 +00:00
committed by GitHub
parent 2d389424af
commit 3a5636ecee
8 changed files with 251 additions and 77 deletions

View File

@@ -1,3 +1,4 @@
import 'package:PiliPlus/models_new/live/live_feed_index/feedback.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/watched_show.dart';
import 'package:PiliPlus/utils/parse_string.dart';
@@ -14,6 +15,7 @@ class CardLiveItem {
int? areaV2Id;
int? areaV2ParentId;
WatchedShow? watchedShow;
List<Feedback>? feedback;
CardLiveItem({
this.roomid,
@@ -27,6 +29,7 @@ class CardLiveItem {
this.areaV2Id,
this.areaV2ParentId,
this.watchedShow,
this.feedback,
}) : _systemCover = nonNullOrEmptyString(systemCover);
factory CardLiveItem.fromJson(Map<String, dynamic> json) => CardLiveItem(
@@ -43,5 +46,8 @@ class CardLiveItem {
watchedShow: json['watched_show'] == null
? null
: WatchedShow.fromJson(json['watched_show'] as Map<String, dynamic>),
feedback: (json['feedback'] as List?)
?.map((x) => Feedback.fromJson(x))
.toList(),
);
}

View File

@@ -0,0 +1,47 @@
class Feedback {
Feedback({
this.title,
this.subtitle,
this.type,
this.reasons,
});
final String? title;
final String? subtitle;
final String? type;
final List<Reason>? reasons;
factory Feedback.fromJson(Map<String, dynamic> json) {
return Feedback(
title: json['title'],
subtitle: json['subtitle'],
type: json['type'],
reasons: (json['reasons'] as List?)
?.map((x) => Reason.fromJson(x))
.toList(),
);
}
}
class Reason {
Reason({
this.id,
this.name,
this.idType,
this.reasonId,
});
final int? id;
final String? name;
final String? idType;
final int? reasonId;
factory Reason.fromJson(Map<String, dynamic> json) {
return Reason(
id: json['id'],
name: json['name'],
idType: json['id_type'],
reasonId: json['reason_id'],
);
}
}