handleCapturedLocationState method
Future<void>
handleCapturedLocationState(
- LocationState locationState,
- BuildContext context,
- DeliverInterventionState deliverInterventionState,
- FormGroup form,
- HouseholdMemberWrapper householdMember,
- ProjectBeneficiaryModel projectBeneficiary,
Implementation
Future<void> handleCapturedLocationState(
LocationState locationState,
BuildContext context,
DeliverInterventionState deliverInterventionState,
FormGroup form,
HouseholdMemberWrapper householdMember,
ProjectBeneficiaryModel projectBeneficiary) async {
final lat = locationState.latitude;
final long = locationState.longitude;
context.read<DeliverInterventionBloc>().add(
DeliverInterventionSubmitEvent(
task: _getTaskModel(
context,
form: form,
oldTask: RegistrationDeliverySingleton().beneficiaryType ==
BeneficiaryType.household
? deliverInterventionState.tasks?.lastOrNull
: null,
projectBeneficiaryClientReferenceId:
projectBeneficiary.clientReferenceId,
dose: deliverInterventionState.dose,
cycle: deliverInterventionState.cycle,
deliveryStrategy: DeliverStrategyType.direct.toValue(),
address: householdMember.members?.first.address?.first,
latitude: lat,
longitude: long,
),
isEditing: (deliverInterventionState.tasks ?? []).isNotEmpty &&
RegistrationDeliverySingleton().beneficiaryType ==
BeneficiaryType.household
? true
: false,
boundaryModel: RegistrationDeliverySingleton().boundary!,
navigateToSummary: true,
householdMemberWrapper: householdMember),
);
context.router.push(DeliverySummaryRoute());
}