mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
42 lines
1.1 KiB
Dart
42 lines
1.1 KiB
Dart
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();
|
|
}
|
|
}
|