diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 13e875a..a1411e9 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -5,494 +5,462 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 4c005e4..cb79f3d 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml b/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml index 9c05673..ed40f7f 100644 --- a/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml +++ b/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,7 @@ + + - - diff --git a/Sources/dafl_project_flutter/ios/Runner/Info.plist b/Sources/dafl_project_flutter/ios/Runner/Info.plist index c060fb6..a818c87 100644 --- a/Sources/dafl_project_flutter/ios/Runner/Info.plist +++ b/Sources/dafl_project_flutter/ios/Runner/Info.plist @@ -47,5 +47,13 @@ UIApplicationSupportsIndirectInputEvents + NSLocationWhenInUseUsageDescription + This app needs access to location when open. + + NSLocationAlwaysUsageDescription + This app needs access to location when in the background. + + NSLocationAlwaysAndWhenInUseUsageDescription + This app needs access to location when open and in the background. diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index a8d6a98..cb038cc 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:dafl_project_flutter/views/pages/main/w_bottomsheet.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import './model/location.dart'; import 'package:vibration/vibration.dart'; import 'dart:math'; import './views/pages/home/p_home.dart'; @@ -9,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:rive/rive.dart'; -import './views/location.dart'; void main() { runApp(MyApp()); @@ -21,16 +21,18 @@ class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context){ + Location.getCurrentLocation(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); return ChangeNotifierProvider( create: (context) => CardProvider(), child: MaterialApp( debugShowCheckedModeBanner: false, title: 'Flutter Demo', - home: LocationPage(), + home: HomePage(), ), ); } + } enum CardStatus { like, disLike, discovery, message} diff --git a/Sources/dafl_project_flutter/lib/model/location.dart b/Sources/dafl_project_flutter/lib/model/location.dart new file mode 100644 index 0000000..edd6797 --- /dev/null +++ b/Sources/dafl_project_flutter/lib/model/location.dart @@ -0,0 +1,16 @@ +import 'package:flutter/foundation.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:tuple/tuple.dart'; + +class Location{ + static Tuple2 getCurrentLocation() { + Position currentPosition = Position(); + Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best, forceAndroidLocationManager: true) + .then((Position position) {currentPosition = position;}).catchError((e) { + if (kDebugMode) { + print(e); + } + }); + return Tuple2(currentPosition.longitude, currentPosition.latitude); + } +} \ No newline at end of file diff --git a/Sources/dafl_project_flutter/lib/views/location.dart b/Sources/dafl_project_flutter/lib/views/location.dart deleted file mode 100644 index 3ddc605..0000000 --- a/Sources/dafl_project_flutter/lib/views/location.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:flutter/material.dart'; - - -class LocationPage extends StatefulWidget { - @override - State createState() => _LocationPageState(); -} - -class _LocationPageState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: const Text("Location Page")), - body: SafeArea( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text('LAT: '), - const Text('LNG: '), - const Text('ADDRESS: '), - const SizedBox(height: 32), - ElevatedButton( - onPressed: () {}, - child: const Text("Get Current Location"), - ) - ], - ), - ), - ), - ); - } -} - - diff --git a/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift index 977f380..cccf817 100644 --- a/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,8 +5,6 @@ import FlutterMacOS import Foundation -import geolocator_apple func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) } diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index ef0eda8..6a5a06f 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -149,62 +149,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "8.1.1" - geocoding: - dependency: "direct main" - description: - name: geocoding - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" - geocoding_platform_interface: - dependency: transitive - description: - name: geocoding_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" geolocator: dependency: "direct main" description: name: geolocator url: "https://pub.dartlang.org" source: hosted - version: "9.0.2" - geolocator_android: - dependency: transitive - description: - name: geolocator_android - url: "https://pub.dartlang.org" - source: hosted - version: "4.1.4" - geolocator_apple: - dependency: transitive - description: - name: geolocator_apple - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.2" + version: "6.2.1" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.0.7" + version: "1.0.9" geolocator_web: dependency: transitive description: name: geolocator_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.6" - geolocator_windows: - dependency: transitive - description: - name: geolocator_windows - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.1" + version: "1.0.1" graphs: dependency: transitive description: @@ -316,7 +281,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "1.0.3" provider: dependency: "direct main" description: @@ -378,6 +343,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.12" + tuple: + dependency: "direct main" + description: + name: tuple + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" typed_data: dependency: transitive description: diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index c09213a..fc6a0ee 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -42,8 +42,8 @@ dependencies: animations: ^2.0.7 fluttertoast: ^8.1.1 vibration: ^1.7.6 - geolocator: ^9.0.2 - geocoding: ^2.0.5 + geolocator: ^6.1.1 + tuple: ^2.0.1 dev_dependencies: diff --git a/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc b/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc index 1ece8f2..8b6d468 100644 --- a/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc +++ b/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,6 @@ #include "generated_plugin_registrant.h" -#include void RegisterPlugins(flutter::PluginRegistry* registry) { - GeolocatorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("GeolocatorWindows")); } diff --git a/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake b/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake index 7f101a7..b93c4c3 100644 --- a/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake +++ b/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - geolocator_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST