mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: member card: show prInfo
Closes #571 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPlus/models/space/pr_info.dart';
|
||||
import 'package:PiliPlus/models/space/space_tag_bottom.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
@@ -58,8 +59,8 @@ class Card {
|
||||
String? pendantUrl;
|
||||
@JsonKey(name: 'pendant_title')
|
||||
String? pendantTitle;
|
||||
// @JsonKey(name: 'pr_info')
|
||||
// PrInfo? prInfo;
|
||||
@JsonKey(name: 'pr_info')
|
||||
PrInfo? prInfo;
|
||||
Relation? relation;
|
||||
@JsonKey(name: 'is_deleted')
|
||||
int? isDeleted;
|
||||
@@ -120,7 +121,7 @@ class Card {
|
||||
this.achieve,
|
||||
this.pendantUrl,
|
||||
this.pendantTitle,
|
||||
// this.prInfo,
|
||||
this.prInfo,
|
||||
this.relation,
|
||||
this.isDeleted,
|
||||
this.honours,
|
||||
|
||||
@@ -58,9 +58,9 @@ Card _$CardFromJson(Map<String, dynamic> json) => Card(
|
||||
: Achieve.fromJson(json['achieve'] as Map<String, dynamic>),
|
||||
pendantUrl: json['pendant_url'] as String?,
|
||||
pendantTitle: json['pendant_title'] as String?,
|
||||
// prInfo: json['pr_info'] == null
|
||||
// ? null
|
||||
// : PrInfo.fromJson(json['pr_info'] as Map<String, dynamic>),
|
||||
prInfo: json['pr_info'] == null
|
||||
? null
|
||||
: PrInfo.fromJson(json['pr_info'] as Map<String, dynamic>),
|
||||
relation: json['relation'] == null
|
||||
? null
|
||||
: Relation.fromJson(json['relation'] as Map<String, dynamic>),
|
||||
@@ -131,7 +131,7 @@ Map<String, dynamic> _$CardToJson(Card instance) => <String, dynamic>{
|
||||
'achieve': instance.achieve,
|
||||
'pendant_url': instance.pendantUrl,
|
||||
'pendant_title': instance.pendantTitle,
|
||||
// 'pr_info': instance.prInfo,
|
||||
'pr_info': instance.prInfo,
|
||||
'relation': instance.relation,
|
||||
'is_deleted': instance.isDeleted,
|
||||
'honours': instance.honours,
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
|
||||
class PrInfo {
|
||||
PrInfo();
|
||||
PrInfo(
|
||||
this.content,
|
||||
this.url,
|
||||
this.icon,
|
||||
this.iconNight,
|
||||
this.textColor,
|
||||
this.bgColor,
|
||||
this.textColorNight,
|
||||
this.bgColorNight,
|
||||
);
|
||||
|
||||
factory PrInfo.fromJson(Map<String, dynamic> json) {
|
||||
// TODO: implement fromJson
|
||||
throw UnimplementedError('PrInfo.fromJson($json) is not implemented');
|
||||
}
|
||||
String? content;
|
||||
String? url;
|
||||
String? icon;
|
||||
String? iconNight;
|
||||
String? textColor;
|
||||
String? bgColor;
|
||||
String? textColorNight;
|
||||
String? bgColorNight;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
// TODO: implement toJson
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
PrInfo.fromJson(Map<String, dynamic> json) {
|
||||
content = json['content'];
|
||||
if (content?.isNotEmpty == true) {
|
||||
url = json['url'];
|
||||
icon = json['icon'];
|
||||
iconNight = json['icon_night'];
|
||||
textColor = json['text_color'] ?? "#999999";
|
||||
bgColor = json['bg_color'] ?? "#e7e7e7";
|
||||
textColorNight = json['text_color_night'] ?? "#727272";
|
||||
bgColorNight = json['bg_color_night'] ?? "#2A2A2A";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user