show medal wall

show user follow time

show top image title

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-03-20 22:12:43 +08:00
parent 662ccfcf0a
commit ae59d257c3
21 changed files with 927 additions and 222 deletions

View File

@@ -0,0 +1,30 @@
import 'package:PiliPlus/models_new/live/live_medal_wall/item.dart';
class MedalWallData {
List<MedalWallItem>? list;
int? count;
String? name;
String? icon;
int? uid;
int? level;
MedalWallData({
this.list,
this.count,
this.name,
this.icon,
this.uid,
this.level,
});
factory MedalWallData.fromJson(Map<String, dynamic> json) => MedalWallData(
list: (json['list'] as List<dynamic>?)
?.map((e) => MedalWallItem.fromJson(e as Map<String, dynamic>))
.toList(),
count: json['count'] as int?,
name: json['name'] as String?,
icon: json['icon'] as String?,
uid: json['uid'] as int?,
level: json['level'] as int?,
);
}

View File

@@ -0,0 +1,36 @@
import 'package:PiliPlus/models_new/live/live_medal_wall/medal_info.dart';
import 'package:PiliPlus/models_new/live/live_medal_wall/uinfo_medal.dart';
class MedalWallItem {
MedalInfo? medalInfo;
String? targetName;
String? targetIcon;
String? link;
int? liveStatus;
int? official;
UinfoMedal? uinfoMedal;
MedalWallItem({
this.medalInfo,
this.targetName,
this.targetIcon,
this.link,
this.liveStatus,
this.official,
this.uinfoMedal,
});
factory MedalWallItem.fromJson(Map<String, dynamic> json) => MedalWallItem(
medalInfo: json['medal_info'] == null
? null
: MedalInfo.fromJson(json['medal_info'] as Map<String, dynamic>),
targetName: json['target_name'] as String?,
targetIcon: json['target_icon'] as String?,
link: json['link'] as String?,
liveStatus: json['live_status'] as int?,
official: json['official'] as int?,
uinfoMedal: json['uinfo_medal'] == null
? null
: UinfoMedal.fromJson(json['uinfo_medal'] as Map<String, dynamic>),
);
}

View File

@@ -0,0 +1,11 @@
class MedalInfo {
int? wearingStatus;
MedalInfo({
this.wearingStatus,
});
factory MedalInfo.fromJson(Map<String, dynamic> json) => MedalInfo(
wearingStatus: json['wearing_status'] as int?,
);
}

View File

@@ -0,0 +1,41 @@
class UinfoMedal {
String? name;
int? level;
int? colorBorder;
int? color;
int? id;
int? ruid;
String? v2MedalColorStart;
String? v2MedalColorEnd;
String? v2MedalColorBorder;
String? v2MedalColorText;
String? v2MedalColorLevel;
UinfoMedal({
this.name,
this.level,
this.colorBorder,
this.color,
this.id,
this.ruid,
this.v2MedalColorStart,
this.v2MedalColorEnd,
this.v2MedalColorBorder,
this.v2MedalColorText,
this.v2MedalColorLevel,
});
factory UinfoMedal.fromJson(Map<String, dynamic> json) => UinfoMedal(
name: json['name'] as String?,
level: json['level'] as int?,
colorBorder: json['color_border'] as int?,
color: json['color'] as int?,
id: json['id'] as int?,
ruid: json['ruid'] as int?,
v2MedalColorStart: json['v2_medal_color_start'] as String?,
v2MedalColorEnd: json['v2_medal_color_end'] as String?,
v2MedalColorBorder: json['v2_medal_color_border'] as String?,
v2MedalColorText: json['v2_medal_color_text'] as String?,
v2MedalColorLevel: json['v2_medal_color_level'] as String?,
);
}

View File

@@ -0,0 +1,25 @@
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
class RelationData {
int? mid;
int? attribute;
int? mtime;
List<int>? tag;
int? special;
RelationData({
this.mid,
this.attribute,
this.mtime,
this.tag,
this.special,
});
factory RelationData.fromJson(Map<String, dynamic> json) => RelationData(
mid: json['mid'] as int?,
attribute: json['attribute'] as int?,
mtime: json['mtime'] as int?,
tag: (json['tag'] as List<dynamic>?)?.fromCast(),
special: json['special'] as int?,
);
}

View File

@@ -1,28 +1,50 @@
class LiveFansWearing {
int? level;
String? medalName;
int? medalColorStart;
int? medalColorEnd;
int? medalColorBorder;
String? medalJumpUrl;
DetailV2? detailV2;
LiveFansWearing({
this.level,
this.medalName,
this.medalColorStart,
this.medalColorEnd,
this.medalColorBorder,
this.medalJumpUrl,
this.detailV2,
});
factory LiveFansWearing.fromJson(Map<String, dynamic> json) {
return LiveFansWearing(
level: json['level'] as int?,
medalName: json['medal_name'] as String?,
medalColorStart: json['medal_color_start'] as int?,
medalColorEnd: json['medal_color_end'] as int?,
medalColorBorder: json['medal_color_border'] as int?,
medalJumpUrl: json['medal_jump_url'] as String?,
detailV2: json['detail_v2'] == null
? null
: DetailV2.fromJson(json['detail_v2']),
);
}
}
class DetailV2 {
int? uid;
int? level;
String? medalColorLevel;
String? medalColorName;
String? medalName;
int? medalId;
String? medalColor;
String? medalColorBorder;
DetailV2({
this.uid,
this.level,
this.medalColorLevel,
this.medalColorName,
this.medalName,
this.medalId,
this.medalColor,
this.medalColorBorder,
});
factory DetailV2.fromJson(Map<String, dynamic> json) {
return DetailV2(
uid: json["uid"],
level: json["level"],
medalColorLevel: json["medal_color_level"],
medalColorName: json["medal_color_name"],
medalName: json["medal_name"],
medalId: json["medal_id"],
medalColor: json["medal_color"],
medalColorBorder: json["medal_color_border"],
);
}
}

View File

@@ -1,3 +1,4 @@
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
import 'package:PiliPlus/utils/parse_string.dart';
class Top {
@@ -20,16 +21,18 @@ class TopImage {
late final String fullCover;
String get header => _defaultImage ?? fullCover;
late final double dy;
TopTitle? title;
@pragma('vm:notify-debugger-on-exception')
TopImage.fromJson(Map<String, dynamic> json) {
_defaultImage = noneNullOrEmptyString(
json['item']['image']?['default_image'],
);
final item = json['item'];
final img = item['image'];
title = json['title'] == null ? null : TopTitle.fromJson(json['title']);
_defaultImage = noneNullOrEmptyString(img?['default_image']);
fullCover = json['cover'];
double dy = 0;
try {
final Map image = json['item']['image'] ?? json['item']['animation'];
final Map image = img ?? item['animation'];
if (image['location'] case String locStr when (locStr.isNotEmpty)) {
final location = locStr
.split('-')
@@ -48,3 +51,36 @@ class TopImage {
this.dy = dy;
}
}
class TopTitle {
String? title;
String? subTitle;
SubTitleColorFormat? subTitleColorFormat;
TopTitle({
this.title,
this.subTitle,
this.subTitleColorFormat,
});
factory TopTitle.fromJson(Map<String, dynamic> json) => TopTitle(
title: json["title"],
subTitle: json["sub_title"],
subTitleColorFormat: json["sub_title_color_format"] == null
? null
: SubTitleColorFormat.fromJson(json["sub_title_color_format"]),
);
}
class SubTitleColorFormat {
List<String>? colors;
SubTitleColorFormat({
this.colors,
});
factory SubTitleColorFormat.fromJson(Map<String, dynamic> json) =>
SubTitleColorFormat(
colors: (json["colors"] as List?)?.fromCast(),
);
}