Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-mobile
Commits
74c47d78
Commit
74c47d78
authored
2 years ago
by
devendra
Browse files
Options
Download
Patches
Plain Diff
Feat: Pass location in the submit inspection api
parent
ef4e3a5e
master
add-assessor-location
two-lead-assessor
1 merge request
!2
Add assessor location
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/pages/application_details_page.dart
+13
-1
lib/pages/application_details_page.dart
lib/pages/inspection_summary.dart
+1
-11
lib/pages/inspection_summary.dart
with
14 additions
and
12 deletions
+14
-12
lib/pages/application_details_page.dart
+
13
−
1
View file @
74c47d78
...
...
@@ -19,6 +19,8 @@ import 'package:smf_mobile/widgets/people_card.dart';
import
'package:smf_mobile/widgets/silverappbar_delegate.dart'
;
import
'package:flutter_gen/gen_l10n/app_localizations.dart'
;
import
'dart:async'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:smf_mobile/services/location_service.dart'
;
// import 'package:connectivity_plus/connectivity_plus.dart';
// import 'package:smf_mobile/util/connectivity_helper.dart';
...
...
@@ -262,16 +264,26 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
Future
<
void
>
_submitInspection
()
async
{
bool
isInternetConnected
=
await
Helper
.
isInternetConnected
();
Position
position
;
// await Future.delayed(const Duration(milliseconds: 10));
if
(
isInternetConnected
)
{
_validateUser
();
}
try
{
position
=
await
LocationService
.
getCurrentPosition
();
}
catch
(
error
)
{
Helper
.
toastMessage
(
error
.
toString
());
return
;
}
if
(
_isleadInspector
)
{
Map
data
=
{
'applicationId'
:
widget
.
application
.
applicationId
,
'userId'
:
_userId
,
'dataObject'
:
_data
'dataObject'
:
_data
,
'latitude'
:
position
.
latitude
,
'longitude'
:
position
.
longitude
,
};
//Validate assessment form to make sure some inputs are given by the assessor
...
...
This diff is collapsed.
Click to expand it.
lib/pages/inspection_summary.dart
+
1
−
11
View file @
74c47d78
...
...
@@ -7,8 +7,6 @@ import 'package:smf_mobile/constants/color_constants.dart';
// import 'package:smf_mobile/models/form_model.dart';
import
'package:smf_mobile/pages/login_email_page.dart'
;
import
'package:smf_mobile/repositories/application_repository.dart'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:smf_mobile/services/location_service.dart'
;
// import 'package:smf_mobile/repositories/form_repository.dart';
import
'package:smf_mobile/util/helper.dart'
;
import
'package:smf_mobile/widgets/people_card.dart'
;
...
...
@@ -128,16 +126,7 @@ class _InspectionSummaryPageState extends State<InspectionSummaryPage> {
}
Future
<
void
>
_submitInspection
()
async
{
Position
position
;
bool
isInternetConnected
=
await
Helper
.
isInternetConnected
();
try
{
position
=
await
LocationService
.
getCurrentPosition
();
}
catch
(
error
)
{
Helper
.
toastMessage
(
error
.
toString
());
return
;
}
// await Future.delayed(const Duration(milliseconds: 10));
if
(
isInternetConnected
)
{
_validateUser
();
...
...
@@ -154,6 +143,7 @@ class _InspectionSummaryPageState extends State<InspectionSummaryPage> {
'Enter the summary of this inspection'
:
_summaryController
.
text
}
};
print
(
data
);
final
responseCode
=
await
Provider
.
of
<
ApplicationRespository
>(
context
,
listen:
false
)
.
submitInspection
(
isInternetConnected
,
data
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets