mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: avatar model (#814)
This commit is contained in:
committed by
GitHub
parent
07d2b3b464
commit
cdeb843a84
@@ -1,27 +1,12 @@
|
||||
import 'package:PiliPlus/models/model_owner.dart';
|
||||
import 'package:PiliPlus/models/model_avatar.dart';
|
||||
import 'package:PiliPlus/models/space_article/nameplate.dart';
|
||||
import 'package:PiliPlus/models/space_article/official_verify.dart';
|
||||
import 'package:PiliPlus/models/space_article/pendant.dart';
|
||||
import 'package:PiliPlus/models/space_article/vip.dart';
|
||||
|
||||
class Author extends Owner {
|
||||
Pendant? pendant;
|
||||
OfficialVerify? officialVerify;
|
||||
class Author extends Avatar {
|
||||
Nameplate? nameplate;
|
||||
Vip? vip;
|
||||
|
||||
Author.fromJson(Map<String, dynamic> json) {
|
||||
mid = json['mid'];
|
||||
name = json['name'] as String?;
|
||||
face = json['face'] as String?;
|
||||
pendant =
|
||||
json['pendant'] == null ? null : Pendant.fromJson(json['pendant']);
|
||||
officialVerify = json['official_verify'] == null
|
||||
? null
|
||||
: OfficialVerify.fromJson(json['official_verify']);
|
||||
Author.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
|
||||
nameplate = json['nameplate'] == null
|
||||
? null
|
||||
: Nameplate.fromJson(json['nameplate']);
|
||||
vip = json['vip'] == null ? null : Vip.fromJson(json['vip']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'official_verify.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class OfficialVerify {
|
||||
int? type;
|
||||
String? desc;
|
||||
|
||||
OfficialVerify({this.type, this.desc});
|
||||
|
||||
factory OfficialVerify.fromJson(Map<String, dynamic> json) {
|
||||
return _$OfficialVerifyFromJson(json);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => _$OfficialVerifyToJson(this);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'official_verify.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
OfficialVerify _$OfficialVerifyFromJson(Map<String, dynamic> json) =>
|
||||
OfficialVerify(
|
||||
type: (json['type'] as num?)?.toInt(),
|
||||
desc: json['desc'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$OfficialVerifyToJson(OfficialVerify instance) =>
|
||||
<String, dynamic>{
|
||||
'type': instance.type,
|
||||
'desc': instance.desc,
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'pendant.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Pendant {
|
||||
int? pid;
|
||||
String? name;
|
||||
String? image;
|
||||
int? expire;
|
||||
|
||||
Pendant({this.pid, this.name, this.image, this.expire});
|
||||
|
||||
factory Pendant.fromJson(Map<String, dynamic> json) {
|
||||
return _$PendantFromJson(json);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => _$PendantToJson(this);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'pendant.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Pendant _$PendantFromJson(Map<String, dynamic> json) => Pendant(
|
||||
pid: (json['pid'] as num?)?.toInt(),
|
||||
name: json['name'] as String?,
|
||||
image: json['image'] as String?,
|
||||
expire: (json['expire'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PendantToJson(Pendant instance) => <String, dynamic>{
|
||||
'pid': instance.pid,
|
||||
'name': instance.name,
|
||||
'image': instance.image,
|
||||
'expire': instance.expire,
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:PiliPlus/models/space_article/label.dart';
|
||||
|
||||
part 'vip.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Vip {
|
||||
int? type;
|
||||
int? status;
|
||||
@JsonKey(name: 'due_date')
|
||||
int? dueDate;
|
||||
@JsonKey(name: 'vip_pay_type')
|
||||
int? vipPayType;
|
||||
@JsonKey(name: 'theme_type')
|
||||
int? themeType;
|
||||
Label? label;
|
||||
@JsonKey(name: 'avatar_subscript')
|
||||
int? avatarSubscript;
|
||||
@JsonKey(name: 'nickname_color')
|
||||
String? nicknameColor;
|
||||
|
||||
Vip({
|
||||
this.type,
|
||||
this.status,
|
||||
this.dueDate,
|
||||
this.vipPayType,
|
||||
this.themeType,
|
||||
this.label,
|
||||
this.avatarSubscript,
|
||||
this.nicknameColor,
|
||||
});
|
||||
|
||||
factory Vip.fromJson(Map<String, dynamic> json) => _$VipFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$VipToJson(this);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'vip.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Vip _$VipFromJson(Map<String, dynamic> json) => Vip(
|
||||
type: (json['type'] as num?)?.toInt(),
|
||||
status: (json['status'] as num?)?.toInt(),
|
||||
dueDate: (json['due_date'] as num?)?.toInt(),
|
||||
vipPayType: (json['vip_pay_type'] as num?)?.toInt(),
|
||||
themeType: (json['theme_type'] as num?)?.toInt(),
|
||||
label: json['label'] == null
|
||||
? null
|
||||
: Label.fromJson(json['label'] as Map<String, dynamic>),
|
||||
avatarSubscript: (json['avatar_subscript'] as num?)?.toInt(),
|
||||
nicknameColor: json['nickname_color'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$VipToJson(Vip instance) => <String, dynamic>{
|
||||
'type': instance.type,
|
||||
'status': instance.status,
|
||||
'due_date': instance.dueDate,
|
||||
'vip_pay_type': instance.vipPayType,
|
||||
'theme_type': instance.themeType,
|
||||
'label': instance.label,
|
||||
'avatar_subscript': instance.avatarSubscript,
|
||||
'nickname_color': instance.nicknameColor,
|
||||
};
|
||||
Reference in New Issue
Block a user