feat : location details
This commit is contained in:
@@ -3,7 +3,10 @@ import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/data/model/response/hatching_details/hatching_details.dart';
|
||||
import 'package:rasadyar_inspection/data/model/response/poultry_location/poultry_location_model.dart';
|
||||
import 'package:rasadyar_inspection/data/repositories/inspection/inspection_repository_imp.dart';
|
||||
import 'package:rasadyar_inspection/injection/inspection_di.dart';
|
||||
import 'package:rasadyar_inspection/presentation/widget/base_page/logic.dart';
|
||||
|
||||
class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
@@ -12,6 +15,7 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
RxDouble currentZoom = (15.0).obs;
|
||||
Rx<MapController> mapController = MapController().obs;
|
||||
BaseLogic baseLogic = Get.find<BaseLogic>();
|
||||
InspectionRepositoryImp inspectionRepository = diInspection.get<InspectionRepositoryImp>();
|
||||
|
||||
Rx<LatLng> currentLocation = LatLng(34.798315281272544, 48.51479142983491).obs;
|
||||
RxBool hasFilterOrSearch = false.obs;
|
||||
@@ -31,6 +35,9 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
Rx<Resource<List<PoultryLocationModel>>> filteredLocations =
|
||||
Resource<List<PoultryLocationModel>>.initial().obs;
|
||||
|
||||
Rx<Resource<List<HatchingDetails>>> hatchingDetails =
|
||||
Resource<List<HatchingDetails>>.initial().obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -154,4 +161,29 @@ class MapLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
point.longitude >= bounds.west &&
|
||||
point.longitude <= bounds.east;
|
||||
}
|
||||
|
||||
Future<void> getFullDetailsLocation(PoultryLocationModel model) async {
|
||||
hatchingDetails.value = Resource<List<HatchingDetails>>.loading();
|
||||
await safeCall(
|
||||
call: () => inspectionRepository.getHatchingDetails(
|
||||
code: model.breedingUniqueId,
|
||||
active: (model.hatching != null && model.hatching!.isNotEmpty),
|
||||
),
|
||||
onSuccess: (result) {
|
||||
if (result != null && result.isNotEmpty) {
|
||||
hatchingDetails.value = Resource<List<HatchingDetails>>.success(result);
|
||||
} else {
|
||||
hatchingDetails.value = Resource<List<HatchingDetails>>.empty();
|
||||
}
|
||||
},
|
||||
onError: (error, stackTrace) {
|
||||
hatchingDetails.value = Resource<List<HatchingDetails>>.error('$error / $stackTrace');
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void cleanDataAfterBottomSheet() {
|
||||
eLog('cleanDataAfterBottomSheet');
|
||||
hatchingDetails.value = Resource<List<HatchingDetails>>.initial();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user