re factor rog
This commit is contained in:
13
lib/features/utils/const.dart
Normal file
13
lib/features/utils/const.dart
Normal file
@ -0,0 +1,13 @@
|
||||
class ConstValues {
|
||||
static const container_svr = "http://container.intranet.sumasen.net:8100";
|
||||
static const server_uri = "https://rogaining.sumasen.net";
|
||||
static const dev_server = "http://localhost:8100";
|
||||
static const dev_ip_server = "http://192.168.8.100:8100";
|
||||
static const dev_home_ip_server = "http://172.20.10.9:8100";
|
||||
static const dev_home_ip_mserver = "http://192.168.1.10:8100";
|
||||
|
||||
static String currentServer() {
|
||||
//return dev_ip_server;
|
||||
return server_uri;
|
||||
}
|
||||
}
|
||||
29
lib/features/utils/distance_calculator.dart
Normal file
29
lib/features/utils/distance_calculator.dart
Normal file
@ -0,0 +1,29 @@
|
||||
import 'dart:math';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
class DistanceCalculatorHS {
|
||||
static const int _radius = 6371; // Radius of the Earth in kilometers
|
||||
|
||||
static double _degreeToRadian(double degree) {
|
||||
return degree * pi / 180;
|
||||
}
|
||||
|
||||
static double calculateDistance(LatLng location1, LatLng location2) {
|
||||
double latDistance =
|
||||
_degreeToRadian(location2.latitude - location1.latitude);
|
||||
double lonDistance =
|
||||
_degreeToRadian(location2.longitude - location1.longitude);
|
||||
|
||||
double a = sin(latDistance / 2) * sin(latDistance / 2) +
|
||||
cos(_degreeToRadian(location1.latitude)) *
|
||||
cos(_degreeToRadian(location2.latitude)) *
|
||||
sin(lonDistance / 2) *
|
||||
sin(lonDistance / 2);
|
||||
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
|
||||
double distance = _radius * c * 1000; // Convert to meters
|
||||
|
||||
return distance;
|
||||
}
|
||||
}
|
||||
17
lib/features/utils/error_reporter.dart
Normal file
17
lib/features/utils/error_reporter.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
final errorReportingProvider = Provider<ErrorReporter>((ref) {
|
||||
return ErrorReporterImpl();
|
||||
});
|
||||
|
||||
class ErrorReporter {
|
||||
void reportError(Object error, StackTrace stackTrace) {}
|
||||
}
|
||||
|
||||
class ErrorReporterImpl extends ErrorReporter {
|
||||
@override
|
||||
void reportError(Object error, StackTrace stackTrace) {
|
||||
// Send error and stackTrace to the server
|
||||
// Include app state if necessary
|
||||
}
|
||||
}
|
||||
2
lib/features/utils/params.dart
Normal file
2
lib/features/utils/params.dart
Normal file
@ -0,0 +1,2 @@
|
||||
int startMinDistance = 150;
|
||||
int minAwayfromStartDistance = 300;
|
||||
Reference in New Issue
Block a user