first commit
This commit is contained in:
25
lib/helper/distance.dart
Normal file
25
lib/helper/distance.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'dart:math';
|
||||
|
||||
/// Calculate distance between two coordinates in km
|
||||
double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
|
||||
const double earthRadius = 6371; // km
|
||||
final dLat = _degreesToRadians(lat2 - lat1);
|
||||
final dLon = _degreesToRadians(lon2 - lon1);
|
||||
|
||||
final a = sin(dLat / 2) * sin(dLat / 2) +
|
||||
cos(_degreesToRadians(lat1)) *
|
||||
cos(_degreesToRadians(lat2)) *
|
||||
sin(dLon / 2) *
|
||||
sin(dLon / 2);
|
||||
|
||||
final c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
final distance = earthRadius * c;
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
double _degreesToRadians(double degrees) {
|
||||
return degrees * pi / 180;
|
||||
}
|
||||
|
||||
|
||||
22
lib/helper/firebase_options.dart
Normal file
22
lib/helper/firebase_options.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (defaultTargetPlatform == TargetPlatform.iOS ||
|
||||
defaultTargetPlatform == TargetPlatform.macOS) {
|
||||
return const FirebaseOptions(
|
||||
apiKey: 'AIzaSyBkzz2Yua74Q9YpzGmUPFP94fmJQqNMIiU',
|
||||
appId: '1:140444764229:ios:d66c3707aaf5c1ed283b2c',
|
||||
messagingSenderId: '140444764229',
|
||||
projectId: 'nearle-gear',
|
||||
storageBucket: 'nearle-gear.appspot.com',
|
||||
iosBundleId: 'com.nearle.gear',
|
||||
);
|
||||
}
|
||||
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
}
|
||||
11
lib/helper/logger.dart
Normal file
11
lib/helper/logger.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:logger/logger.dart';
|
||||
|
||||
var logger = Logger(
|
||||
printer: PrettyPrinter(
|
||||
methodCount: 2, // Number of method calls to be displayed
|
||||
errorMethodCount: 8, // Number of method calls if stacktrace is provided
|
||||
lineLength: 300, // Width of the output
|
||||
colors: true, // Colorful log messages
|
||||
printEmojis: true, // Print an emoji for each log message
|
||||
),
|
||||
);
|
||||
0
lib/helper/store_banner_painter.dart
Normal file
0
lib/helper/store_banner_painter.dart
Normal file
16
lib/helper/toaster.dart
Normal file
16
lib/helper/toaster.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import '../constants/color_constants.dart';
|
||||
|
||||
class Toast{
|
||||
static void showToast(String message){
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
textColor: ColorConstants.secondaryColor,
|
||||
timeInSecForIosWeb: 1,
|
||||
webShowClose: true,
|
||||
backgroundColor: ColorConstants.grey,
|
||||
gravity: ToastGravity.TOP_RIGHT,
|
||||
fontSize: 15.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user