update new features and flutter 3.13

This commit is contained in:
Mohamed Nouffer
2023-09-04 22:46:53 +05:30
parent 2ab96cc3d0
commit 3f157d7ddf
22 changed files with 2160 additions and 1703 deletions

View File

@ -1,12 +1,12 @@
buildscript { buildscript {
ext.kotlin_version = '1.6.10' ext.kotlin_version = '1.7.10'
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.0' classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
} }
@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

View File

@ -4,47 +4,11 @@ PODS:
- connectivity_plus (0.0.1): - connectivity_plus (0.0.1):
- Flutter - Flutter
- ReachabilitySwift - ReachabilitySwift
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.4)
- DKImagePickerController/PhotoGallery (4.3.4):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.4)
- DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17)
- DKPhotoGallery/Preview (= 0.0.17)
- DKPhotoGallery/Resource (= 0.0.17)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.17):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_compass (0.0.1): - flutter_compass (0.0.1):
- Flutter - Flutter
- flutter_keyboard_visibility (0.0.1): - flutter_keyboard_visibility (0.0.1):
- Flutter - Flutter
- flutter_local_notifications (0.0.1):
- Flutter
- FMDB (2.7.5): - FMDB (2.7.5):
- FMDB/standard (= 2.7.5) - FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5) - FMDB/standard (2.7.5)
@ -52,7 +16,7 @@ PODS:
- Flutter - Flutter
- google_maps_flutter_ios (0.0.1): - google_maps_flutter_ios (0.0.1):
- Flutter - Flutter
- GoogleMaps - GoogleMaps (< 8.0)
- GoogleMaps (5.2.0): - GoogleMaps (5.2.0):
- GoogleMaps/Maps (= 5.2.0) - GoogleMaps/Maps (= 5.2.0)
- GoogleMaps/Base (5.2.0) - GoogleMaps/Base (5.2.0)
@ -60,124 +24,93 @@ PODS:
- GoogleMaps/Base - GoogleMaps/Base
- image_picker_ios (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- is_lock_screen (2.0.0): - isar_flutter_libs (1.0.0):
- Flutter - Flutter
- move_to_background (0.0.1): - path_provider_foundation (0.0.1):
- Flutter - Flutter
- path_provider_ios (0.0.1): - FlutterMacOS
- Flutter - permission_handler_apple (9.1.1):
- permission_handler_apple (9.0.4):
- Flutter - Flutter
- ReachabilitySwift (5.0.0) - ReachabilitySwift (5.0.0)
- SDWebImage (5.15.5):
- SDWebImage/Core (= 5.15.5)
- SDWebImage/Core (5.15.5)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1): - shared_preferences_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- sqflite (0.0.2): - sqflite (0.0.3):
- Flutter - Flutter
- FMDB (>= 2.7.5) - FMDB (>= 2.7.5)
- SwiftyGif (5.4.4)
- url_launcher_ios (0.0.1): - url_launcher_ios (0.0.1):
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`) - flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- is_lock_screen (from `.symlinks/plugins/is_lock_screen/ios`) - isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
- move_to_background (from `.symlinks/plugins/move_to_background/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
SPEC REPOS: SPEC REPOS:
trunk: trunk:
- DKImagePickerController
- DKPhotoGallery
- FMDB - FMDB
- GoogleMaps - GoogleMaps
- ReachabilitySwift - ReachabilitySwift
- SDWebImage
- SwiftyGif
EXTERNAL SOURCES: EXTERNAL SOURCES:
camera_avfoundation: camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios" :path: ".symlinks/plugins/camera_avfoundation/ios"
connectivity_plus: connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios" :path: ".symlinks/plugins/connectivity_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
flutter_compass: flutter_compass:
:path: ".symlinks/plugins/flutter_compass/ios" :path: ".symlinks/plugins/flutter_compass/ios"
flutter_keyboard_visibility: flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios" :path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
geolocator_apple: geolocator_apple:
:path: ".symlinks/plugins/geolocator_apple/ios" :path: ".symlinks/plugins/geolocator_apple/ios"
google_maps_flutter_ios: google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios" :path: ".symlinks/plugins/google_maps_flutter_ios/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
is_lock_screen: isar_flutter_libs:
:path: ".symlinks/plugins/is_lock_screen/ios" :path: ".symlinks/plugins/isar_flutter_libs/ios"
move_to_background: path_provider_foundation:
:path: ".symlinks/plugins/move_to_background/ios" :path: ".symlinks/plugins/path_provider_foundation/darwin"
path_provider_ios:
:path: ".symlinks/plugins/path_provider_ios/ios"
permission_handler_apple: permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios" :path: ".symlinks/plugins/permission_handler_apple/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation: shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios" :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite: sqflite:
:path: ".symlinks/plugins/sqflite/ios" :path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios: url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios" :path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9 camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855 flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9 google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd
GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
is_lock_screen: 8ae6397a49b2fde58fd80a6ed30fbaf2be9418d6 isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
PODFILE CHECKSUM: a1c2f8dde3796ecc1697a15e7c75eb5205d8a740 PODFILE CHECKSUM: a1c2f8dde3796ecc1697a15e7c75eb5205d8a740

View File

@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1300; LastUpgradeCheck = 1430;
ORGANIZATIONNAME = ""; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1300" LastUpgradeVersion = "1430"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart'; import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -6,13 +5,12 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_binding.dart'; import 'package:rogapp/pages/index/index_binding.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/utils/string_values.dart'; import 'package:rogapp/utils/string_values.dart';
import 'package:is_lock_screen/is_lock_screen.dart'; // import 'package:is_lock_screen/is_lock_screen.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
FlutterMapTileCaching.initialise(await RootDirectory.normalCache); await FlutterMapTileCaching.initialise();
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)'); final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
await instanceA.manage.createAsync(); await instanceA.manage.createAsync();
await instanceA.metadata.addAsync( await instanceA.metadata.addAsync(
@ -44,22 +42,38 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance?.addObserver(this); WidgetsBinding.instance.addObserver(this);
} }
@override @override
void didChangeAppLifecycleState(AppLifecycleState state) async { void dispose() {
super.didChangeAppLifecycleState(state); WidgetsBinding.instance.removeObserver(this);
if (state == AppLifecycleState.inactive) { super.dispose();
print('app inactive, is lock screen: ${await isLockScreen()}');
} else if (state == AppLifecycleState.resumed) {
DestinationController destinationController = Get.find<DestinationController>();
destinationController.initGPS();
print('app resumed');
}
} }
void didChangeAppLifecycleState(AppLifecycleState state) {
switch (state) {
case AppLifecycleState.resumed:
print("RESUMED");
DestinationController destinationController = Get.find<DestinationController>();
destinationController.initGPS();
break;
case AppLifecycleState.inactive:
print("INACTIVE");
break;
case AppLifecycleState.paused:
print("PAUSED");
break;
case AppLifecycleState.detached:
print("DETACHED");
break;
case AppLifecycleState.hidden:
print("DETACHED");
break;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -70,8 +84,9 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
fallbackLocale: const Locale('en', 'US'), fallbackLocale: const Locale('en', 'US'),
title: 'ROGAINING', title: 'ROGAINING',
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, colorScheme:
visualDensity: VisualDensity.adaptivePlatformDensity, ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 36, 135, 221)),
useMaterial3: true,
), ),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
defaultTransition: Transition.cupertino, defaultTransition: Transition.cupertino,

View File

@ -112,7 +112,7 @@ class ChangePasswordPage extends StatelessWidget {
) )
), ),
const SizedBox(height: 20,), const SizedBox(height: 20,),
Row( const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [

View File

@ -1,5 +1,3 @@
import 'dart:io'; import 'dart:io';
import 'package:camera_camera/camera_camera.dart'; import 'package:camera_camera/camera_camera.dart';
@ -25,9 +23,9 @@ import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'dart:async'; import 'dart:async';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:shared_preferences/shared_preferences.dart';
class DestinationController extends GetxController { class DestinationController extends GetxController {
late LocationSettings locationSettings; late LocationSettings locationSettings;
var destinationCount = 0.obs; var destinationCount = 0.obs;
@ -44,7 +42,7 @@ class DestinationController extends GetxController {
var is_at_start = false.obs; var is_at_start = false.obs;
var is_at_goal = false.obs; var is_at_goal = false.obs;
var is_photo_shoot = false.obs; var is_photo_shoot = false.obs;
DateTime last_goal_at = DateTime.now().subtract(const Duration(days:1)); DateTime last_goal_at = DateTime.now().subtract(const Duration(days: 1));
//List<Rogaining> rogainings = <Rogaining>[].obs; //List<Rogaining> rogainings = <Rogaining>[].obs;
bool checking_in = false; bool checking_in = false;
@ -58,7 +56,6 @@ class DestinationController extends GetxController {
bool skip_gps = false; bool skip_gps = false;
Map<String, dynamic> matrix = {}; Map<String, dynamic> matrix = {};
final photos = <File>[].obs; final photos = <File>[].obs;
@ -70,13 +67,14 @@ class DestinationController extends GetxController {
int chekcs = 0; int chekcs = 0;
var rogaining_counted = false.obs; var rogaining_counted = false.obs;
String getFormatedTime(DateTime datetime){ String getFormatedTime(DateTime datetime) {
return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime); return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime);
} }
Destination festuretoDestination(GeoJsonFeature fs){ Destination festuretoDestination(GeoJsonFeature fs) {
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude,
mp.geoSerie!.geoPoints[0].longitude);
//print("----- ${indexController.currentFeature[0].properties} -----"); //print("----- ${indexController.currentFeature[0].properties} -----");
@ -101,19 +99,18 @@ class DestinationController extends GetxController {
buy_point: fs.properties!["buy_point"], buy_point: fs.properties!["buy_point"],
selected: false, selected: false,
checkedin: false, checkedin: false,
hidden_location: fs.properties!["hidden_location"] == true ?1 : 0 hidden_location: fs.properties!["hidden_location"] == true ? 1 : 0);
);
} }
void startTimerLocation(GeoJsonFeature fs, double distance) { void startTimerLocation(GeoJsonFeature fs, double distance) {
print("---- in startTimer ----"); print("---- in startTimer ----");
//skip_gps = true; //skip_gps = true;
double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity; double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity;
if(checkinRadious >= distance){ if (checkinRadious >= distance) {
indexController.currentFeature.clear(); indexController.currentFeature.clear();
Destination d = festuretoDestination(fs); Destination d = festuretoDestination(fs);
for(Destination de in destinations){ for (Destination de in destinations) {
if(de.location_id == d.location_id){ if (de.location_id == d.location_id) {
d = de; d = de;
break; break;
} }
@ -135,23 +132,24 @@ class DestinationController extends GetxController {
//make current destination //make current destination
print("---- checkin_radious $checkinRadious ----"); print("---- checkin_radious $checkinRadious ----");
print("---- distance $distance ----"); print("---- distance $distance ----");
if(checkinRadious >= distance){ if (checkinRadious >= distance) {
//currentSelectedDestinations.add(d); //currentSelectedDestinations.add(d);
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
indexController.currentDestinationFeature.add(d); indexController.currentDestinationFeature.add(d);
print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----"); print(
} "---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----");
else { } else {
skip_gps = false; skip_gps = false;
return; return;
} }
if(is_photo_shoot.value == true){ if (is_photo_shoot.value == true) {
photos.clear(); photos.clear();
showModalBottomSheet(context: Get.context!, isScrollControlled: true, showModalBottomSheet(
builder:((context) => CameraPage()) context: Get.context!,
).whenComplete((){ isScrollControlled: true,
builder: ((context) => CameraPage())).whenComplete(() {
skip_gps = false; skip_gps = false;
chekcs = 0; chekcs = 0;
is_in_checkin.value = false; is_in_checkin.value = false;
@ -161,34 +159,34 @@ class DestinationController extends GetxController {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!); List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
if(ds.isEmpty){ if (ds.isEmpty) {
print("----- in location popup cp - ${d.cp}----"); print("----- in location popup cp - ${d.cp}----");
if(d.cp == -1 && DateTime.now().difference(last_goal_at).inHours >= 24){ if (d.cp == -1 && DateTime.now().difference(last_goal_at).inHours >= 24) {
chekcs = 1; chekcs = 1;
//start //start
print("---- in start -----"); print("---- in start -----");
chekcs = 1; chekcs = 1;
is_in_checkin.value = true; is_in_checkin.value = true;
is_at_start.value = true; is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true, showModalBottomSheet(
builder:((context) => BottomSheetNew()) context: Get.context!,
).whenComplete((){ isScrollControlled: true,
builder: ((context) => BottomSheetNew())).whenComplete(() {
skip_gps = false; skip_gps = false;
chekcs = 0; chekcs = 0;
is_at_start.value = false; is_at_start.value = false;
is_in_checkin.value = false; is_in_checkin.value = false;
}); });
} } else if (is_in_rog.value == true && indexController.rog_mode == 1) {
else if(is_in_rog.value == true && indexController.rog_mode == 1)
{
print("----- in location popup checkin cp - ${d.cp}----"); print("----- in location popup checkin cp - ${d.cp}----");
chekcs = 2; chekcs = 2;
is_in_checkin.value = true; is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true, showModalBottomSheet(
builder:((context) => BottomSheetNew()) context: Get.context!,
).whenComplete((){ isScrollControlled: true,
builder: ((context) => BottomSheetNew())).whenComplete(() {
skip_gps = false; skip_gps = false;
chekcs =0; chekcs = 0;
is_in_checkin.value = false; is_in_checkin.value = false;
}); });
} }
@ -196,42 +194,48 @@ class DestinationController extends GetxController {
print("---- location checkin radious ${d.checkin_radious} ----"); print("---- location checkin radious ${d.checkin_radious} ----");
print("---- already checked in $locationAlreadyCheckedIn ----"); print("---- already checked in $locationAlreadyCheckedIn ----");
if(checkinRadious >= distance && locationAlreadyCheckedIn == false && is_in_rog.value == true){ if (checkinRadious >= distance &&
if(autoCheckin){ locationAlreadyCheckedIn == false &&
if(!checking_in){ is_in_rog.value == true) {
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@"); if (autoCheckin) {
makeCheckin(d, true,""); if (!checking_in) {
if(d.cp != -1){ print(
rogaining_counted.value =true; "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@");
makeCheckin(d, true, "");
if (d.cp != -1) {
rogaining_counted.value = true;
} }
skip_gps = false; skip_gps = false;
} }
} } else {
else{
print("--- hidden loc ${d.hidden_location} ----"); print("--- hidden loc ${d.hidden_location} ----");
// ask for checkin // ask for checkin
if(d.hidden_location != null && d.hidden_location == 0 && is_in_rog.value == true && d.cp != -1){ if (d.hidden_location != null &&
d.hidden_location == 0 &&
is_in_rog.value == true &&
d.cp != -1) {
chekcs = 3; chekcs = 3;
is_in_checkin.value = true; is_in_checkin.value = true;
photos.clear(); photos.clear();
showModalBottomSheet(context: Get.context!, isScrollControlled: true, showModalBottomSheet(
builder:((context) => CameraPage(destination: d,)) context: Get.context!,
).whenComplete((){ isScrollControlled: true,
builder: ((context) => CameraPage(
destination: d,
))).whenComplete(() {
skip_gps = false; skip_gps = false;
rogaining_counted.value =true; rogaining_counted.value = true;
chekcs = 0; chekcs = 0;
is_in_checkin.value = false; is_in_checkin.value = false;
}); });
} } else if (is_in_rog.value == true && d.cp != -1) {
else if(is_in_rog.value == true && d.cp != -1){
chekcs = 4; chekcs = 4;
is_in_checkin.value = true; is_in_checkin.value = true;
showMaterialModalBottomSheet( showMaterialModalBottomSheet(
expand: true, expand: true,
context: Get.context!, context: Get.context!,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) => BottomSheetNew() builder: (context) => BottomSheetNew()).whenComplete(() {
).whenComplete(() {
skip_gps = false; skip_gps = false;
chekcs = 0; chekcs = 0;
is_in_checkin.value = false; is_in_checkin.value = false;
@ -244,38 +248,46 @@ class DestinationController extends GetxController {
// is_in_checkin.value = false; // is_in_checkin.value = false;
// }); // });
} }
} }
} }
print("---- cp --- ${d.cp} -----"); print("---- cp --- ${d.cp} -----");
print("--- at goal $is_at_goal ---"); print("--- at goal $is_at_goal ---");
print("--- rog counted $rogaining_counted ---"); print("--- rog counted $rogaining_counted ---");
print("--- loc already checked in $locationAlreadyCheckedIn ---"); print("--- loc already checked in $locationAlreadyCheckedIn ---");
print("==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ===="); print(
if(isuserLoggedIn && d.cp == -1 && locationAlreadyCheckedIn && skip_10s == false){ "==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ====");
if (isuserLoggedIn &&
d.cp == -1 &&
locationAlreadyCheckedIn &&
skip_10s == false) {
//check for rogaining //check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){ if (is_at_goal.value == false && rogaining_counted.value) {
//goal //goal
print("---- in goal -----"); print("---- in goal -----");
chekcs = 5; chekcs = 5;
is_at_goal.value = true; is_at_goal.value = true;
photos.clear(); photos.clear();
showModalBottomSheet(context: Get.context!, isScrollControlled: true, showModalBottomSheet(
builder:((context) => CameraPage(destination: d,)) context: Get.context!,
).whenComplete((){ isScrollControlled: true,
builder: ((context) => CameraPage(
destination: d,
))).whenComplete(() {
skip_gps = false; skip_gps = false;
chekcs = 0; chekcs = 0;
is_at_goal.value = false; is_at_goal.value = false;
}); });
} } else if (is_in_rog.value == false &&
else if(is_in_rog.value == false && indexController.rog_mode == 1 && DateTime.now().difference(last_goal_at).inHours >= 24){ indexController.rog_mode == 1 &&
DateTime.now().difference(last_goal_at).inHours >= 24) {
//start //start
print("---- in start -----"); print("---- in start -----");
chekcs = 6; chekcs = 6;
is_at_start.value = true; is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true, showModalBottomSheet(
builder:((context) => BottomSheetNew()) context: Get.context!,
).whenComplete((){ isScrollControlled: true,
builder: ((context) => BottomSheetNew())).whenComplete(() {
print("----- finished start -------"); print("----- finished start -------");
skip_gps = false; skip_gps = false;
chekcs = 0; chekcs = 0;
@ -284,7 +296,7 @@ class DestinationController extends GetxController {
} }
} }
print("==== _chekcs $chekcs ===="); print("==== _chekcs $chekcs ====");
if(chekcs == 0){ if (chekcs == 0) {
skip_gps = false; skip_gps = false;
} }
} }
@ -299,21 +311,18 @@ class DestinationController extends GetxController {
is_gps_selected.value = true; is_gps_selected.value = true;
skip_gps = false; skip_gps = false;
_start = 0; _start = 0;
chekcs = 0; chekcs = 0;
rogaining_counted.value = false; rogaining_counted.value = false;
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
int? _latgoal = await db.latestGoal(); int? _latgoal = await db.latestGoal();
if(_latgoal != null){ if (_latgoal != null) {
last_goal_at = DateTime.fromMicrosecondsSinceEpoch(_latgoal); last_goal_at = DateTime.fromMicrosecondsSinceEpoch(_latgoal);
print("===== last goal : $last_goal_at ====="); print("===== last goal : $last_goal_at =====");
} }
db.deleteAllDestinations().then((value) {
db.deleteAllDestinations().then((value){
PopulateDestinations(); PopulateDestinations();
initGPS(); initGPS();
}); });
@ -338,40 +347,77 @@ class DestinationController extends GetxController {
))); )));
} }
void getRoutePoints() { void getRoutePoints() {
indexController.routePoints = []; indexController.routePoints = [];
indexController.routePointLenght.value = 0; indexController.routePointLenght.value = 0;
DestinationService.getDestinationLine(destinations, matrix)?.then((value){ DestinationService.getDestinationLine(destinations, matrix)?.then((value) {
indexController.routePoints = value; indexController.routePoints = value;
indexController.routePointLenght.value = indexController.routePoints.length; indexController.routePointLenght.value =
indexController.routePoints.length;
}); });
} }
Future<Destination?> getDestinationForLatLong(double lat, double long)async { Future<Destination?> getDestinationForLatLong(double lat, double long) async {
for (final d in destinations) {
for(final d in destinations){ if (lat == d.lat && long == d.lon) {
if(lat == d.lat && long == d.lon){
return d; return d;
} }
} }
return null; return null;
} }
void checkForCheckin(double la, double ln){ void CallforCheckin(Destination d) {
bool autoCheckin = d.auto_checkin == 0 ? false : true;
if (autoCheckin) {
if (!checking_in) {
print(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@");
makeCheckin(d, true, "");
if (d.cp != -1) {
rogaining_counted.value = true;
}
skip_gps = false;
}
} else {
print("--- hidden loc ${d.hidden_location} ----");
// ask for checkin
if (d.hidden_location != null &&
d.hidden_location == 0 &&
is_in_rog.value == true &&
d.cp != -1) {
chekcs = 3;
is_in_checkin.value = true;
photos.clear();
showModalBottomSheet(
context: Get.context!,
isScrollControlled: true,
builder: ((context) => CameraPage(
destination: d,
))).whenComplete(() {
skip_gps = false;
rogaining_counted.value = true;
chekcs = 0;
is_in_checkin.value = false;
});
} else {
Get.snackbar("始まっていない", "ロゲイニングを始める必要があります");
}
}
}
void checkForCheckin(double la, double ln) {
print("--- skip_gps ---- $skip_gps----"); print("--- skip_gps ---- $skip_gps----");
for(final d in destinations){ for (final d in destinations) {
print("--- check checkin for--loc_id- ${d.sub_loc_id}----"); print("--- check checkin for--loc_id- ${d.sub_loc_id}----");
double lat = d.lat!; double lat = d.lat!;
double lon = d.lon!; double lon = d.lon!;
LatLng p = LatLng(lat, lon); LatLng p = LatLng(lat, lon);
getDestinationForLatLong(lat, lon).then((value){ getDestinationForLatLong(lat, lon).then((value) {
var distance = const Distance(); var distance = const Distance();
double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln)); double dist =
distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
//double checkin_radious = value!.checkin_radious ?? double.infinity; //double checkin_radious = value!.checkin_radious ?? double.infinity;
//bool auto_checkin = value.auto_checkin == 0 ? false : true; //bool auto_checkin = value.auto_checkin == 0 ? false : true;
//bool location_already_checked_id = d.checkedin ?? false; //bool location_already_checked_id = d.checkedin ?? false;
@ -381,31 +427,30 @@ class DestinationController extends GetxController {
// print("-----dist is ---${dist}-----"); // print("-----dist is ---${dist}-----");
//print("----- ${indexController.currentUser} ----"); //print("----- ${indexController.currentUser} ----");
if(dist <= 250 && skip_gps == false){ if (dist <= 250 && skip_gps == false) {
//near a destination //near a destination
print("---- time with ${d.location_id} ----"); print("---- time with ${d.location_id} ----");
startTimer(d, dist); startTimer(d, dist);
} }
}); });
} }
if(indexController.locations.isEmpty) return; if (indexController.locations.isEmpty) return;
//check for location in bounds //check for location in bounds
for(GeoJsonFeature fs in indexController.locations[0].collection){ for (GeoJsonFeature fs in indexController.locations[0].collection) {
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude,
mp.geoSerie!.geoPoints[0].longitude);
double latFs = pt.latitude; double latFs = pt.latitude;
double lonFs = pt.longitude; double lonFs = pt.longitude;
LatLng pFs = LatLng(latFs, lonFs); LatLng pFs = LatLng(latFs, lonFs);
var distanceFs = const Distance(); var distanceFs = const Distance();
double distFs = distanceFs.as(LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln)); double distFs =
distanceFs.as(LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln));
if(distFs <= 250 && skip_gps == false){ if (distFs <= 250 && skip_gps == false) {
//near a location //near a location
print("---- before call startTimerLocation ----"); print("---- before call startTimerLocation ----");
startTimerLocation(fs, distFs); startTimerLocation(fs, distFs);
@ -416,7 +461,7 @@ class DestinationController extends GetxController {
void addToRogaining(double lat, double lon, int destinationId) async { void addToRogaining(double lat, double lon, int destinationId) async {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
List<Destination> d = await db.getDestinationById(destinationId); List<Destination> d = await db.getDestinationById(destinationId);
if(d.isEmpty){ if (d.isEmpty) {
Destination df = festuretoDestination(indexController.currentFeature[0]); Destination df = festuretoDestination(indexController.currentFeature[0]);
print("--- made checkin ${df.location_id} ----"); print("--- made checkin ${df.location_id} ----");
makeCheckin(df, true, ""); makeCheckin(df, true, "");
@ -424,12 +469,15 @@ class DestinationController extends GetxController {
is_in_rog.value = true; is_in_rog.value = true;
} }
void makeCheckin(Destination destination, bool action, String imageurl) async { void makeCheckin(
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${destination.sub_loc_id}@@@@@@@@@@@"); Destination destination, bool action, String imageurl) async {
print(
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${destination.sub_loc_id}@@@@@@@@@@@");
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!); List<Destination> ddd =
await db.getDestinationByLatLon(destination.lat!, destination.lon!);
if(ddd.isEmpty){ if (ddd.isEmpty) {
destination.checkedin = true; destination.checkedin = true;
await db.insertDestination(destination); await db.insertDestination(destination);
} }
@ -437,7 +485,7 @@ class DestinationController extends GetxController {
PopulateDestinations(); PopulateDestinations();
/// post to NATNAT /// post to NATNAT
if(indexController.currentUser.isNotEmpty){ if (indexController.currentUser.isNotEmpty) {
double cpNum = destination.cp!; double cpNum = destination.cp!;
int userId = indexController.currentUser[0]["user"]["id"]; int userId = indexController.currentUser[0]["user"]["id"];
@ -452,14 +500,16 @@ class DestinationController extends GetxController {
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now); String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
print("------ checkin event $_event_code ------"); print("------ checkin event $_event_code ------");
ExternalService().makeCheckpoint(userId, _token, formattedDate, _team,cpNum.round(), _event_code, imageurl).then((value){ ExternalService()
.makeCheckpoint(userId, _token, formattedDate, _team, cpNum.round(),
_event_code, imageurl)
.then((value) {
print("------Ext service check point $value ------"); print("------Ext service check point $value ------");
}); });
} }
} }
void initGPS(){ void initGPS() {
checkPermission(); checkPermission();
PopulateDestinations(); PopulateDestinations();
@ -478,17 +528,16 @@ class DestinationController extends GetxController {
"Example app will continue to receive your location even when you aren't using it", "Example app will continue to receive your location even when you aren't using it",
notificationTitle: "Running in Background", notificationTitle: "Running in Background",
enableWakeLock: true, enableWakeLock: true,
) ));
); } else if (defaultTargetPlatform == TargetPlatform.iOS ||
} else if (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS) { defaultTargetPlatform == TargetPlatform.macOS) {
locationSettings = AppleSettings( locationSettings = AppleSettings(
accuracy: LocationAccuracy.bestForNavigation, accuracy: LocationAccuracy.bestForNavigation,
activityType: ActivityType.fitness, activityType: ActivityType.fitness,
distanceFilter: 0, distanceFilter: 0,
pauseLocationUpdatesAutomatically: false, pauseLocationUpdatesAutomatically: false,
// Only set to true if our app will be started up in the background. // Only set to true if our app will be started up in the background.
showBackgroundLocationIndicator: true showBackgroundLocationIndicator: true);
);
} else { } else {
locationSettings = const LocationSettings( locationSettings = const LocationSettings(
accuracy: LocationAccuracy.high, accuracy: LocationAccuracy.high,
@ -497,35 +546,36 @@ class DestinationController extends GetxController {
} }
try { try {
StreamSubscription<Position> positionStream =
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen( Geolocator.getPositionStream(locationSettings: locationSettings)
.listen((Position? position) {
(Position? position) {
current_lat = position != null ? position.latitude : 0; current_lat = position != null ? position.latitude : 0;
current_lon = position != null ? position.longitude : 0; current_lon = position != null ? position.longitude : 0;
indexController.current_lat = position != null ? position.latitude : 0; indexController.current_lat = position != null ? position.latitude : 0;
current_lon = position != null ? position.longitude : 0; current_lon = position != null ? position.longitude : 0;
print("==== gps skip is : ${skip_gps.toString()}, selected is $is_gps_selected , $current_lat"); print(
"==== gps skip is : ${skip_gps.toString()}, selected is $is_gps_selected , $current_lat");
if(is_gps_selected.value){ if (is_gps_selected.value) {
double czoom = indexController.rogMapController.zoom; double czoom = indexController.rogMapController.zoom;
indexController.rogMapController.move(LatLng(position!.latitude, position.longitude), czoom); indexController.rogMapController
.move(LatLng(position!.latitude, position.longitude), czoom);
//String user_id = indexController.currentUser[0]["user"]["id"].toString(); //String user_id = indexController.currentUser[0]["user"]["id"].toString();
//TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){ //TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
//print("---- postion is ${position.latitude}, ${position.longitude}"); //print("---- postion is ${position.latitude}, ${position.longitude}");
gps.clear(); gps.clear();
gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --"); gps.add(
"-- lat : ${position.latitude}, lon : ${position.longitude} --");
checkForCheckin(position.latitude, position.longitude); checkForCheckin(position.latitude, position.longitude);
print("--- call check checkin"); print("--- call check checkin");
print("---- skip gps is ${skip_gps.toString()} ----"); print("---- skip gps is ${skip_gps.toString()} ----");
//}); //});
} }
//print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}'); //print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
}); });
} catch (err){ } catch (err) {
locationPermission.clear(); locationPermission.clear();
locationPermission.add(err.toString()); locationPermission.add(err.toString());
} }
@ -533,28 +583,40 @@ class DestinationController extends GetxController {
ever(indexController.connectionStatusName, connectionChanged); ever(indexController.connectionStatusName, connectionChanged);
} }
@override @override
void onInit() async { void onInit() async {
initGPS(); initGPS();
super.onInit(); super.onInit();
}
readUserToken() async{
final SharedPreferences prefs = await SharedPreferences.getInstance();
indexController.userToken = prefs.getString("user_token");
} }
@override @override
void onReady() { void onReady() async {
Get.toNamed(AppPages.LOGIN)!.then((value){ await readUserToken();
if(indexController.currentUser.isNotEmpty) { final token = indexController.userToken;
fixMapBound(); if(token != null && token.isNotEmpty){
await indexController.loadUserDetailsForToken(token);
fixMapBound(token);
return;
} }
else {
Get.toNamed(AppPages.LOGIN)!.then((value) {
if (indexController.currentUser.isNotEmpty) {
final tk = indexController.currentUser[0]["token"];
fixMapBound(tk);
} else {
Get.toNamed(AppPages.TRAVEL); Get.toNamed(AppPages.TRAVEL);
PerfectureService.getSubExt("9").then((value){ PerfectureService.getSubExt("9").then((value) {
if(value != null){ if (value != null) {
LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); LatLngBounds bnds = LatLngBounds(
indexController.mapController.fitBounds(bnds); //.centerZoomFitBounds(bnds); LatLng(value[1], value[0]), LatLng(value[3], value[2]));
indexController.mapController
.fitBounds(bnds); //.centerZoomFitBounds(bnds);
} }
}); });
} }
@ -562,13 +624,14 @@ class DestinationController extends GetxController {
super.onReady(); super.onReady();
} }
void fixMapBound(){ void fixMapBound(String token) {
String _token = indexController.currentUser[0]["token"]; //String _token = indexController.currentUser[0]["token"];
indexController.switchPage(AppPages.INITIAL); indexController.switchPage(AppPages.INITIAL);
LocationService.getLocationsExt(_token).then((value) { LocationService.getLocationsExt(token).then((value) {
if(value != null){ if (value != null) {
print("--- loc ext is - $value ----"); print("--- loc ext is - $value ----");
LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); LatLngBounds bnds = LatLngBounds(
LatLng(value[1], value[0]), LatLng(value[3], value[2]));
print("--- bnds is - $bnds ----"); print("--- bnds is - $bnds ----");
indexController.mapController.fitBounds( indexController.mapController.fitBounds(
bnds, bnds,
@ -583,27 +646,37 @@ class DestinationController extends GetxController {
void connectionChanged(String val) { void connectionChanged(String val) {
print('----- %%%%%%%%%%%%%%%%%%%%% ----- $val'); print('----- %%%%%%%%%%%%%%%%%%%%% ----- $val');
Map<String, dynamic> _res = {}; Map<String, dynamic> _res = {};
if(val == "wifi" || val == "mobile"){ if (val == "wifi" || val == "mobile") {
String _token = indexController.currentUser[0]["token"]; String _token = indexController.currentUser[0]["token"];
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.allRogianing().then((value){ db.allRogianing().then((value) {
value.forEach((e) async { value.forEach((e) async {
if(e.rog_action_type == 0){ if (e.rog_action_type == 0) {
_res = await ExternalService().StartRogaining(); _res = await ExternalService().StartRogaining();
} } else if (e.rog_action_type == 1) {
else if(e.rog_action_type == 1){
var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
_res = await ExternalService().makeCheckpoint(e.user_id!, _token, getFormatedTime(datetime), e.team_name!, e.cp_number!, e.event_code!, e.image!); _res = await ExternalService().makeCheckpoint(
} e.user_id!,
else if(e.rog_action_type == 2){ _token,
getFormatedTime(datetime),
e.team_name!,
e.cp_number!,
e.event_code!,
e.image!);
} else if (e.rog_action_type == 2) {
var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
_res = await ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!); _res = await ExternalService().makeGoal(
e.user_id!,
_token,
e.team_name!,
e.image!,
getFormatedTime(datetime),
e.event_code!);
} }
if(_res.isNotEmpty){ if (_res.isNotEmpty) {
db.deleteRogaining(e.id!); db.deleteRogaining(e.id!);
} }
}); });
}); });
} }
@ -619,12 +692,12 @@ class DestinationController extends GetxController {
} }
} }
Destination? destinationById(int id){ Destination? destinationById(int id) {
Destination? d; Destination? d;
print("--- target des - $id ----"); print("--- target des - $id ----");
for(Destination ss in destinations){ for (Destination ss in destinations) {
print("--- des - ${ss.location_id} ----"); print("--- des - ${ss.location_id} ----");
if(ss.location_id == id){ if (ss.location_id == id) {
d = ss; d = ss;
break; break;
} }
@ -632,65 +705,64 @@ class DestinationController extends GetxController {
return d; return d;
} }
void deleteDestination(Destination d){ void deleteDestination(Destination d) {
//int id = destinations[index].location_id!; //int id = destinations[index].location_id!;
//print("---- index ${destinations[index].location_id!}-----"); //print("---- index ${destinations[index].location_id!}-----");
for(Destination ss in destinations){ for (Destination ss in destinations) {
if(ss.location_id == d.location_id){ if (ss.location_id == d.location_id) {
destinations.remove(ss); destinations.remove(ss);
break; break;
} }
} }
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.deleteDestination(d.location_id!).then((value){ db.deleteDestination(d.location_id!).then((value) {
PopulateDestinations(); PopulateDestinations();
}); });
} }
void deleteAllDestinations(){ void deleteAllDestinations() {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.deleteAllDestinations().then((value){ db.deleteAllDestinations().then((value) {
PopulateDestinations(); PopulateDestinations();
}); });
} }
// ---------- database ------------------/// // ---------- database ------------------///
void addDestinations(Destination dest){ void addDestinations(Destination dest) {
print(
print('------ destination controller in add destination ${dest.checkin_radious} ---- :::::'); '------ destination controller in add destination ${dest.checkin_radious} ---- :::::');
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){ db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value) {
if(value.isNotEmpty){ if (value.isNotEmpty) {
db.deleteDestination(value[0].location_id!).then((value){ db.deleteDestination(value[0].location_id!).then((value) {
db.insertDestination(dest).then((value){ db.insertDestination(dest).then((value) {
print("----- destination controller deleted and inserted destination id $value ---- :::::"); print(
"----- destination controller deleted and inserted destination id $value ---- :::::");
PopulateDestinations(); PopulateDestinations();
}); });
}); });
} } else {
else { db.insertDestination(dest).then((value) {
db.insertDestination(dest).then((value){
print("----- destination controller added as new $value--- :::::"); print("----- destination controller added as new $value--- :::::");
PopulateDestinations(); PopulateDestinations();
}); });
} }
}); });
} }
void toggleSelection(Destination dest) async { void toggleSelection(Destination dest) async {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
await db.toggleSelecttion(dest); await db.toggleSelecttion(dest);
destinations.clear(); destinations.clear();
db.getDestinations().then((value){ db.getDestinations().then((value) {
destinationCount.value = 0; destinationCount.value = 0;
currentSelectedDestinations.clear(); currentSelectedDestinations.clear();
for(Destination d in value){ for (Destination d in value) {
//print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::"); //print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::");
//print("-----populated----- ${d.toMap()}"); //print("-----populated----- ${d.toMap()}");
if(d.selected!){ if (d.selected!) {
currentSelectedDestinations.add(d); currentSelectedDestinations.add(d);
} }
destinations.add(d); destinations.add(d);
@ -710,47 +782,48 @@ class DestinationController extends GetxController {
}); });
} }
void destinationMatrixFromCurrentPoint(List<Destination> points){ void destinationMatrixFromCurrentPoint(List<Destination> points) {
buildShowDialog(Get.context!); buildShowDialog(Get.context!);
MatrixService.getDestinations(points).then((mat){ MatrixService.getDestinations(points).then((mat) {
print(" matrix is ------- $mat"); print(" matrix is ------- $mat");
matrix = mat; matrix = mat;
try{ try {
indexController.routePoints = []; indexController.routePoints = [];
indexController.routePointLenght.value = 0; indexController.routePointLenght.value = 0;
DestinationService.getDestinationLine(points, matrix)?.then((value){ DestinationService.getDestinationLine(points, matrix)?.then((value) {
indexController.routePoints = value; indexController.routePoints = value;
indexController.routePointLenght.value = indexController.routePoints.length; indexController.routePointLenght.value =
indexController.routePoints.length;
//Get.toNamed(AppPages.TRAVEL); //Get.toNamed(AppPages.TRAVEL);
}); });
destinationCount.value = destinations.length; destinationCount.value = destinations.length;
} } catch (_) {
catch(_){
skip_gps = false; skip_gps = false;
return; return;
} } finally {
finally{
Get.back(); Get.back();
} }
}); });
} }
void PopulateDestinations(){ void PopulateDestinations() {
print("--------- destination controller populsting destinations ----------- ::::::"); print(
"--------- destination controller populsting destinations ----------- ::::::");
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
destinations.clear(); destinations.clear();
db.getDestinations().then((value){ db.getDestinations().then((value) {
destinationCount.value = 0; destinationCount.value = 0;
for(Destination d in value){ for (Destination d in value) {
print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::"); print(
"------ destination controller populating destination-------- ${d.checkedin}-------- :::::");
print("-----populated----- ${d.toMap()}"); print("-----populated----- ${d.toMap()}");
destinations.add(d); destinations.add(d);
} }
// destinationCount.value = 0; // destinationCount.value = 0;
print("------ destination controller destinationcount-------- $destinationCount-------- :::::"); print(
"------ destination controller destinationcount-------- $destinationCount-------- :::::");
// MatrixService.getDestinations(value).then((mat){ // MatrixService.getDestinations(value).then((mat){
// print(" matrix is ------- ${mat}"); // print(" matrix is ------- ${mat}");
@ -767,63 +840,51 @@ class DestinationController extends GetxController {
// }); // });
}); });
} }
void makeOrder(Destination d, int dir) {
void makeOrder(Destination d, int dir){
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.updateOrder(d, dir).then((value){ db.updateOrder(d, dir).then((value) {
PopulateDestinations(); PopulateDestinations();
}); });
} }
void makeNext(Destination pt) {
void makeNext(Destination pt){ for (int i = 0; i <= destinations.length - 1; i++) {
for(int i=0; i<= destinations.length - 1; i++){
Destination p = destinations[i]; Destination p = destinations[i];
if(p.lat == pt.lat && p.lon == pt.lon ){ if (p.lat == pt.lat && p.lon == pt.lon) {
if (indexController.currentDestinationFeature.isNotEmpty) {
if(indexController.currentDestinationFeature.isNotEmpty){
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
} }
if(i >= destinations.length - 1 ){ if (i >= destinations.length - 1) {
indexController.currentDestinationFeature.add(destinations[0]); indexController.currentDestinationFeature.add(destinations[0]);
//getAction(); //getAction();
} } else {
else{
indexController.currentDestinationFeature.add(destinations[i + 1]); indexController.currentDestinationFeature.add(destinations[i + 1]);
//getAction(); //getAction();
} }
} }
} }
} }
void makePrevious(Destination pt){ void makePrevious(Destination pt) {
for (int i = 0; i <= destinations.length - 1; i++) {
for(int i=0; i<= destinations.length - 1; i++){
Destination p = destinations[i]; Destination p = destinations[i];
if(p.lat == pt.lat && p.lon == pt.lon ){ if (p.lat == pt.lat && p.lon == pt.lon) {
if (indexController.currentDestinationFeature.isNotEmpty) {
if(indexController.currentDestinationFeature.isNotEmpty){
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
} }
if(i <= 0){ if (i <= 0) {
indexController.currentDestinationFeature.add(destinations[destinations.length -1]); indexController.currentDestinationFeature
.add(destinations[destinations.length - 1]);
//getAction(); //getAction();
} } else {
else{
indexController.currentDestinationFeature.add(destinations[i - 1]); indexController.currentDestinationFeature.add(destinations[i - 1]);
//getAction(); //getAction();
} }
} }
} }
} }
} }

View File

@ -0,0 +1,65 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/utils/database_helper.dart';
class HistoryPage extends StatefulWidget {
const HistoryPage({super.key});
@override
State<HistoryPage> createState() => _HistoryPageState();
}
class _HistoryPageState extends State<HistoryPage> {
DatabaseHelper db = DatabaseHelper.instance;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("History"),
),
body: SingleChildScrollView(
child: Column(
children: [
FutureBuilder(
future: db.getDestinations(),
builder: (BuildContext context,
AsyncSnapshot<List<Destination>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18),
),
);
} else if (snapshot.hasData) {
final dests = snapshot.data;
if (dests!.length > 0) {
return Center(
child: ListView.builder(itemBuilder:(ctx, index){
return ListTile(
title: Text(dests[index].name?? ""),
subtitle: Text(dests[index].address ?? ""),
leading: dests[0].photos != null ? Image.file(File(dests[0].photos!)) : Container(),
);
}),
);
} else {
return Center(child: Text("No checkin yet"));
}
}
}
else if(snapshot.connectionState == ConnectionState.waiting){
return Center(child: CircularProgressIndicator(),);
}
return Container();
}),
],
),
),
);
}
}

View File

@ -20,6 +20,7 @@ import 'package:rogapp/services/cat_service.dart';
import 'package:rogapp/services/location_service.dart'; import 'package:rogapp/services/location_service.dart';
import 'package:rogapp/services/perfecture_service.dart'; import 'package:rogapp/services/perfecture_service.dart';
import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/database_helper.dart';
import 'package:shared_preferences/shared_preferences.dart';
class IndexController extends GetxController { class IndexController extends GetxController {
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs; List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
@ -51,6 +52,8 @@ class IndexController extends GetxController {
MapController mapController = MapController(); MapController mapController = MapController();
MapController rogMapController = MapController(); MapController rogMapController = MapController();
String? userToken;
var mode = 0.obs; var mode = 0.obs;
// master mode, rog or selection // master mode, rog or selection
@ -191,36 +194,14 @@ List<LatLng> getLocationsList(){
} }
void login(String email, String password, BuildContext context){ void login(String email, String password, BuildContext context) {
AuthService.login(email, password).then((value){ AuthService.login(email, password).then((value) {
print("------- logged in user details ######## $value ###### --------"); print("------- logged in user details ######## $value ###### --------");
if(value.isNotEmpty){ if (value.isNotEmpty) {
currentUser.clear();
currentUser.add(value);
is_loading.value = false;
Navigator.pop(context); Navigator.pop(context);
loadUserDetails(); print("--------- user details login ----- $value");
loadLocationsBound(); changeUser(value);
cats.clear(); } else {
if(currentFeature.isNotEmpty){
getAction();
}
if(currentUser.isNotEmpty){
rog_mode.value = 0 ;
}
else{
rog_mode.value = 1;
}
if(rog_mode.value == 1){
switchPage(AppPages.TRAVEL);
}
else{
switchPage(AppPages.INITIAL);
}
//Get.toNamed(AppPages.INITIAL);
}else{
is_loading.value = false; is_loading.value = false;
Get.snackbar( Get.snackbar(
"Failed", "Failed",
@ -232,7 +213,6 @@ void login(String email, String password, BuildContext context){
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
} }
}); });
} }
@ -407,6 +387,58 @@ void login(String email, String password, BuildContext context){
} }
} }
void saveToDevice(String val) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString("user_token", val);
}
void changeUser(Map<String, dynamic> value, {bool replace = true}) {
print("---- change user to ${value} -----");
currentUser.clear();
currentUser.add(value);
if(replace){
saveToDevice(currentUser[0]["token"]);
}
is_loading.value = false;
loadUserDetails();
loadLocationsBound();
cats.clear();
if (currentFeature.isNotEmpty) {
getAction();
}
if (currentUser.isNotEmpty) {
rog_mode.value = 0;
} else {
rog_mode.value = 1;
}
if (rog_mode.value == 1) {
switchPage(AppPages.TRAVEL);
} else {
switchPage(AppPages.INITIAL);
}
//Get.toNamed(AppPages.INITIAL);
}
loadUserDetailsForToken(String token) async {
AuthService.userForToken(token).then((value) {
print("----token val-- $value ------");
if(value![0]["user"].isEmpty){
Get.toNamed(AppPages.LOGIN);
return;
}
changeUser(value[0], replace:false);
print("--------- user details ----- $value");
// if (value != null && value.isNotEmpty) {
// bool paid = value[0]["paid"] as bool;
// if (paid) {
// loadCustomAreas();
// }
// }
});
}
void loadCustomAreas(){ void loadCustomAreas(){
customAreas.clear(); customAreas.clear();

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
@ -8,12 +7,12 @@ import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/widgets/list_widget.dart'; import 'package:rogapp/widgets/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart'; import 'package:rogapp/widgets/map_widget.dart';
class IndexPage extends GetView<IndexController> { class IndexPage extends GetView<IndexController> {
IndexPage({Key? key}) : super(key: key); IndexPage({Key? key}) : super(key: key);
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
final DestinationController destinationController = Get.find<DestinationController>(); final DestinationController destinationController =
Get.find<DestinationController>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,13 +32,20 @@ class IndexPage extends GetView<IndexController> {
title: Text("add_location".tr), title: Text("add_location".tr),
actions: [ actions: [
IconButton( IconButton(
onPressed: (){ onPressed: () {
destinationController.fixMapBound(); Get.toNamed(AppPages.HISTORY);
}, },
icon: const Icon(Icons.refresh) icon: const Icon(Icons.history)),
), IconButton(
onPressed: () {
final tk = indexController.currentUser[0]["token"];
if (tk != null) {
destinationController.fixMapBound(tk);
}
},
icon: const Icon(Icons.refresh)),
InkWell( InkWell(
onTap: (){ onTap: () {
Get.toNamed(AppPages.SEARCH); Get.toNamed(AppPages.SEARCH);
}, },
child: Container( child: Container(
@ -48,9 +54,10 @@ class IndexPage extends GetView<IndexController> {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.blue, color: Colors.blue,
borderRadius: BorderRadius.circular(25), borderRadius: BorderRadius.circular(25),
), ),
child: const Center(child: Icon(Icons.search),), child: const Center(
child: Icon(Icons.search),
),
), ),
), ),
//CatWidget(indexController: indexController,), //CatWidget(indexController: indexController,),
@ -61,49 +68,57 @@ class IndexPage extends GetView<IndexController> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), padding:
const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell( child: InkWell(
child: child:
Obx(() => Obx(() => destinationController.is_gps_selected == true
destinationController.is_gps_selected == true ? ? Padding(
Padding( padding: const EdgeInsets.only(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell( child: InkWell(
child: const Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,), child: const Image(
onTap: (){ image: AssetImage(
//indexController.switchPage(AppPages.TRAVEL); 'assets/images/route3_off.png'),
}, width: 35,
height: 35,
), ),
) : onTap: () {
Padding(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell(
child: const Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,),
onTap: (){
//indexController.switchPage(AppPages.TRAVEL); //indexController.switchPage(AppPages.TRAVEL);
}, },
), ),
) )
) : Padding(
padding: const EdgeInsets.only(
right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell(
child: const Image(
image: AssetImage(
'assets/images/route2_on.png'),
width: 35,
height: 35,
), ),
onTap: () {
//indexController.switchPage(AppPages.TRAVEL);
},
),
))),
), ),
], ],
), ),
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
onPressed: (){ onPressed: () {
indexController.toggleMode(); indexController.toggleMode();
if(indexController.currentCat.isNotEmpty){ if (indexController.currentCat.isNotEmpty) {
print(indexController.currentCat[0].toString()); print(indexController.currentCat[0].toString());
} }
}, },
tooltip: 'Increment', tooltip: 'Increment',
child: Obx(() => child: Obx(
indexController.mode == 0 ? () => indexController.mode == 0
const Image(image: AssetImage('assets/images/list2.png')) ? const Image(image: AssetImage('assets/images/list2.png'))
: : const Image(image: AssetImage('assets/images/map.png')),
const Image(image: AssetImage('assets/images/map.png')),
), ),
elevation: 4.0, elevation: 4.0,
), ),
@ -158,18 +173,15 @@ class IndexPage extends GetView<IndexController> {
// ), // ),
// ), // ),
Expanded( Expanded(
child: Obx(() => child: Obx(
indexController.mode == 0 ? () => indexController.mode == 0
MapWidget() : ? MapWidget()
const ListWidget(), : const ListWidget(),
) ))
)
], ],
), ),
), ),
), ),
); );
} }
} }

View File

@ -20,8 +20,8 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
barrierDismissible: false, // user must tap button! barrierDismissible: false, // user must tap button!
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: Text('ロケーション許可'), title: const Text('ロケーション許可'),
content: SingleChildScrollView( content: const SingleChildScrollView(
child: ListBody( child: ListBody(
children: <Widget>[ children: <Widget>[
Text( 'このアプリでは、位置情報の収集を行います。'), Text( 'このアプリでは、位置情報の収集を行います。'),
@ -160,8 +160,8 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) => AlertDialog(
title: Text('無効'), title: const Text('無効'),
content: SingleChildScrollView( content: const SingleChildScrollView(
child: ListBody( child: ListBody(
children: <Widget>[ children: <Widget>[
Text( '位置情報が無効になっています'), Text( '位置情報が無効になっています'),
@ -187,8 +187,8 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) => AlertDialog(
title: Text('ロケーション許可'), title: const Text('ロケーション許可'),
content: SingleChildScrollView( content: const SingleChildScrollView(
child: ListBody( child: ListBody(
children: <Widget>[ children: <Widget>[
Text( 'このアプリでは、位置情報の収集を行います。'), Text( 'このアプリでは、位置情報の収集を行います。'),

View File

@ -6,6 +6,7 @@ import 'package:rogapp/pages/changepassword/change_password_page.dart';
import 'package:rogapp/pages/city/city_page.dart'; import 'package:rogapp/pages/city/city_page.dart';
import 'package:rogapp/pages/destination/destination_binding.dart'; import 'package:rogapp/pages/destination/destination_binding.dart';
import 'package:rogapp/pages/destination/destination_page.dart'; import 'package:rogapp/pages/destination/destination_page.dart';
import 'package:rogapp/pages/history/history_page.dart';
import 'package:rogapp/pages/home/home_binding.dart'; import 'package:rogapp/pages/home/home_binding.dart';
import 'package:rogapp/pages/home/home_page.dart'; import 'package:rogapp/pages/home/home_page.dart';
@ -48,6 +49,7 @@ class AppPages {
static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD; static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD;
static const CAMERA_PAGE = Routes.CAMERA_PAGE; static const CAMERA_PAGE = Routes.CAMERA_PAGE;
static const PROGRESS = Routes.PROGRESS; static const PROGRESS = Routes.PROGRESS;
static const HISTORY = Routes.HISTORY;
static final routes = [ static final routes = [
// GetPage( // GetPage(
@ -141,6 +143,10 @@ class AppPages {
GetPage( GetPage(
name: Routes.PROGRESS, name: Routes.PROGRESS,
page: () => const ProgressPage(), page: () => const ProgressPage(),
),
GetPage(
name: Routes.HISTORY,
page: () => const HistoryPage(),
) )
]; ];
} }

View File

@ -24,4 +24,5 @@ abstract class Routes {
static const CHANGE_PASSWORD = '/change_password'; static const CHANGE_PASSWORD = '/change_password';
static const CAMERA_PAGE = '/camera_page'; static const CAMERA_PAGE = '/camera_page';
static const PROGRESS = '/progress'; static const PROGRESS = '/progress';
static const HISTORY = '/history';
} }

View File

@ -118,6 +118,26 @@ class AuthService{
static Future<List<dynamic>?> userForToken(String token) async {
Map<String, dynamic> cats = {};
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/user/';
print('++++++++$url');
print("---- UserDetails url is $url");
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token $token'
},
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
print("--- eeeeee $cats ----");
}
return [{"user":cats}];
}

File diff suppressed because it is too large Load Diff

View File

@ -369,7 +369,7 @@ class BottomSheetWidget extends StatelessWidget {
], ],
), ),
), ),
Row( const Row(
children: [ children: [
SizedBox(height: 60.0,), SizedBox(height: 60.0,),
], ],

View File

@ -113,7 +113,7 @@ class DestinationWidget extends StatelessWidget {
buttonColor: Colors.white, buttonColor: Colors.white,
barrierDismissible: false, barrierDismissible: false,
radius: 10, radius: 10,
content: Column( content: const Column(
children: [ children: [
], ],
), ),

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.16+16 version: 1.0.16+16
environment: environment:
sdk: ">=2.16.0 <3.0.0" sdk: '>=3.1.0 <4.0.0'
# Dependencies specify other packages that your package needs in order to work. # Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions # To automatically upgrade your package dependencies to the latest versions
@ -39,7 +39,7 @@ dependencies:
flutter_map: any flutter_map: any
geolocator: ^9.0.1 geolocator: ^9.0.1
permission_handler: ^10.0.0 permission_handler: ^10.0.0
google_api_availability: ^3.0.1 google_api_availability: ^5.0.0
tuple: ^2.0.0 tuple: ^2.0.0
latlong2: ^0.8.1 latlong2: ^0.8.1
positioned_tap_detector_2: ^1.0.4 positioned_tap_detector_2: ^1.0.4
@ -53,9 +53,9 @@ dependencies:
path_provider: ^2.0.8 path_provider: ^2.0.8
flutter_map_location_marker: any flutter_map_location_marker: any
flutter_map_marker_cluster: any flutter_map_marker_cluster: any
material_design_icons_flutter: ^5.0.6595 material_design_icons_flutter: ^7.0.7296
#google_fonts: ^2.1.1 #google_fonts: ^2.1.1
image_picker: ^0.8.4+4 image_picker: ^1.0.4
#geojson_vi: ^2.0.7 #geojson_vi: ^2.0.7
geojson: ^1.0.0 geojson: ^1.0.0
url_launcher: ^6.0.20 url_launcher: ^6.0.20
@ -66,16 +66,16 @@ dependencies:
flutter_polyline_points: ^1.0.0 flutter_polyline_points: ^1.0.0
google_maps_webservice: ^0.0.19 google_maps_webservice: ^0.0.19
flutter_typeahead: ^4.0.0 flutter_typeahead: ^4.0.0
flutter_launcher_icons: ^0.10.0 flutter_launcher_icons: ^0.13.1
rename: ^2.0.1 rename: ^2.0.1
circular_menu: ^2.0.1 circular_menu: ^2.0.1
camera_camera: ^3.0.0-dev camera_camera: ^3.0.0-dev
intl: ^0.17.0 intl: ^0.18.1
modal_bottom_sheet: ^3.0.0-pre modal_bottom_sheet: ^3.0.0-pre
connectivity_plus: ^3.0.2 connectivity_plus: ^4.0.2
flutter_map_tile_caching: ^6.2.0 flutter_map_tile_caching: ^8.0.1
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
is_lock_screen: ^2.0.0
flutter_icons: flutter_icons:
android: true android: true
@ -92,7 +92,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your # activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint # package. See that file for information about deactivating specific lint
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^1.0.0 flutter_lints: ^2.0.3
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec

View File

@ -7,20 +7,23 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <connectivity_plus/connectivity_plus_windows_plugin.h> #include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <file_selector_windows/file_selector_windows.h>
#include <geolocator_windows/geolocator_windows.h> #include <geolocator_windows/geolocator_windows.h>
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar( ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
GeolocatorWindowsRegisterWithRegistrar( GeolocatorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GeolocatorWindows")); registry->GetRegistrarForPlugin("GeolocatorWindows"));
IsarFlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
PermissionHandlerWindowsPluginRegisterWithRegistrar( PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
SharePlusWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows")); registry->GetRegistrarForPlugin("UrlLauncherWindows"));
} }

View File

@ -4,9 +4,10 @@
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus connectivity_plus
file_selector_windows
geolocator_windows geolocator_windows
isar_flutter_libs
permission_handler_windows permission_handler_windows
share_plus
url_launcher_windows url_launcher_windows
) )