mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-29 22:00:16 +08:00
@@ -132,7 +132,7 @@ class Word {
|
||||
style = json['style'] == null ? null : Style.fromJson(json['style']);
|
||||
if (json['color'] case final String rawColor
|
||||
when rawColor.startsWith('#')) {
|
||||
color = ColourUtils.parse2Int(json['color']);
|
||||
color = ColourUtils.parse2Int(rawColor);
|
||||
}
|
||||
fontLevel = json['font_level'];
|
||||
}
|
||||
|
||||
@@ -1,41 +1,43 @@
|
||||
import 'package:PiliPlus/models_new/follow/list.dart';
|
||||
import 'package:PiliPlus/utils/parse_int.dart';
|
||||
|
||||
class FollowUpModel {
|
||||
FollowUpModel({
|
||||
this.liveUsers,
|
||||
required this.upList,
|
||||
});
|
||||
|
||||
LiveUsers? liveUsers;
|
||||
late List<UpItem> upList;
|
||||
bool? hasMore;
|
||||
String? offset;
|
||||
|
||||
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||
liveUsers = json['live_users'] != null
|
||||
? LiveUsers.fromJson(json['live_users'])
|
||||
: null;
|
||||
upList =
|
||||
(json['up_list']?['items'] as List?)
|
||||
?.map<UpItem>((e) => UpItem.fromJson(e))
|
||||
.toList() ??
|
||||
<UpItem>[];
|
||||
hasMore = json['up_list']?['has_more'];
|
||||
offset = json['up_list']?['offset'];
|
||||
}
|
||||
}
|
||||
|
||||
class DynUpList {
|
||||
List<UpItem>? upList;
|
||||
bool? hasMore;
|
||||
String? offset;
|
||||
|
||||
DynUpList.fromJson(Map<String, dynamic> json) {
|
||||
upList = (json['items'] as List?)
|
||||
?.map<UpItem>((e) => UpItem.fromJson(e))
|
||||
void addAllUpList(List<UpItem> newList) {
|
||||
if (upList != null) {
|
||||
upList!.addAll(newList);
|
||||
} else {
|
||||
upList = newList;
|
||||
}
|
||||
}
|
||||
|
||||
factory FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||
final model = FollowUpModel.fromUpList(json['up_list']);
|
||||
final liveUsers = json['live_users'];
|
||||
if (liveUsers != null) {
|
||||
model.liveUsers = LiveUsers.fromJson(liveUsers);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
FollowUpModel.fromUpList(Map<String, dynamic>? json) {
|
||||
if (json != null) {
|
||||
upList = (json['items'] as List?)
|
||||
?.map((e) => UpItem.fromJson(e))
|
||||
.toList();
|
||||
hasMore = json['has_more'];
|
||||
offset = json['offset'];
|
||||
}
|
||||
}
|
||||
|
||||
FollowUpModel.fromFollowList(Map<String, dynamic> json) {
|
||||
upList = (json['list'] as List?)
|
||||
?.map((e) => FollowItemModel.fromJson(e))
|
||||
.toList();
|
||||
hasMore = json['has_more'];
|
||||
offset = json['offset'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user