* tweak

* opt: async

* tweak

* opt: PopularSeries tile

* tweak

* opt: sc

* mod: more account type

* tweak

* opt: qrcode

* tweak

* partial revert: opt: sc

* fix

* fix

* mod: window enqueue
This commit is contained in:
My-Responsitories
2025-09-26 00:02:55 +08:00
committed by GitHub
parent 67c25bd130
commit 4ae3bd2845
29 changed files with 520 additions and 554 deletions

View File

@@ -241,7 +241,7 @@ class LiveRoomController extends GetxController {
Future<void> getSuperChatMsg() async {
final res = await LiveHttp.superChatMsg(roomId);
if (res.dataOrNull?.list case List<SuperChatItem> list) {
if (res.dataOrNull?.list case final list?) {
superChatMsg.addAll(list);
}
}
@@ -377,7 +377,7 @@ class LiveRoomController extends GetxController {
}
}
break;
case 'SUPER_CHAT_MESSAGE' when (showSuperChat):
case 'SUPER_CHAT_MESSAGE' when showSuperChat:
final item = SuperChatItem.fromJson(obj['data']);
superChatMsg.insert(0, item);
if (isFullScreen || plPlayerController.isDesktopPip) {
@@ -385,10 +385,8 @@ class LiveRoomController extends GetxController {
}
break;
}
} catch (e) {
if (kDebugMode) {
debugPrint('$e,,$obj');
}
} catch (_) {
if (kDebugMode) rethrow;
}
})
..init();

View File

@@ -43,9 +43,7 @@ class _SuperChatCardState extends State<SuperChatCard> {
}
void _remove() {
WidgetsBinding.instance.addPostFrameCallback(
(_) => Future.delayed(const Duration(seconds: 1), _onRemove),
);
Future.delayed(const Duration(seconds: 1), _onRemove);
}
void _onRemove() {

View File

@@ -30,10 +30,16 @@ class _SuperChatPanelState extends DebounceStreamState<SuperChatPanel, bool>
padding: const EdgeInsets.symmetric(horizontal: 12),
physics: const ClampingScrollPhysics(),
itemCount: widget.controller.superChatMsg.length,
findChildIndexCallback: (key) {
final index = widget.controller.superChatMsg.indexWhere(
(i) => i.id == (key as ValueKey<int>).value,
);
return index == -1 ? null : index;
},
itemBuilder: (context, index) {
final item = widget.controller.superChatMsg[index];
return SuperChatCard(
key: Key(item.id.toString()),
key: ValueKey(item.id),
item: item,
onRemove: () => ctr?.add(true),
);

View File

@@ -265,7 +265,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
child: TextButton(
onPressed: () {
_liveRoomController.fsSC.value = SuperChatItem.fromJson({
"id": Utils.generateRandomString(8),
"id": Utils.random.nextInt(2147483647),
"price": 66,
"end_time":
DateTime.now().millisecondsSinceEpoch ~/ 1000 + 5,
@@ -300,7 +300,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
}
try {
return SizedBox(
key: Key(item.id.toString()),
key: ValueKey(item.id),
width: 255,
child: Stack(
clipBehavior: Clip.none,
@@ -330,6 +330,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
),
);
} catch (_) {
if (kDebugMode) rethrow;
return const SizedBox.shrink();
}
}),
@@ -740,7 +741,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
liveRoomController: _liveRoomController,
);
return Padding(
padding: EdgeInsets.only(bottom: 12, top: !isPortrait ? 0 : 12),
padding: EdgeInsets.only(bottom: 12, top: isPortrait ? 12 : 0),
child: _liveRoomController.showSuperChat
? PageView(
key: pageKey,

View File

@@ -87,7 +87,7 @@ class LiveRoomChatPanel extends StatelessWidget {
liveRoomController.superChatMsg.insert(
0,
SuperChatItem.fromJson({
"id": Utils.generateRandomString(8),
"id": Utils.random.nextInt(2147483647),
"price": 66,
"end_time":
DateTime.now().millisecondsSinceEpoch ~/ 1000 + 5,