diff --git a/android/app/src/main/res/drawable/flutter_devs.png b/android/app/src/main/res/drawable/flutter_devs.png new file mode 100644 index 0000000000000000000000000000000000000000..275d9ad266027529356df93df0097f05ea3e9889 Binary files /dev/null and b/android/app/src/main/res/drawable/flutter_devs.png differ diff --git a/lib/pages/application_details_page.dart b/lib/pages/application_details_page.dart index 431340ab26939fbd3b133f689cb06584fd10154a..3798fcb58242eb98f34955ea285cfa1f61d63666 100644 --- a/lib/pages/application_details_page.dart +++ b/lib/pages/application_details_page.dart @@ -127,7 +127,8 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage> _formData = await Provider.of<FormRespository>(context, listen: false) .getFormDetails(widget.application.formId); } catch (_) { - if (mounted) { + // ignore: unnecessary_null_comparison + if (mounted && _formData.id == null) { Helper.toastMessage(AppLocalizations.of(context)!.formNotAvailable); Navigator.popAndPushNamed(context, AppUrl.homePage); } diff --git a/lib/repositories/application_repository.dart b/lib/repositories/application_repository.dart index e157ee39596970f37e18b59fa4e9dfaa79e86007..9fc3d05720c39726cb881c1f6f28c9b9bdd2532a 100644 --- a/lib/repositories/application_repository.dart +++ b/lib/repositories/application_repository.dart @@ -89,6 +89,7 @@ class ApplicationRespository with ChangeNotifier { } else { statusCode = 200; } + // print(_data); return statusCode; } @@ -129,18 +130,22 @@ class ApplicationRespository with ChangeNotifier { } catch (_) { return false; } - if (data1['statusInfo']['statusCode'] != 200 || - data2['statusInfo']['statusCode'] != 200) { - _errorMessage = _data['statusInfo']['errorMessage']; + if (data1['statusInfo'] != null && data2['statusInfo'] != null) { + if (data1['statusInfo']['statusCode'] != 200 || + data2['statusInfo']['statusCode'] != 200) { + _errorMessage = _data['statusInfo']['errorMessage']; + } } - if ((inspections.isNotEmpty && data1['statusInfo']['statusCode']) || - (consents.isNotEmpty && data2['statusInfo']['statusCode'])) { + if ((inspections.isNotEmpty && data1['statusInfo']['statusCode'] == 200) || + (consents.isNotEmpty && data2['statusInfo']['statusCode'] == 200)) { for (var attachment in attachments) { await OfflineModel.deleteAttachments(attachment['attachment']); } await OfflineModel.deleteInspections(); response = true; } + // print(_errorMessage); + // print('Data synced'); return response; } diff --git a/lib/services/application_service.dart b/lib/services/application_service.dart index 8690c021050a0bed9cb56c9b566a009890114887..fbb5fb580a9342b23b1482eee38cef0172515890 100644 --- a/lib/services/application_service.dart +++ b/lib/services/application_service.dart @@ -40,7 +40,7 @@ class ApplicationService extends BaseService { final response = await http.post(Uri.parse(ApiUrl.submitBulkInspection), headers: headers, body: body); - // developer.log(ApiUrl.submitInspection); + // developer.log(ApiUrl.submitBulkInspection); // developer.log(body); // developer.log(response.body); return response; diff --git a/lib/widgets/lead_inspector_application_field.dart b/lib/widgets/lead_inspector_application_field.dart index e75074dc7f22ba9732b3b0697419724baeb6ea9e..e2301c7266994a1cbc15c839f73197e7a217d2ae 100644 --- a/lib/widgets/lead_inspector_application_field.dart +++ b/lib/widgets/lead_inspector_application_field.dart @@ -467,16 +467,20 @@ class _LeadInspectorApplicationFieldState margin: const EdgeInsets.only( right: 10), decoration: BoxDecoration( - color: _radioValue == + color: _radioValue + .toLowerCase() == _options[i] + .toLowerCase() ? AppColors.radioSelected : Colors.transparent, borderRadius: const BorderRadius.all( Radius.circular(4.0)), border: Border.all( - color: _radioValue == + color: _radioValue + .toLowerCase() == _options[i] + .toLowerCase() ? AppColors.primaryBlue : AppColors.black16, ), @@ -537,13 +541,15 @@ class _LeadInspectorApplicationFieldState if (widget.applicationStatus != InspectionStatus .inspectionCompleted && - _radioValue != - FieldValue.correct) { + _radioValue.toLowerCase() != + FieldValue.correct + .toLowerCase()) { _displayCommentDialog(); } }, - icon: _radioValue != - FieldValue.correct && + icon: _radioValue.toLowerCase() != + FieldValue.correct + .toLowerCase() && widget.applicationStatus != InspectionStatus .inspectionCompleted && @@ -566,26 +572,29 @@ class _LeadInspectorApplicationFieldState if (widget.applicationStatus != InspectionStatus .inspectionCompleted && - _radioValue != - FieldValue.correct) { + _radioValue.toLowerCase() != + FieldValue.correct + .toLowerCase()) { _photoOptions(context); } }, - icon: - _radioValue != FieldValue.correct - ? const Icon( - Icons.camera_alt, - color: AppColors.black40, - ) - : const Icon( - Icons.camera_alt_outlined, - color: AppColors.black40, - ), + icon: _radioValue.toLowerCase() != + FieldValue.correct + .toLowerCase() + ? const Icon( + Icons.camera_alt, + color: AppColors.black40, + ) + : const Icon( + Icons.camera_alt_outlined, + color: AppColors.black40, + ), ), ) ], )), - _radioValue != FieldValue.correct && + _radioValue.toLowerCase() != + FieldValue.correct.toLowerCase() && _summaryText != '' ? Container( width: MediaQuery.of(context).size.width, @@ -601,7 +610,8 @@ class _LeadInspectorApplicationFieldState ), )) : const Center(), - _radioValue != FieldValue.correct && + _radioValue.toLowerCase() != + FieldValue.correct.toLowerCase() && _summaryText != '' ? Container( margin: const EdgeInsets.only(top: 10), @@ -625,7 +635,8 @@ class _LeadInspectorApplicationFieldState ), ) : const Center(), - _radioValue != FieldValue.correct && + _radioValue.toLowerCase() != + FieldValue.correct.toLowerCase() && _inspectionValue != '' ? Container( width: MediaQuery.of(context).size.width, @@ -641,7 +652,8 @@ class _LeadInspectorApplicationFieldState ), )) : const Center(), - _radioValue != FieldValue.correct && + _radioValue.toLowerCase() != + FieldValue.correct.toLowerCase() && _inspectionValue != '' ? Container( margin: const EdgeInsets.only(top: 10), @@ -665,7 +677,8 @@ class _LeadInspectorApplicationFieldState ), ) : const Center(), - _radioValue != FieldValue.correct && + _radioValue.toLowerCase() != + FieldValue.correct.toLowerCase() && _attachment != '' ? Container( width: MediaQuery.of(context).size.width, @@ -681,7 +694,8 @@ class _LeadInspectorApplicationFieldState ), )) : const Center(), - _radioValue != FieldValue.correct && + _radioValue.toLowerCase() != + FieldValue.correct.toLowerCase() && _attachment != '' ? Container( margin: const EdgeInsets.only(