updateDirection method

dynamic updateDirection(
  1. DamageAssessmentResponse response
)

Implementation

updateDirection(DamageAssessmentResponse response) async {
  switch (currentTabIndex.value) {
    case 0:
      longShotImages.assignAll([response.result?.imgUrl ?? '']);

      ///
      if (Get.isRegistered<ClaimMeDirectionDetailController>()) {
        Get.find<ClaimMeDirectionDetailController>().getDirectionImage(1);
        Get.find<ClaimMeDirectionDetailController>().carPartsForCloseUpShot
            .assignAll(carPartsForCloseUpShot.value);
      }
      break;
    case 1:
      middleShotImages.add(response.result?.imgUrl ?? '');
      if (currentReplacedImageId.value.isNotEmpty) {
        middleShotImages.removeAt(0);
      }

      ///
      if (Get.isRegistered<ClaimMeDirectionDetailController>()) {
        Get.find<ClaimMeDirectionDetailController>().getDirectionImage(2);
        Get.find<ClaimMeDirectionDetailController>().carPartsForCloseUpShot
            .assignAll(carPartsForCloseUpShot.value);
      }
      break;
    case 2:
      closeUpShotImages.add(response.result?.imgUrl ?? '');
      if (currentReplacedImageId.value.isNotEmpty) {
        closeUpShotImages.removeAt(0);
      }

      ///
      if (Get.isRegistered<ClaimMeDirectionDetailController>()) {
        Get.find<ClaimMeDirectionDetailController>().getDirectionImage(3);
      }
      break;
  }
  currentReplacedImageId.value = '';

  ///
  if (Get.isRegistered<ClaimMeFolderDetailController>()) {
    await Get.find<ClaimMeFolderDetailController>().getImageDirection();
    Get.find<ClaimMeFolderDetailController>().damageResponseStream.sink.add(
      response,
    );
  }
}