mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: send live emote
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
41
lib/pages/live_emote/controller.dart
Normal file
41
lib/pages/live_emote/controller.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:PiliPlus/http/live.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/live/live_emoticons/datum.dart';
|
||||
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LiveEmotePanelController
|
||||
extends CommonListController<List<LiveEmoteDatum>?, LiveEmoteDatum>
|
||||
with GetTickerProviderStateMixin {
|
||||
LiveEmotePanelController(this.roomId);
|
||||
final int roomId;
|
||||
TabController? tabController;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
queryData();
|
||||
}
|
||||
|
||||
@override
|
||||
bool customHandleResponse(
|
||||
bool isRefresh, Success<List<LiveEmoteDatum>?> response) {
|
||||
if (response.response?.isNotEmpty == true) {
|
||||
tabController =
|
||||
TabController(length: response.response!.length, vsync: this);
|
||||
}
|
||||
loadingState.value = response;
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<List<LiveEmoteDatum>?>> customGetData() =>
|
||||
LiveHttp.getLiveEmoticons(roomId: roomId);
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
tabController?.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user