Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

87 do not allow the user to take a picture if gps position isnt precise enough #107

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"gpsIsDisableContent": "Merci d'activer votre GPS, l'application ne peut pas fonctionner sans ca",
"gpsIsDisableTitle": "GPS non activé",
"goToGpsEnable": "activate GPS",
"meters": "meters",
"lowGpsAccuracyTitle": "Mauvaise précision de la localisation GPS",
"lowGpsAccuracyDesc": "Placez-vous en extérieur et patientez",
"meters": "m",

"newSequenceNameField": "Name",
"newSequenceNameField_placeholder": "Enter the new sequence name",
Expand Down
4 changes: 3 additions & 1 deletion lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"gpsIsDisableContent": "Merci d'activer votre GPS, l'application ne peut pas fonctionner sans",
"gpsIsDisableTitle": "GPS non activé",
"goToGpsEnable": "Activer le GPS",
"meters": "mètres",
"lowGpsAccuracyTitle": "Mauvaise précision de la localisation GPS",
"lowGpsAccuracyDesc": "Placez-vous en extérieur et patientez",
"meters": "m",

"newSequenceNameField": "Nom",
"newSequenceNameField_placeholder": "Saisissez le nom de la nouvelle séquence",
Expand Down
24 changes: 21 additions & 3 deletions lib/page/capture_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,12 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
),
),
cameraPreview(),
accurancyComponent(),
if (_accuracy != null && _accuracy! > 10) accurancyComponent(),
(!isPortraitOrientation)
? landscapeLayout(context)
: portraitLayout(context),
if (_isProcessing) processingLoader(context)
if (_isProcessing) processingLoader(context),
if (_accuracy != null && _accuracy! > 10) alertDialogGpsAccurency()
]);
},
);
Expand Down Expand Up @@ -310,7 +311,7 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
style: TextStyle(
color: _accuracy! > 10 ? Colors.red : Colors.blue),
child: Text(
"${_accuracy?.toStringAsFixed(2)} ${AppLocalizations.of(context)!.meters}"),
"${_accuracy?.toInt()} ${AppLocalizations.of(context)!.meters}"),
)
])));
}
Expand Down Expand Up @@ -533,6 +534,13 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
: _isBurstPlay
? const Color.fromARGB(255, 89, 42, 39)
: Colors.white),
child: _accuracy == null || _accuracy! > 10
? Icon(
Icons.gps_fixed,
color: Colors.red,
size: 40,
)
: Container(),
),
tooltip: AppLocalizations.of(context)!.capture),
);
Expand Down Expand Up @@ -579,6 +587,16 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
);
}

Widget alertDialogGpsAccurency() {
return AlertDialog(
title: Text(AppLocalizations.of(context)!.lowGpsAccuracyTitle),
content: Text(AppLocalizations.of(context)!.lowGpsAccuracyDesc),
backgroundColor: BLUE,
titleTextStyle: TextStyle(color: Colors.white),
contentTextStyle: TextStyle(color: Colors.white),
);
}

Future<void> showGPSDialog() async {
return showDialog<void>(
context: context,
Expand Down