mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
39 lines
1.0 KiB
Dart
39 lines
1.0 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:PiliPlus/http/live.dart';
|
|
import 'package:PiliPlus/http/loading_state.dart';
|
|
import 'package:PiliPlus/models/live/live_area_list/area_item.dart';
|
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
|
import 'package:PiliPlus/utils/storage.dart';
|
|
|
|
class LiveAreaDatailController
|
|
extends CommonListController<List<AreaItem>?, AreaItem> {
|
|
LiveAreaDatailController(this.areaId, this.parentAreaId);
|
|
final dynamic areaId;
|
|
final dynamic parentAreaId;
|
|
|
|
late int initialIndex = 0;
|
|
final isLogin = Accounts.main.isLogin;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
queryData();
|
|
}
|
|
|
|
@override
|
|
List<AreaItem>? getDataList(List<AreaItem>? response) {
|
|
if (response?.isNotEmpty == true) {
|
|
initialIndex = max(0, response!.indexWhere((e) => e.id == areaId));
|
|
}
|
|
return response;
|
|
}
|
|
|
|
@override
|
|
Future<LoadingState<List<AreaItem>?>> customGetData() =>
|
|
LiveHttp.liveRoomAreaList(
|
|
isLogin: isLogin,
|
|
parentid: parentAreaId,
|
|
);
|
|
}
|