Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

86 always display the gps precision mode #102

Merged
merged 3 commits into from
Sep 11, 2024
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
1 change: 1 addition & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"gpsIsDisableContent": "Merci d'activer votre GPS, l'application ne peut pas fonctionner sans ca",
"gpsIsDisableTitle": "GPS non activé",
"goToGpsEnable": "activate GPS",
"meters": "meters",

"newSequenceNameField": "Name",
"newSequenceNameField_placeholder": "Enter the new sequence name",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"gpsIsDisableContent": "Merci d'activer votre GPS, l'application ne peut pas fonctionner sans",
"gpsIsDisableTitle": "GPS non activé",
"goToGpsEnable": "Activer le GPS",
"meters": "mètres",

"newSequenceNameField": "Nom",
"newSequenceNameField_placeholder": "Saisissez le nom de la nouvelle séquence",
Expand Down
36 changes: 34 additions & 2 deletions lib/page/capture_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
accuracy: LocationAccuracy.high,
distanceFilter: 2, //The minimum distance (in meters) to trigger an update
);
double? _accuracy;

late final GravityOrientationDetector _orientationDetector;
var isPortraitOrientation = true;
Expand Down Expand Up @@ -107,6 +108,7 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
_positionStream!.listen((Position position) {
setState(() {
_currentPosition = position;
_accuracy = position.accuracy;
});
});
}
Expand Down Expand Up @@ -274,6 +276,7 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
),
),
cameraPreview(),
accurancyComponent(),
(!isPortraitOrientation)
? landscapeLayout(context)
: portraitLayout(context),
Expand All @@ -283,6 +286,33 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
);
}

Widget accurancyComponent() {
return _accuracy == null
? Container()
: Padding(
padding: EdgeInsets.all(32),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
),
padding: EdgeInsets.all(8.0),
child: Row(mainAxisSize: MainAxisSize.min, children: [
Icon(
_accuracy! > 10 ? Icons.error : Icons.gps_fixed,
size: 24,
color: _accuracy! > 10 ? Colors.red : Colors.blue,
),
SizedBox(width: 8),
DefaultTextStyle(
style: TextStyle(
color: _accuracy! > 10 ? Colors.red : Colors.blue),
child: Text(
"${_accuracy?.toStringAsFixed(2)} ${AppLocalizations.of(context)!.meters}"),
)
])));
}

Widget createBurstButtons() {
return Container(
padding: EdgeInsets.all(24),
Expand Down Expand Up @@ -493,10 +523,12 @@ class _CapturePageState extends State<CapturePage> with WidgetsBindingObserver {
width: 60,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: (_currentPosition == null)
color: (_currentPosition == null ||
_accuracy == null ||
_accuracy! > 10)
? Colors.grey
: _isBurstPlay
? Colors.red
? const Color.fromARGB(255, 89, 42, 39)
: Colors.white),
),
tooltip: AppLocalizations.of(context)!.capture),
Expand Down