Skip to content

Commit

Permalink
Merge pull request #20 from Thuenen-Forest-Ecosystems/merge-supabase-…
Browse files Browse the repository at this point in the history
…Version

Merge supabase version
  • Loading branch information
b-lack authored Dec 13, 2024
2 parents 0b9f95f + 83b219a commit f3f242b
Show file tree
Hide file tree
Showing 65 changed files with 5,456 additions and 721 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (flutterVersionName == null) {
}

android {
namespace = "com.example.terrestrial_forest_monitor"
namespace = "de.thuenen.terrestrial_forest_monitor"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

Expand All @@ -45,7 +45,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.terrestrial_forest_monitor"
applicationId = "de.thuenen.terrestrial_forest_monitor"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />

<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />


<!-- Needed only if your app looks for Bluetooth devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
Expand All @@ -23,6 +23,7 @@

<!-- Needed only if your app uses Bluetooth scan results to derive physical location. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.terrestrial_forest_monitor
package de.thuenen.terrestrial_forest_monitor

import io.flutter.embedding.android.FlutterActivity

Expand Down
12 changes: 6 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.terrestrialForestMonitor;
PRODUCT_BUNDLE_IDENTIFIER = de.thuenen.terrestrialForestMonitor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand All @@ -384,7 +384,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.terrestrialForestMonitor.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = de.thuenen.terrestrialForestMonitor.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -401,7 +401,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.terrestrialForestMonitor.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = de.thuenen.terrestrialForestMonitor.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand All @@ -416,7 +416,7 @@
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.terrestrialForestMonitor.RunnerTests;
PRODUCT_BUNDLE_IDENTIFIER = de.thuenen.terrestrialForestMonitor.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
Expand Down Expand Up @@ -547,7 +547,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.terrestrialForestMonitor;
PRODUCT_BUNDLE_IDENTIFIER = de.thuenen.terrestrialForestMonitor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -569,7 +569,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.terrestrialForestMonitor;
PRODUCT_BUNDLE_IDENTIFIER = de.thuenen.terrestrialForestMonitor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
86 changes: 86 additions & 0 deletions lib/components/navigation-car.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:latlong2/latlong.dart';
import 'package:terrestrial_forest_monitor/providers/gps-position.dart';
import 'package:provider/provider.dart';
import 'package:terrestrial_forest_monitor/services/utils.dart';

class NavigationCar extends StatefulWidget {
Map target;
LatLng position;
NavigationCar({super.key, required this.target, required this.position});

@override
State<NavigationCar> createState() => _NavigationCarState();
}

class _NavigationCarState extends State<NavigationCar> {
@override
Widget build(BuildContext context) {
double? distance;
double? bearing;

Position? lastPosition = context.watch<GpsPositionProvider>().lastPosition;

if (lastPosition != null) {
distance = Geolocator.distanceBetween(
lastPosition.latitude,
lastPosition.longitude,
widget.position.latitude,
widget.position.longitude,
);
bearing = Geolocator.bearingBetween(
lastPosition.latitude,
lastPosition.longitude,
widget.position.latitude,
widget.position.longitude,
);
if (bearing < 0) {
bearing += 360;
}
}

print(context.read<GpsPositionProvider>().listeningPosition);

return Stack(
children: [
Positioned(
top: 5,
left: 5,
child: Text(
'NAVIGATION CAR',
style: TextStyle(fontSize: 11),
),
),
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ClipOval(
child: Material(
color: Theme.of(context).primaryColor, // Button color
child: InkWell(
splashColor: Colors.red, // Splash color
onTap: () {
launchStringExternal('google.navigation:q=${widget.position.latitude},${widget.position.longitude}');
},
child: SizedBox(
width: 56,
height: 56,
child: Icon(
Icons.directions_car,
color: Colors.black54,
),
),
),
),
),
],
),
),
],
);
}
}
106 changes: 106 additions & 0 deletions lib/components/navigation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:latlong2/latlong.dart';
import 'package:terrestrial_forest_monitor/providers/gps-position.dart';
import 'package:provider/provider.dart';
import 'package:terrestrial_forest_monitor/services/utils.dart';

class Navigation extends StatefulWidget {
Map target;
LatLng position;
Navigation({super.key, required this.target, required this.position});

@override
State<Navigation> createState() => _NavigationState();
}

class _NavigationState extends State<Navigation> {
@override
Widget build(BuildContext context) {
double? distance;
double? bearing;

Position? lastPosition = context.watch<GpsPositionProvider>().lastPosition;

if (lastPosition != null) {
distance = Geolocator.distanceBetween(
lastPosition.latitude,
lastPosition.longitude,
widget.position.latitude,
widget.position.longitude,
);
bearing = Geolocator.bearingBetween(
lastPosition.latitude,
lastPosition.longitude,
widget.position.latitude,
widget.position.longitude,
);
if (bearing < 0) {
bearing += 360;
}
}

print(context.read<GpsPositionProvider>().listeningPosition);

return Stack(
children: [
Positioned(
top: 5,
left: 5,
child: Text(
'NAVIGATION',
style: TextStyle(fontSize: 11),
),
),
if (context.read<GpsPositionProvider>().listeningPosition)
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Richtungswinkel', style: TextStyle(fontSize: 15)),
Text(bearing != null ? '${degreeToGon(bearing)}' : 'No GPS signal', style: TextStyle(fontSize: 20)),
SizedBox(
width: 20,
child: Divider(
height: 20,
thickness: 1,
),
),
Text('Entfernung', style: TextStyle(fontSize: 15)),
Text(distance != null ? prettyDistance(distance) : 'No GPS signal', style: TextStyle(fontSize: 20)),
],
),
),
if (!context.read<GpsPositionProvider>().listeningPosition)
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ClipOval(
child: Material(
color: Theme.of(context).primaryColor, // Button color
child: InkWell(
splashColor: Colors.red, // Splash color
onTap: () {
context.read<GpsPositionProvider>().navigateToTarget(widget.position, widget.target);
},
child: SizedBox(
width: 56,
height: 56,
child: Icon(
Icons.navigation,
color: Colors.black26,
),
),
),
),
),
],
),
),
],
);
}
}
Loading

0 comments on commit f3f242b

Please sign in to comment.