re factor rog

This commit is contained in:
2024-04-01 09:26:56 +05:30
parent dd36ab8399
commit edbf52825b
54 changed files with 2597 additions and 435 deletions

View 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;
}
}

View 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;
}
}

View 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
}
}

View File

@ -0,0 +1,2 @@
int startMinDistance = 150;
int minAwayfromStartDistance = 300;