mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 04:00:28 +08:00
@@ -3,40 +3,60 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
class SuperChatItem {
|
||||
int id;
|
||||
int? uid;
|
||||
int? price;
|
||||
int uid;
|
||||
int price;
|
||||
String backgroundColor;
|
||||
String backgroundBottomColor;
|
||||
String backgroundPriceColor;
|
||||
String messageFontColor;
|
||||
int endTime;
|
||||
String message;
|
||||
String token;
|
||||
int ts;
|
||||
UserInfo userInfo;
|
||||
bool expired = false;
|
||||
|
||||
SuperChatItem({
|
||||
required this.id,
|
||||
required this.uid,
|
||||
this.price,
|
||||
required this.price,
|
||||
required this.backgroundColor,
|
||||
required this.backgroundBottomColor,
|
||||
required this.backgroundPriceColor,
|
||||
required this.messageFontColor,
|
||||
required this.endTime,
|
||||
required this.message,
|
||||
required this.token,
|
||||
required this.ts,
|
||||
required this.userInfo,
|
||||
});
|
||||
|
||||
static SuperChatItem get random => SuperChatItem.fromJson({
|
||||
"id": Utils.random.nextInt(2147483647),
|
||||
"uid": 0,
|
||||
"price": 66,
|
||||
"end_time": DateTime.now().millisecondsSinceEpoch ~/ 1000 + 5,
|
||||
"message": Utils.generateRandomString(55),
|
||||
"user_info": {
|
||||
"face": "",
|
||||
"uname": "UNAME",
|
||||
},
|
||||
'token': '',
|
||||
'ts': 0,
|
||||
});
|
||||
|
||||
factory SuperChatItem.fromJson(Map<String, dynamic> json) => SuperChatItem(
|
||||
id: json['id'] ?? Utils.random.nextInt(2147483647),
|
||||
uid: json['uid'],
|
||||
price: json['price'] as int?,
|
||||
id: Utils.safeToInt(json['id']) ?? Utils.random.nextInt(2147483647),
|
||||
uid: Utils.safeToInt(json['uid'])!,
|
||||
price: json['price'],
|
||||
backgroundColor: json['background_color'] ?? '#EDF5FF',
|
||||
backgroundBottomColor: json['background_bottom_color'] ?? '#2A60B2',
|
||||
backgroundPriceColor: json['background_price_color'] ?? '#7497CD',
|
||||
messageFontColor: json['message_font_color'] ?? '#FFFFFF',
|
||||
endTime: json['end_time'],
|
||||
endTime: Utils.safeToInt(json['end_time'])!,
|
||||
message: json['message'],
|
||||
token: json['token'],
|
||||
ts: Utils.safeToInt(json['ts'])!,
|
||||
userInfo: UserInfo.fromJson(json['user_info'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
@@ -50,6 +70,8 @@ class SuperChatItem {
|
||||
String? messageFontColor,
|
||||
int? endTime,
|
||||
String? message,
|
||||
String? token,
|
||||
int? ts,
|
||||
UserInfo? userInfo,
|
||||
bool? expired,
|
||||
}) {
|
||||
@@ -64,6 +86,8 @@ class SuperChatItem {
|
||||
messageFontColor: messageFontColor ?? this.messageFontColor,
|
||||
endTime: endTime ?? this.endTime,
|
||||
message: message ?? this.message,
|
||||
token: token ?? this.token,
|
||||
ts: ts ?? this.ts,
|
||||
userInfo: userInfo ?? this.userInfo,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user