mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-22 03:20:09 +08:00
@@ -14,6 +14,7 @@ class SuperChatItem {
|
||||
String backgroundBottomColor;
|
||||
String backgroundPriceColor;
|
||||
String messageFontColor;
|
||||
int startSime;
|
||||
int endTime;
|
||||
String message;
|
||||
String token;
|
||||
@@ -32,6 +33,7 @@ class SuperChatItem {
|
||||
required this.backgroundBottomColor,
|
||||
required this.backgroundPriceColor,
|
||||
required this.messageFontColor,
|
||||
required this.startSime,
|
||||
required this.endTime,
|
||||
required this.message,
|
||||
required this.token,
|
||||
@@ -40,29 +42,33 @@ class SuperChatItem {
|
||||
this.medalInfo,
|
||||
});
|
||||
|
||||
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,
|
||||
'uinfo': {
|
||||
'medal': {
|
||||
"name": "Medal",
|
||||
"level": Utils.random.nextInt(40),
|
||||
"id": 123,
|
||||
"ruid": 456,
|
||||
"v2_medal_color_start": "#4C7DFF99",
|
||||
"v2_medal_color_text": "#FFFFFF",
|
||||
static SuperChatItem get random {
|
||||
final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
return SuperChatItem.fromJson({
|
||||
"id": Utils.random.nextInt(2147483647),
|
||||
"uid": 0,
|
||||
"price": 66,
|
||||
"start_time": now,
|
||||
"end_time": now + 5,
|
||||
"message": Utils.generateRandomString(55),
|
||||
"user_info": {
|
||||
"face": "",
|
||||
"uname": "UNAME",
|
||||
},
|
||||
},
|
||||
});
|
||||
'token': '',
|
||||
'ts': now,
|
||||
'uinfo': {
|
||||
'medal': {
|
||||
"name": "Medal",
|
||||
"level": Utils.random.nextInt(40),
|
||||
"id": 123,
|
||||
"ruid": 456,
|
||||
"v2_medal_color_start": "#4C7DFF99",
|
||||
"v2_medal_color_text": "#FFFFFF",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
factory SuperChatItem.fromJson(Map<String, dynamic> json) => SuperChatItem(
|
||||
id: safeToInt(json['id']) ?? Utils.random.nextInt(2147483647),
|
||||
@@ -73,6 +79,7 @@ class SuperChatItem {
|
||||
backgroundBottomColor: json['background_bottom_color'] ?? '#2A60B2',
|
||||
backgroundPriceColor: json['background_price_color'] ?? '#7497CD',
|
||||
messageFontColor: json['message_font_color'] ?? '#FFFFFF',
|
||||
startSime: safeToInt(json['start_time'])!,
|
||||
endTime: safeToInt(json['end_time'])!,
|
||||
message: json['message'],
|
||||
token: json['token'],
|
||||
@@ -91,6 +98,7 @@ class SuperChatItem {
|
||||
String? backgroundBottomColor,
|
||||
String? backgroundPriceColor,
|
||||
String? messageFontColor,
|
||||
int? startSime,
|
||||
int? endTime,
|
||||
String? message,
|
||||
String? token,
|
||||
@@ -108,6 +116,7 @@ class SuperChatItem {
|
||||
backgroundBottomColor ?? this.backgroundBottomColor,
|
||||
backgroundPriceColor: backgroundPriceColor ?? this.backgroundPriceColor,
|
||||
messageFontColor: messageFontColor ?? this.messageFontColor,
|
||||
startSime: startSime ?? this.startSime,
|
||||
endTime: endTime ?? this.endTime,
|
||||
message: message ?? this.message,
|
||||
token: token ?? this.token,
|
||||
@@ -126,6 +135,7 @@ class SuperChatItem {
|
||||
'background_bottom_color': backgroundBottomColor,
|
||||
'background_price_color': backgroundPriceColor,
|
||||
'message_font_color': messageFontColor,
|
||||
'start_time': startSime,
|
||||
'end_time': endTime,
|
||||
'message': message,
|
||||
'token': token,
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:PiliPlus/common/widgets/scroll_physics.dart'
|
||||
import 'package:PiliPlus/models_new/live/live_superchat/item.dart';
|
||||
import 'package:PiliPlus/pages/member/widget/medal_widget.dart';
|
||||
import 'package:PiliPlus/utils/color_utils.dart';
|
||||
import 'package:PiliPlus/utils/date_utils.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
@@ -168,6 +169,32 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget price = Text("¥${item.price}", style: TextStyle(color: bottomColor));
|
||||
Widget? remains;
|
||||
if (_remains != null) {
|
||||
remains = Obx(
|
||||
() => Text(
|
||||
_remains.toString(),
|
||||
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
price = Row(
|
||||
crossAxisAlignment: .end,
|
||||
mainAxisAlignment: .spaceBetween,
|
||||
children: [
|
||||
price,
|
||||
Text(
|
||||
DateFormatUtils.format(
|
||||
item.startSime,
|
||||
format: DateFormatUtils.longFormatDs,
|
||||
),
|
||||
style: TextStyle(color: bottomColor, fontSize: 13.5),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisSize: .min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@@ -203,29 +230,10 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
child: Column(
|
||||
mainAxisSize: .min,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
name,
|
||||
Text(
|
||||
"¥${item.price}",
|
||||
style: TextStyle(
|
||||
color: ColourUtils.parseColor(
|
||||
item.backgroundPriceColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
children: [name, price],
|
||||
),
|
||||
),
|
||||
if (_remains != null)
|
||||
Obx(
|
||||
() => Text(
|
||||
_remains.toString(),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
?remains,
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -238,6 +246,7 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
padding: const .all(8),
|
||||
child: SelectableText(
|
||||
item.message,
|
||||
selectionColor: Colors.black26,
|
||||
scrollPhysics: const NeverSelectableScrollPhysics(),
|
||||
style: TextStyle(
|
||||
color: ColourUtils.parseColor(item.messageFontColor),
|
||||
|
||||
Reference in New Issue
Block a user