mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
34 lines
922 B
Dart
34 lines
922 B
Dart
import 'dart:math';
|
|
|
|
import 'package:PiliPlus/http/live.dart';
|
|
import 'package:PiliPlus/http/loading_state.dart';
|
|
import 'package:PiliPlus/models_new/live/live_area_list/area_item.dart';
|
|
import 'package:PiliPlus/pages/common/common_list_controller.dart';
|
|
|
|
class LiveAreaDetailController
|
|
extends CommonListController<List<AreaItem>?, AreaItem> {
|
|
LiveAreaDetailController(this.areaId, this.parentAreaId);
|
|
final dynamic areaId;
|
|
final dynamic parentAreaId;
|
|
|
|
late int initialIndex = 0;
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
queryData();
|
|
}
|
|
|
|
@override
|
|
List<AreaItem>? getDataList(List<AreaItem>? response) {
|
|
if (response != null && response.isNotEmpty) {
|
|
initialIndex = max(0, response.indexWhere((e) => e.id == areaId));
|
|
}
|
|
return response;
|
|
}
|
|
|
|
@override
|
|
Future<LoadingState<List<AreaItem>?>> customGetData() =>
|
|
LiveHttp.liveRoomAreaList(parentid: parentAreaId);
|
|
}
|