From 56e9861c7a4bb9bb82455b087afe0146046b2f5f Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Sun, 3 Sep 2023 23:37:41 +0530 Subject: [PATCH] update to 3.13 --- .metadata | 40 +- android/build.gradle | 62 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- ios/Podfile | 2 +- ios/Podfile.lock | 121 +- ios/Runner.xcodeproj/project.pbxproj | 38 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- lib/main.dart | 21 +- lib/pages/camera/camera_page.dart | 38 +- .../changepassword/change_password_page.dart | 37 +- .../destination/destination_binding.dart | 1 - .../destination/destination_controller.dart | 949 +++++----- lib/pages/destination/destination_page.dart | 41 +- .../destination_map/destination_map_page.dart | 54 +- lib/pages/drawer/drawer_page.dart | 29 +- lib/pages/history/history_page.dart | 65 + lib/pages/home/home_page.dart | 2 + lib/pages/index/index_binding.dart | 11 +- lib/pages/index/index_controller.dart | 760 ++++---- lib/pages/index/index_page.dart | 163 +- lib/pages/landing/landing_page.dart | 18 +- lib/pages/loading/loading_page.dart | 4 +- lib/pages/login/login_page.dart | 50 +- lib/pages/login_popup/login_popup_page.dart | 46 +- lib/pages/mainperf/mainperf_page.dart | 4 +- lib/pages/permission/permission.dart | 36 +- lib/pages/progress/progress.dart | 5 +- lib/pages/register/register_page.dart | 44 +- lib/pages/search/search_controller.dart | 3 - lib/pages/search/search_page.dart | 7 +- lib/pages/subperf/subperf_page.dart | 2 +- lib/routes/app_pages.dart | 20 +- lib/routes/app_routes.dart | 1 + lib/services/action_service.dart | 20 +- lib/services/auth_service.dart | 60 +- lib/services/cat_service.dart | 13 +- lib/services/destination_service.dart | 42 +- lib/services/external_service.dart | 128 +- lib/services/location_line_service.dart | 6 +- lib/services/location_polygon_service.dart | 6 +- lib/services/location_service.dart | 95 +- lib/services/maxtrix_service.dart | 16 +- lib/services/perfecture_service.dart | 36 +- lib/services/reacking_service.dart | 13 +- lib/utils/database_helper.dart | 83 +- lib/utils/text_util.dart | 6 +- lib/widgets/base_layer_widget.dart | 2 +- lib/widgets/bottom_sheet_new.dart | 1605 ++++++++++------- lib/widgets/bottom_sheet_widget.dart | 91 +- lib/widgets/bread_crum_widget.dart | 2 +- lib/widgets/cat_widget.dart | 3 +- lib/widgets/destination_widget.dart | 77 +- lib/widgets/list_widget.dart | 29 +- lib/widgets/map_widget.dart | 22 +- lib/widgets/perfecture_widget.dart | 23 +- pubspec.lock | 722 ++++---- pubspec.yaml | 24 +- test/widget_test.dart | 2 +- .../flutter/generated_plugin_registrant.cc | 9 +- windows/flutter/generated_plugins.cmake | 3 +- 60 files changed, 3111 insertions(+), 2705 deletions(-) create mode 100644 lib/pages/history/history_page.dart diff --git a/.metadata b/.metadata index 854b390..a0a9eb4 100644 --- a/.metadata +++ b/.metadata @@ -1,10 +1,30 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c - channel: stable - -project_type: app +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + channel: stable + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + - platform: ios + create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/android/build.gradle b/android/build.gradle index 871ba76..f7eb7f6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,31 +1,31 @@ -buildscript { - ext.kotlin_version = '1.6.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.3.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(':app') +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 3c9d085..3c472b9 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME 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 diff --git a/ios/Podfile b/ios/Podfile index c0c99e2..6f71b24 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c7ffe25..90b2601 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -4,47 +4,11 @@ PODS: - connectivity_plus (0.0.1): - Flutter - 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_compass (0.0.1): - Flutter - flutter_keyboard_visibility (0.0.1): - Flutter - - flutter_local_notifications (0.0.1): - - Flutter - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) @@ -52,127 +16,102 @@ PODS: - Flutter - google_maps_flutter_ios (0.0.1): - Flutter - - GoogleMaps - - GoogleMaps (4.1.0): - - GoogleMaps/Maps (= 4.1.0) - - GoogleMaps/Base (4.1.0) - - GoogleMaps/Maps (4.1.0): + - GoogleMaps (< 8.0) + - GoogleMaps (6.2.1): + - GoogleMaps/Maps (= 6.2.1) + - GoogleMaps/Base (6.2.1) + - GoogleMaps/Maps (6.2.1): - GoogleMaps/Base - image_picker_ios (0.0.1): - Flutter - - move_to_background (0.0.1): + - isar_flutter_libs (1.0.0): - Flutter - - path_provider_ios (0.0.1): + - path_provider_foundation (0.0.1): - Flutter - - permission_handler_apple (9.0.4): + - FlutterMacOS + - permission_handler_apple (9.1.1): - Flutter - 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): - Flutter - FlutterMacOS - - sqflite (0.0.2): + - sqflite (0.0.3): - Flutter - FMDB (>= 2.7.5) - - SwiftyGif (5.4.4) - url_launcher_ios (0.0.1): - Flutter DEPENDENCIES: - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - flutter_compass (from `.symlinks/plugins/flutter_compass/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`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - - move_to_background (from `.symlinks/plugins/move_to_background/ios`) - - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) + - isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - 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/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: trunk: - - DKImagePickerController - - DKPhotoGallery - FMDB - GoogleMaps - ReachabilitySwift - - SDWebImage - - SwiftyGif EXTERNAL SOURCES: camera_avfoundation: :path: ".symlinks/plugins/camera_avfoundation/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" - file_picker: - :path: ".symlinks/plugins/file_picker/ios" Flutter: :path: Flutter flutter_compass: :path: ".symlinks/plugins/flutter_compass/ios" flutter_keyboard_visibility: :path: ".symlinks/plugins/flutter_keyboard_visibility/ios" - flutter_local_notifications: - :path: ".symlinks/plugins/flutter_local_notifications/ios" geolocator_apple: :path: ".symlinks/plugins/geolocator_apple/ios" google_maps_flutter_ios: :path: ".symlinks/plugins/google_maps_flutter_ios/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/ios" - move_to_background: - :path: ".symlinks/plugins/move_to_background/ios" - path_provider_ios: - :path: ".symlinks/plugins/path_provider_ios/ios" + isar_flutter_libs: + :path: ".symlinks/plugins/isar_flutter_libs/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" permission_handler_apple: :path: ".symlinks/plugins/permission_handler_apple/ios" - share_plus: - :path: ".symlinks/plugins/share_plus/ios" shared_preferences_foundation: - :path: ".symlinks/plugins/shared_preferences_foundation/ios" + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" sqflite: :path: ".symlinks/plugins/sqflite/ios" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: - camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9 - connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e - DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac - DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 - file_picker: ce3938a0df3cc1ef404671531facef740d03f920 + camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb + connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855 flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 - flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 - google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9 - GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef - image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb - move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d - path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 - permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce + google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd + GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 + image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 + isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073 + path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 + permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 - SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe - share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 - shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 - sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 - SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f - url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de + shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126 + sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a + url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 -PODFILE CHECKSUM: a1c2f8dde3796ecc1697a15e7c75eb5205d8a740 +PODFILE CHECKSUM: 7a34d5e980f9e05ecf4e24c79da64ca020615638 COCOAPODS: 1.12.1 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 3f07a3d..f3465f5 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -139,7 +139,7 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, ED4E40E6FE1C0A73CAC736F8 /* [CP] Embed Pods Frameworks */, - FE7C2E909403F98AB3140FE6 /* [CP] Copy Pods Resources */, + BC610379D726847A0183FBD1 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -156,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -251,6 +251,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + BC610379D726847A0183FBD1 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; ED4E40E6FE1C0A73CAC736F8 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -268,23 +285,6 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - FE7C2E909403F98AB3140FE6 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a..a6b826d 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ 0 ? Text("再撮影") : Text("撮影") + child: destinationController.photos.isNotEmpty ? const Text("再撮影") : const Text("撮影") ) ), Obx(() => destinationController.photos.isNotEmpty ? ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.red + backgroundColor: Colors.red ), onPressed: (){ print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######"); @@ -115,7 +115,7 @@ class CameraPage extends StatelessWidget { // } // }); }, - child: Text("チェックイン") + child: const Text("チェックイン") ): Container() ) @@ -145,7 +145,7 @@ class CameraPage extends StatelessWidget { onPressed: (){ Navigator.of(context).pop(); destinationController.skip_10s = true; - timer = Timer.periodic(Duration(seconds: 10), (Timer t){ + timer = Timer.periodic(const Duration(seconds: 10), (Timer t){ destinationController.skip_10s = false; }); }, @@ -154,13 +154,13 @@ class CameraPage extends StatelessWidget { ) : AppBar( - title: Text("チェックポイント"), + title: const Text("チェックポイント"), ), body: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Padding( - padding: EdgeInsets.all(8.0), + padding: const EdgeInsets.all(8.0), child: Center( child: Obx(() => Container( @@ -205,14 +205,14 @@ class StartRogaining extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)), - SizedBox(height: 40.0,), + Text("You have not started rogaining yet.".tr, style: const TextStyle(fontSize: 24)), + const SizedBox(height: 40.0,), ElevatedButton( onPressed: (){ Get.back(); destinationController.skip_gps = false; }, - child: Text("Back"), + child: const Text("Back"), ), ], ), @@ -238,14 +238,14 @@ class NotAtGoal extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text("You have not reached the goal yet.".tr, style: TextStyle(fontSize: 24)), - SizedBox(height: 40.0,), + Text("You have not reached the goal yet.".tr, style: const TextStyle(fontSize: 24)), + const SizedBox(height: 40.0,), ElevatedButton( onPressed: (){ Get.back(); destinationController.skip_gps = false; }, - child: Text("Back"), + child: const Text("Back"), ), ], ), diff --git a/lib/pages/changepassword/change_password_page.dart b/lib/pages/changepassword/change_password_page.dart index 262f8ee..3c6798c 100644 --- a/lib/pages/changepassword/change_password_page.dart +++ b/lib/pages/changepassword/change_password_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/routes/app_pages.dart'; class ChangePasswordPage extends StatelessWidget { ChangePasswordPage({Key? key}) : super(key: key); @@ -23,10 +22,10 @@ class ChangePasswordPage extends StatelessWidget { leading: IconButton( onPressed: (){ Navigator.pop(context); - },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), + },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), ), body: - Container( + SizedBox( width: double.infinity, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -37,13 +36,13 @@ class ChangePasswordPage extends StatelessWidget { Column( children: [ Container( - child: Text("change_password".tr, style: TextStyle(fontSize: 24.0),), + child: Text("change_password".tr, style: const TextStyle(fontSize: 24.0),), ), - SizedBox(height: 30,), + const SizedBox(height: 30,), ], ), Padding( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 40 ), child: Column( @@ -54,9 +53,9 @@ class ChangePasswordPage extends StatelessWidget { ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 40), + padding: const EdgeInsets.symmetric(horizontal: 40), child: Container( - padding: EdgeInsets.only(top: 3,left: 3), + padding: const EdgeInsets.only(top: 3,left: 3), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), ), @@ -71,7 +70,7 @@ class ChangePasswordPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: CircularProgressIndicator(), + child: const CircularProgressIndicator(), ) : Column( children: [ @@ -83,9 +82,9 @@ class ChangePasswordPage extends StatelessWidget { Get.snackbar( "no_values".tr, "values_required".tr, - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), + duration: const Duration(milliseconds: 800), backgroundColor: Colors.yellow, //icon:Image(image:AssetImage("assets/images/dora.png")) ); @@ -99,12 +98,12 @@ class ChangePasswordPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("ログイン",style: TextStyle( + child: const Text("ログイン",style: TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), ), - SizedBox(height: 10.0,), + const SizedBox(height: 10.0,), ], ) @@ -112,8 +111,8 @@ class ChangePasswordPage extends StatelessWidget { ), ) ), - SizedBox(height: 20,), - Row( + const SizedBox(height: 20,), + const Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -132,17 +131,17 @@ class ChangePasswordPage extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(label,style:TextStyle( + Text(label,style:const TextStyle( fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87 ),), - SizedBox(height: 5,), + const SizedBox(height: 5,), TextField( controller: controller, obscureText: obsureText, decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), + contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: (Colors.grey[400])!, @@ -154,7 +153,7 @@ class ChangePasswordPage extends StatelessWidget { ), ), ), - SizedBox(height: 30.0,) + const SizedBox(height: 30.0,) ], ); } diff --git a/lib/pages/destination/destination_binding.dart b/lib/pages/destination/destination_binding.dart index 89af555..8fab747 100644 --- a/lib/pages/destination/destination_binding.dart +++ b/lib/pages/destination/destination_binding.dart @@ -1,6 +1,5 @@ import 'package:get/get.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; -import 'package:rogapp/pages/index/index_controller.dart'; class DestinationBinding extends Bindings { @override diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index a572fdf..0416732 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -1,6 +1,3 @@ - - -import 'dart:convert'; import 'dart:io'; import 'package:camera_camera/camera_camera.dart'; @@ -12,29 +9,22 @@ import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:latlong2/latlong.dart'; -import 'package:rogapp/model/Rogaining.dart'; import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/camera/camera_page.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/services/action_service.dart'; import 'package:rogapp/services/destination_service.dart'; import 'package:rogapp/services/external_service.dart'; -import 'package:rogapp/services/location_line_service.dart'; import 'package:rogapp/services/location_service.dart'; import 'package:rogapp/services/maxtrix_service.dart'; import 'package:rogapp/services/perfecture_service.dart'; -import 'package:rogapp/services/reacking_service.dart'; import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'dart:async'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -import 'package:sqflite/sqlite_api.dart'; -import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class DestinationController extends GetxController { - late LocationSettings locationSettings; var destinationCount = 0.obs; @@ -44,14 +34,14 @@ class DestinationController extends GetxController { bool skip_10s = false; - List currentSelectedDestinations = [].obs; + List currentSelectedDestinations = [].obs; var is_in_checkin = false.obs; var is_in_rog = false.obs; var is_at_start = false.obs; var is_at_goal = false.obs; var is_photo_shoot = false.obs; - DateTime last_goal_at = DateTime.now().subtract(Duration(days:1)); + DateTime last_goal_at = DateTime.now().subtract(const Duration(days: 1)); //List rogainings = [].obs; bool checking_in = false; @@ -65,7 +55,6 @@ class DestinationController extends GetxController { bool skip_gps = false; - Map matrix = {}; final photos = [].obs; @@ -77,50 +66,50 @@ class DestinationController extends GetxController { int chekcs = 0; var rogaining_counted = false.obs; - String getFormatedTime(DateTime datetime){ - return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime); + String getFormatedTime(DateTime 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; - 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} -----"); - return Destination( - name: fs.properties!["location_name"], - address: fs.properties!["address"], - phone: fs.properties!["phone"], - email: fs.properties!["email"], - webcontents: fs.properties!["webcontents"], - videos: fs.properties!["videos"], - category: fs.properties!["category"], - series: 1, - lat: pt.latitude, - lon: pt.longitude, - location_id: fs.properties!["location_id"], - list_order: 1, - photos: fs.properties!["photos"], - checkin_radious: fs.properties!["checkin_radius"], - auto_checkin: fs.properties!["auto_checkin"] == true ? 1 : 0, - cp: fs.properties!["cp"], - checkin_point: fs.properties!["checkin_point"], - buy_point: fs.properties!["buy_point"], - selected: false, - checkedin: false, - hidden_location: fs.properties!["hidden_location"] == true ?1 : 0 - ); + return Destination( + name: fs.properties!["location_name"], + address: fs.properties!["address"], + phone: fs.properties!["phone"], + email: fs.properties!["email"], + webcontents: fs.properties!["webcontents"], + videos: fs.properties!["videos"], + category: fs.properties!["category"], + series: 1, + lat: pt.latitude, + lon: pt.longitude, + location_id: fs.properties!["location_id"], + list_order: 1, + photos: fs.properties!["photos"], + checkin_radious: fs.properties!["checkin_radius"], + auto_checkin: fs.properties!["auto_checkin"] == true ? 1 : 0, + cp: fs.properties!["cp"], + checkin_point: fs.properties!["checkin_point"], + buy_point: fs.properties!["buy_point"], + selected: false, + checkedin: false, + hidden_location: fs.properties!["hidden_location"] == true ? 1 : 0); } void startTimerLocation(GeoJsonFeature fs, double distance) { print("---- in startTimer ----"); //skip_gps = true; - double checkin_radious = fs.properties!['checkin_radius'] ?? double.infinity; - if(checkin_radious >= distance){ + double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity; + if (checkinRadious >= distance) { indexController.currentFeature.clear(); Destination d = festuretoDestination(fs); - for(Destination de in destinations){ - if(de.location_id == d.location_id){ + for (Destination de in destinations) { + if (de.location_id == d.location_id) { d = de; break; } @@ -131,177 +120,193 @@ class DestinationController extends GetxController { } } - void CallforCheckin(Destination d){ - bool auto_checkin = d.auto_checkin == 0 ? false : true; - if(auto_checkin){ - 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("始まっていない", "ロゲイニングを始める必要があります"); - } - //else if(is_in_rog.value == true && d.cp != -1){ - // chekcs = 4; - // is_in_checkin.value = true; - // showMaterialModalBottomSheet( - // expand: true, - // context: Get.context!, - // backgroundColor: Colors.transparent, - // builder: (context) => BottomSheetNew() - // ).whenComplete(() { - // skip_gps = false; - // chekcs = 0; - // is_in_checkin.value = false; - // }); - // showModalBottomSheet(context: Get.context!, isScrollControlled: true, - // builder:((context) => BottomSheetNew()) - // ).whenComplete((){ - // skip_gps = false; - // chekcs = 0; - // is_in_checkin.value = false; - // }); - //} - - } + 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("始まっていない", "ロゲイニングを始める必要があります"); + } + //else if(is_in_rog.value == true && d.cp != -1){ + // chekcs = 4; + // is_in_checkin.value = true; + // showMaterialModalBottomSheet( + // expand: true, + // context: Get.context!, + // backgroundColor: Colors.transparent, + // builder: (context) => BottomSheetNew() + // ).whenComplete(() { + // skip_gps = false; + // chekcs = 0; + // is_in_checkin.value = false; + // }); + // showModalBottomSheet(context: Get.context!, isScrollControlled: true, + // builder:((context) => BottomSheetNew()) + // ).whenComplete((){ + // skip_gps = false; + // chekcs = 0; + // is_in_checkin.value = false; + // }); + //} + } } void startTimer(Destination d, double distance) async { print("=== passed dest is ${d.location_id} ${d.checkedin} ===="); skip_gps = true; print("---- in startTimer ----"); - double checkin_radious = d.checkin_radious ?? double.infinity; - bool auto_checkin = d.auto_checkin == 0 ? false : true; - bool location_already_checked_in = d.checkedin ?? false; - bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false; + double checkinRadious = d.checkin_radious ?? double.infinity; + bool autoCheckin = d.auto_checkin == 0 ? false : true; + bool locationAlreadyCheckedIn = d.checkedin ?? false; + bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false; //make current destination - print("---- checkin_radious ${checkin_radious} ----"); - print("---- distance ${distance} ----"); - if(checkin_radious >= distance){ + print("---- checkin_radious $checkinRadious ----"); + print("---- distance $distance ----"); + if (checkinRadious >= distance) { //currentSelectedDestinations.add(d); indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.add(d); - print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----"); - } - else { + print( + "---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----"); + } else { skip_gps = false; return; } - if(is_photo_shoot.value == true){ + if (is_photo_shoot.value == true) { photos.clear(); - showModalBottomSheet(context: Get.context!, isScrollControlled: true, - builder:((context) => CameraPage()) - ).whenComplete((){ - skip_gps = false; - chekcs = 0; - is_in_checkin.value = false; - }); + showModalBottomSheet( + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage())).whenComplete(() { + skip_gps = false; + chekcs = 0; + is_in_checkin.value = false; + }); return; } DatabaseHelper db = DatabaseHelper.instance; List ds = await db.getDestinationByLatLon(d.lat!, d.lon!); - if(ds.isEmpty){ + if (ds.isEmpty) { 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; //start - print("---- in start -----"); - chekcs = 1; - is_in_checkin.value = true; - is_at_start.value = true; - showModalBottomSheet(context: Get.context!, isScrollControlled: true, - builder:((context) => BottomSheetNew()) - ).whenComplete((){ - skip_gps = false; - chekcs = 0; - is_at_start.value = false; - is_in_checkin.value = false; - }); - } - else if(is_in_rog.value == true && indexController.rog_mode == 1) - { + print("---- in start -----"); + chekcs = 1; + is_in_checkin.value = true; + is_at_start.value = true; + showModalBottomSheet( + context: Get.context!, + isScrollControlled: true, + builder: ((context) => BottomSheetNew())).whenComplete(() { + skip_gps = false; + chekcs = 0; + is_at_start.value = false; + is_in_checkin.value = false; + }); + } else if (is_in_rog.value == true && indexController.rog_mode == 1) { print("----- in location popup checkin cp - ${d.cp}----"); chekcs = 2; is_in_checkin.value = true; - showModalBottomSheet(context: Get.context!, isScrollControlled: true, - builder:((context) => BottomSheetNew()) - ).whenComplete((){ + showModalBottomSheet( + context: Get.context!, + isScrollControlled: true, + builder: ((context) => BottomSheetNew())).whenComplete(() { skip_gps = false; - chekcs =0; + chekcs = 0; is_in_checkin.value = false; }); } } - print("---- location checkin radious ${d.checkin_radious} ----"); - print("---- already checked in ${location_already_checked_in} ----"); - if(checkin_radious >= distance && location_already_checked_in == false && is_in_rog.value == true){ - CallforCheckin(d); - } - print("---- cp --- ${d.cp} -----"); - print("--- at goal ${is_at_goal} ---"); - print("--- rog counted ${rogaining_counted} ---"); - print("--- loc already checked in ${location_already_checked_in} ---"); - print("==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ===="); - if(isUser_logged_in && d.cp == -1 && location_already_checked_in && skip_10s == false){ - //check for rogaining - if(is_at_goal.value == false && rogaining_counted.value){ - //goal - print("---- in goal -----"); - chekcs = 5; - is_at_goal.value = true; - photos.clear(); - showModalBottomSheet(context: Get.context!, isScrollControlled: true, - builder:((context) => CameraPage(destination: d,)) - ).whenComplete((){ - skip_gps = false; - chekcs = 0; - is_at_goal.value = false; - }); - } - else if(is_in_rog.value == false && indexController.rog_mode == 1 && DateTime.now().difference(last_goal_at).inHours >= 24){ - //start - print("---- in start -----"); - chekcs = 6; - is_at_start.value = true; - showModalBottomSheet(context: Get.context!, isScrollControlled: true, - builder:((context) => BottomSheetNew()) - ).whenComplete((){ - print("----- finished start -------"); - skip_gps = false; - chekcs = 0; - is_at_start.value = false; - }); - } - } - print("==== _chekcs ${chekcs} ===="); - if(chekcs == 0){ + print("---- location checkin radious ${d.checkin_radious} ----"); + print("---- already checked in $locationAlreadyCheckedIn ----"); + if (checkinRadious >= distance && + locationAlreadyCheckedIn == false && + is_in_rog.value == true) { + CallforCheckin(d); + } + print("---- cp --- ${d.cp} -----"); + print("--- at goal $is_at_goal ---"); + print("--- rog counted $rogaining_counted ---"); + print("--- loc already checked in $locationAlreadyCheckedIn ---"); + print( + "==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ===="); + if (isuserLoggedIn && + d.cp == -1 && + locationAlreadyCheckedIn && + skip_10s == false) { + //check for rogaining + if (is_at_goal.value == false && rogaining_counted.value) { + //goal + print("---- in goal -----"); + chekcs = 5; + is_at_goal.value = true; + photos.clear(); + showModalBottomSheet( + context: Get.context!, + isScrollControlled: true, + builder: ((context) => CameraPage( + destination: d, + ))).whenComplete(() { skip_gps = false; - } + chekcs = 0; + is_at_goal.value = false; + }); + } else if (is_in_rog.value == false && + indexController.rog_mode == 1 && + DateTime.now().difference(last_goal_at).inHours >= 24) { + //start + print("---- in start -----"); + chekcs = 6; + is_at_start.value = true; + showModalBottomSheet( + context: Get.context!, + isScrollControlled: true, + builder: ((context) => BottomSheetNew())).whenComplete(() { + print("----- finished start -------"); + skip_gps = false; + chekcs = 0; + is_at_start.value = false; + }); + } + } + print("==== _chekcs $chekcs ===="); + if (chekcs == 0) { + skip_gps = false; + } } void resetRogaining() async { @@ -313,26 +318,23 @@ class DestinationController extends GetxController { is_at_goal.value = false; is_gps_selected.value = true; skip_gps = false; - - _start = 0; chekcs = 0; rogaining_counted.value = false; DatabaseHelper db = DatabaseHelper.instance; - int? _latgoal = await db.latestGoal(); - if(_latgoal != null){ - last_goal_at = DateTime.fromMicrosecondsSinceEpoch(_latgoal); - print("===== last goal : ${last_goal_at} ====="); + int? latgoal = await db.latestGoal(); + if (latgoal != null) { + last_goal_at = DateTime.fromMicrosecondsSinceEpoch(latgoal); + print("===== last goal : $last_goal_at ====="); } - - db.deleteAllDestinations().then((value){ + db.deleteAllDestinations().then((value) { PopulateDestinations(); initGPS(); }); - + // currentSelectedDestinations.forEach((element) { // deleteDestination(element); // }); @@ -344,93 +346,91 @@ class DestinationController extends GetxController { context, MaterialPageRoute( builder: (_) => CameraCamera( - onFile: (file) { - photos.add(file); - Navigator.pop(context); - print("----image file is : ${file}----"); + onFile: (file) { + photos.add(file); + Navigator.pop(context); + print("----image file is : $file----"); //setState(() {}); }, - ))); + ))); } - void getRoutePoints() { indexController.routePoints = []; indexController.routePointLenght.value = 0; - DestinationService.getDestinationLine(destinations, matrix)?.then((value){ + DestinationService.getDestinationLine(destinations, matrix)?.then((value) { indexController.routePoints = value; - indexController.routePointLenght.value = indexController.routePoints.length; + indexController.routePointLenght.value = + indexController.routePoints.length; }); } - Future getDestinationForLatLong(double lat, double long)async { - - for(final d in destinations){ - if(lat == d.lat && long == d.lon){ - return d; - } - } + Future getDestinationForLatLong(double lat, double long) async { + for (final d in destinations) { + if (lat == d.lat && long == d.lon) { + return d; + } + } + return null; } - void checkForCheckin(double la, double ln){ - - print("--- skip_gps ---- ${skip_gps}----"); - - for(final d in destinations){ + void checkForCheckin(double la, double ln) { + print("--- skip_gps ---- $skip_gps----"); + for (final d in destinations) { print("--- check checkin for--loc_id- ${d.sub_loc_id}----"); - double lat = d.lat!; - double lon = d.lon!; - LatLng p = LatLng(lat, lon); - getDestinationForLatLong(lat, lon).then((value){ - var distance = Distance(); - double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln)); - //double checkin_radious = value!.checkin_radious ?? double.infinity; - //bool auto_checkin = value.auto_checkin == 0 ? false : true; - //bool location_already_checked_id = d.checkedin ?? false; + double lat = d.lat!; + double lon = d.lon!; + LatLng p = LatLng(lat, lon); + getDestinationForLatLong(lat, lon).then((value) { + var distance = const Distance(); + double dist = + distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln)); + //double checkin_radious = value!.checkin_radious ?? double.infinity; + //bool auto_checkin = value.auto_checkin == 0 ? false : true; + //bool location_already_checked_id = d.checkedin ?? false; - // print("-----rogaining_counted---${rogaining_counted.value}-----"); - // print("-----is_in_rog---${is_in_rog}-----"); - // print("-----dist is ---${dist}-----"); - //print("----- ${indexController.currentUser} ----"); - - if(dist <= 250 && skip_gps == false){ - //near a destination - print("---- time with ${d.location_id} ----"); - startTimer(d, dist); - } - - }); + // print("-----rogaining_counted---${rogaining_counted.value}-----"); + // print("-----is_in_rog---${is_in_rog}-----"); + // print("-----dist is ---${dist}-----"); + //print("----- ${indexController.currentUser} ----"); + if (dist <= 250 && skip_gps == false) { + //near a destination + print("---- time with ${d.location_id} ----"); + startTimer(d, dist); + } + }); } - if(indexController.locations.isEmpty) return; + if (indexController.locations.isEmpty) return; //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; + LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, + mp.geoSerie!.geoPoints[0].longitude); - GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; - LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); + double latFs = pt.latitude; + double lonFs = pt.longitude; + LatLng pFs = LatLng(latFs, lonFs); + var distanceFs = const Distance(); + double distFs = + distanceFs.as(LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln)); - double lat_fs = pt.latitude; - double lon_fs = pt.longitude; - LatLng p_fs = LatLng(lat_fs, lon_fs); - var distance_fs = Distance(); - double dist_fs = distance_fs.as(LengthUnit.Meter, LatLng(lat_fs, lon_fs), LatLng(la, ln)); - - if(dist_fs <= 250 && skip_gps == false){ - //near a location - print("---- before call startTimerLocation ----"); - startTimerLocation(fs, dist_fs); - } + if (distFs <= 250 && skip_gps == false) { + //near a location + print("---- before call startTimerLocation ----"); + startTimerLocation(fs, distFs); + } } } - void addToRogaining(double lat, double lon, int destination_id) async { + void addToRogaining(double lat, double lon, int destinationId) async { DatabaseHelper db = DatabaseHelper.instance; - List d = await db.getDestinationById(destination_id); - if(d.isEmpty){ + List d = await db.getDestinationById(destinationId); + if (d.isEmpty) { Destination df = festuretoDestination(indexController.currentFeature[0]); print("--- made checkin ${df.location_id} ----"); makeCheckin(df, true, ""); @@ -438,105 +438,111 @@ class DestinationController extends GetxController { is_in_rog.value = true; } - void makeCheckin(Destination destination, bool action, String imageurl) async { - print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${destination.sub_loc_id}@@@@@@@@@@@"); - DatabaseHelper db = DatabaseHelper.instance; - List ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!); - - if(ddd.isEmpty){ - destination.checkedin = true; - await db.insertDestination(destination); - } + void makeCheckin( + Destination destination, bool action, String imageurl) async { + print( + "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${destination.sub_loc_id}@@@@@@@@@@@"); + DatabaseHelper db = DatabaseHelper.instance; + List ddd = + await db.getDestinationByLatLon(destination.lat!, destination.lon!); - PopulateDestinations(); + if (ddd.isEmpty) { + destination.checkedin = true; + await db.insertDestination(destination); + } - /// post to NATNAT - if(indexController.currentUser.length > 0){ - double cp_num = destination.cp!; - - int user_id = indexController.currentUser[0]["user"]["id"]; - //print("--- Pressed -----"); - String _team = indexController.currentUser[0]["user"]['team_name']; - //print("--- _team : ${_team}-----"); - String _event_code = indexController.currentUser[0]["user"]["event_code"]; - //print("--- _event_code : ${_event_code}-----"); - String _token = indexController.currentUser[0]["token"]; - //print("--- _token : ${_token}-----"); - DateTime now = DateTime.now(); - String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now); + PopulateDestinations(); - print("------ checkin event ${_event_code} ------"); - ExternalService().makeCheckpoint(user_id, _token, formattedDate, _team,cp_num.round(), _event_code, imageurl).then((value){ - print("------Ext service check point ${value} ------"); - }); - } + /// post to NATNAT + if (indexController.currentUser.isNotEmpty) { + double cpNum = destination.cp!; + int userId = indexController.currentUser[0]["user"]["id"]; + //print("--- Pressed -----"); + String team = indexController.currentUser[0]["user"]['team_name']; + //print("--- _team : ${_team}-----"); + String eventCode = indexController.currentUser[0]["user"]["event_code"]; + //print("--- _event_code : ${_event_code}-----"); + String token = indexController.currentUser[0]["token"]; + //print("--- _token : ${_token}-----"); + DateTime now = DateTime.now(); + String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now); + + print("------ checkin event $eventCode ------"); + ExternalService() + .makeCheckpoint(userId, token, formattedDate, team, cpNum.round(), + eventCode, imageurl) + .then((value) { + print("------Ext service check point $value ------"); + }); + } } - void initGPS(){ + void initGPS() { checkPermission(); PopulateDestinations(); - + //print("------ in iniit"); if (defaultTargetPlatform == TargetPlatform.android) { + print("---- GPS android -----"); locationSettings = AndroidSettings( - accuracy: LocationAccuracy.bestForNavigation, - distanceFilter: 0, - forceLocationManager: true, - intervalDuration: const Duration(seconds: 1), - //(Optional) Set foreground notification config to keep the app alive - //when going to the background - foregroundNotificationConfig: const ForegroundNotificationConfig( + accuracy: LocationAccuracy.best, + distanceFilter: 3, + forceLocationManager: true, + intervalDuration: const Duration(seconds: 1), + //(Optional) Set foreground notification config to keep the app alive + //when going to the background + foregroundNotificationConfig: const ForegroundNotificationConfig( notificationText: - "Example app will continue to receive your location even when you aren't using it", + " App will continue to receive your location even when you aren't using it", notificationTitle: "Running in Background", enableWakeLock: true, - ) - ); - } else if (defaultTargetPlatform == TargetPlatform.iOS || defaultTargetPlatform == TargetPlatform.macOS) { + )); + } else if (defaultTargetPlatform == TargetPlatform.iOS || + defaultTargetPlatform == TargetPlatform.macOS) { locationSettings = AppleSettings( - accuracy: LocationAccuracy.bestForNavigation, - activityType: ActivityType.fitness, - distanceFilter: 0, - pauseLocationUpdatesAutomatically: false, - // Only set to true if our app will be started up in the background. - showBackgroundLocationIndicator: true - ); + accuracy: LocationAccuracy.bestForNavigation, + activityType: ActivityType.fitness, + distanceFilter: 0, + pauseLocationUpdatesAutomatically: false, + // Only set to true if our app will be started up in the background. + showBackgroundLocationIndicator: true); } else { - locationSettings = LocationSettings( + locationSettings = const LocationSettings( accuracy: LocationAccuracy.high, distanceFilter: 0, ); } try { - - StreamSubscription positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen( - - (Position? position) { + StreamSubscription positionStream = + Geolocator.getPositionStream(locationSettings: locationSettings) + .listen((Position? position) { current_lat = position != null ? position.latitude : 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){ - double czoom = indexController.rogMapController!.zoom; - indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom); + if (is_gps_selected.value) { + double czoom = indexController.rogMapController.zoom; + indexController.rogMapController + .move(LatLng(position!.latitude, position.longitude), czoom); //String user_id = indexController.currentUser[0]["user"]["id"].toString(); //TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){ - //print("---- postion is ${position.latitude}, ${position.longitude}"); - gps.clear(); - gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --"); - checkForCheckin(position!.latitude, position.longitude); - print("--- call check checkin"); - print("---- skip gps is ${skip_gps.toString()} ----"); + //print("---- postion is ${position.latitude}, ${position.longitude}"); + gps.clear(); + gps.add( + "-- lat : ${position.latitude}, lon : ${position.longitude} --"); + checkForCheckin(position.latitude, position.longitude); + print("--- call check checkin"); + 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.add(err.toString()); } @@ -544,42 +550,57 @@ class DestinationController extends GetxController { ever(indexController.connectionStatusName, connectionChanged); } - @override void onInit() async { - initGPS(); super.onInit(); + } + void loadInitPoints(String token) async { + await indexController.loadUserDetailsForToken(token); + LocationService.getLocationsExt(token).then((value) { + if (value != null) { + print("--- loc ext is - $value ----"); + LatLngBounds bnds = LatLngBounds( + LatLng(value[1], value[0]), LatLng(value[3], value[2])); + print("--- bnds is - $bnds ----"); + indexController.mapController.fitBounds( + bnds, + ); + indexController.currentBound.clear(); + indexController.currentBound.add(bnds); + indexController.loadLocationsBound(); + } + }); + } + + readUserToken() async{ + final SharedPreferences prefs = await SharedPreferences.getInstance(); + indexController.userToken = prefs.getString("user_token"); } @override - void onReady() { - Get.toNamed(AppPages.LOGIN)!.then((value){ - if(indexController.currentUser.length > 0) { - String _token = indexController.currentUser[0]["token"]; + void onReady() async { + await readUserToken(); + if(indexController.userToken != null && indexController.userToken!.isNotEmpty){ + loadInitPoints(indexController.userToken!); + indexController.switchPage(AppPages.INITIAL); + return; + } + Get.toNamed(AppPages.LOGIN)!.then((value) { + if (indexController.currentUser.isNotEmpty) { + String token = indexController.currentUser[0]["token"]; indexController.switchPage(AppPages.INITIAL); - LocationService.getLocationsExt(_token).then((value) { - if(value != null){ - print("--- loc ext is - ${value} ----"); - LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); - print("--- bnds is - ${bnds} ----"); - indexController.mapController!.fitBounds( - bnds, - ); - indexController.currentBound.clear(); - indexController.currentBound.add(bnds); - indexController.loadLocationsBound(); - } - }); - } - else { + loadInitPoints(token); + } else { Get.toNamed(AppPages.TRAVEL); - PerfectureService.getSubExt("9").then((value){ - if(value != null){ - LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); - indexController.mapController!.fitBounds(bnds); //.centerZoomFitBounds(bnds); + PerfectureService.getSubExt("9").then((value) { + if (value != null) { + LatLngBounds bnds = LatLngBounds( + LatLng(value[1], value[0]), LatLng(value[3], value[2])); + indexController.mapController + .fitBounds(bnds); //.centerZoomFitBounds(bnds); } }); } @@ -588,29 +609,39 @@ class DestinationController extends GetxController { } void connectionChanged(String val) { - print('----- %%%%%%%%%%%%%%%%%%%%% ----- ${val}'); - Map _res = {}; - if(val == "wifi" || val == "mobile"){ - String _token = indexController.currentUser[0]["token"]; + print('----- %%%%%%%%%%%%%%%%%%%%% ----- $val'); + Map res = {}; + if (val == "wifi" || val == "mobile") { + String token = indexController.currentUser[0]["token"]; DatabaseHelper db = DatabaseHelper.instance; - db.allRogianing().then((value){ + db.allRogianing().then((value) { value.forEach((e) async { - if(e.rog_action_type == 0){ - _res = await ExternalService().StartRogaining(); - } - else if(e.rog_action_type == 1){ - var datetime = new 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!); - } - else if(e.rog_action_type == 2){ - var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); - _res = await ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!); + if (e.rog_action_type == 0) { + res = await ExternalService().StartRogaining(); + } else if (e.rog_action_type == 1) { + 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!); + } else if (e.rog_action_type == 2) { + var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); + 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!); } - }); }); } @@ -620,18 +651,18 @@ class DestinationController extends GetxController { LocationPermission permission = await Geolocator.checkPermission(); if (permission != LocationPermission.whileInUse || permission != LocationPermission.always) { - locationPermission.clear(); - locationPermission.add(permission.name); + locationPermission.clear(); + locationPermission.add(permission.name); permission = await Geolocator.requestPermission(); } } - Destination? destinationById(int id){ - Destination? d = null; - print("--- target des - ${id} ----"); - for(Destination ss in destinations){ + Destination? destinationById(int id) { + Destination? d; + print("--- target des - $id ----"); + for (Destination ss in destinations) { print("--- des - ${ss.location_id} ----"); - if(ss.location_id == id){ + if (ss.location_id == id) { d = ss; break; } @@ -639,65 +670,64 @@ class DestinationController extends GetxController { return d; } - void deleteDestination(Destination d){ + void deleteDestination(Destination d) { //int id = destinations[index].location_id!; //print("---- index ${destinations[index].location_id!}-----"); - for(Destination ss in destinations){ - if(ss.location_id == d.location_id){ + for (Destination ss in destinations) { + if (ss.location_id == d.location_id) { destinations.remove(ss); break; } } DatabaseHelper db = DatabaseHelper.instance; - db.deleteDestination(d.location_id!).then((value){ + db.deleteDestination(d.location_id!).then((value) { PopulateDestinations(); }); } - void deleteAllDestinations(){ + void deleteAllDestinations() { DatabaseHelper db = DatabaseHelper.instance; - db.deleteAllDestinations().then((value){ + db.deleteAllDestinations().then((value) { PopulateDestinations(); }); } - // ---------- database ------------------/// + // ---------- database ------------------/// - void addDestinations(Destination dest){ - - print('------ destination controller in add destination ${dest.checkin_radious} ---- :::::'); + void addDestinations(Destination dest) { + print( + '------ destination controller in add destination ${dest.checkin_radious} ---- :::::'); DatabaseHelper db = DatabaseHelper.instance; - db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){ - if(value.isNotEmpty){ - db.deleteDestination(value[0].location_id!).then((value){ - db.insertDestination(dest).then((value){ - print("----- destination controller deleted and inserted destination id $value ---- :::::"); + db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value) { + if (value.isNotEmpty) { + db.deleteDestination(value[0].location_id!).then((value) { + db.insertDestination(dest).then((value) { + print( + "----- destination controller deleted and inserted destination id $value ---- :::::"); PopulateDestinations(); }); }); - } - else { - db.insertDestination(dest).then((value){ - print("----- destination controller added as new ${value}--- :::::"); - PopulateDestinations(); - }); + } else { + db.insertDestination(dest).then((value) { + print("----- destination controller added as new $value--- :::::"); + PopulateDestinations(); + }); } }); - } void toggleSelection(Destination dest) async { DatabaseHelper db = DatabaseHelper.instance; await db.toggleSelecttion(dest); destinations.clear(); - db.getDestinations().then((value){ + db.getDestinations().then((value) { destinationCount.value = 0; currentSelectedDestinations.clear(); - for(Destination d in value){ + for (Destination d in value) { //print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::"); //print("-----populated----- ${d.toMap()}"); - if(d.selected!){ + if (d.selected!) { currentSelectedDestinations.add(d); } destinations.add(d); @@ -711,126 +741,113 @@ class DestinationController extends GetxController { context: context, barrierDismissible: false, builder: (BuildContext context) { - return Center( + return const Center( child: CircularProgressIndicator(), ); }); } - void destinationMatrixFromCurrentPoint(List points){ + void destinationMatrixFromCurrentPoint(List points) { buildShowDialog(Get.context!); - MatrixService.getDestinations(points).then((mat){ - print(" matrix is ------- ${mat}"); + MatrixService.getDestinations(points).then((mat) { + print(" matrix is ------- $mat"); matrix = mat; - try{ + try { indexController.routePoints = []; indexController.routePointLenght.value = 0; - DestinationService.getDestinationLine(points, matrix)?.then((value){ + DestinationService.getDestinationLine(points, matrix)?.then((value) { indexController.routePoints = value; - indexController.routePointLenght.value = indexController.routePoints.length; + indexController.routePointLenght.value = + indexController.routePoints.length; Get.toNamed(AppPages.TRAVEL); }); destinationCount.value = destinations.length; - } - catch(_){ + } catch (_) { skip_gps = false; return; - } - finally{ + } finally { Get.back(); } }); } - void PopulateDestinations(){ - print("--------- destination controller populsting destinations ----------- ::::::"); + void PopulateDestinations() { + print( + "--------- destination controller populsting destinations ----------- ::::::"); DatabaseHelper db = DatabaseHelper.instance; destinations.clear(); - db.getDestinations().then((value){ + db.getDestinations().then((value) { destinationCount.value = 0; - for(Destination d in value){ - print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::"); + for (Destination d in value) { + print( + "------ destination controller populating destination-------- ${d.checkedin}-------- :::::"); print("-----populated----- ${d.toMap()}"); destinations.add(d); } - // destinationCount.value = 0; - print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::"); + // destinationCount.value = 0; + print( + "------ destination controller destinationcount-------- $destinationCount-------- :::::"); + MatrixService.getDestinations(value).then((mat) { + print(" matrix is ------- $mat"); + matrix = mat; - MatrixService.getDestinations(value).then((mat){ - print(" matrix is ------- ${mat}"); - matrix = mat; - - try{ - getRoutePoints(); - destinationCount.value = destinations.length; - } - catch(_){ - skip_gps = false; - return; - } - + try { + getRoutePoints(); + destinationCount.value = destinations.length; + } catch (_) { + skip_gps = false; + return; + } + }); }); - }); - } - - void makeOrder(Destination d, int dir){ + void makeOrder(Destination d, int dir) { DatabaseHelper db = DatabaseHelper.instance; - db.updateOrder(d, dir).then((value){ + db.updateOrder(d, dir).then((value) { PopulateDestinations(); }); } - - void makeNext(Destination pt){ - - for(int i=0; i<= destinations.length - 1; i++){ + void makeNext(Destination pt) { + for (int i = 0; i <= destinations.length - 1; i++) { Destination p = destinations[i]; - if(p.lat == pt.lat && p.lon == pt.lon ){ - - if(indexController.currentDestinationFeature.isNotEmpty){ - indexController.currentDestinationFeature.clear(); - } - if(i >= destinations.length - 1 ){ - indexController.currentDestinationFeature.add(destinations[0]); - //getAction(); - } - else{ - indexController.currentDestinationFeature.add(destinations[i + 1]); - //getAction(); - } + if (p.lat == pt.lat && p.lon == pt.lon) { + if (indexController.currentDestinationFeature.isNotEmpty) { + indexController.currentDestinationFeature.clear(); + } + if (i >= destinations.length - 1) { + indexController.currentDestinationFeature.add(destinations[0]); + //getAction(); + } else { + indexController.currentDestinationFeature.add(destinations[i + 1]); + //getAction(); + } } } - } - void makePrevious(Destination pt){ - - for(int i=0; i<= destinations.length - 1; i++){ + void makePrevious(Destination pt) { + for (int i = 0; i <= destinations.length - 1; i++) { Destination p = destinations[i]; - if(p.lat == pt.lat && p.lon == pt.lon ){ - - if(indexController.currentDestinationFeature.isNotEmpty){ - indexController.currentDestinationFeature.clear(); - } - if(i <= 0){ - indexController.currentDestinationFeature.add(destinations[destinations.length -1]); - //getAction(); - } - else{ - indexController.currentDestinationFeature.add(destinations[i - 1]); - //getAction(); - } + if (p.lat == pt.lat && p.lon == pt.lon) { + if (indexController.currentDestinationFeature.isNotEmpty) { + indexController.currentDestinationFeature.clear(); + } + if (i <= 0) { + indexController.currentDestinationFeature + .add(destinations[destinations.length - 1]); + //getAction(); + } else { + indexController.currentDestinationFeature.add(destinations[i - 1]); + //getAction(); + } } } - } - - -} \ No newline at end of file +} diff --git a/lib/pages/destination/destination_page.dart b/lib/pages/destination/destination_page.dart index 55bad16..49a7ebc 100644 --- a/lib/pages/destination/destination_page.dart +++ b/lib/pages/destination/destination_page.dart @@ -1,20 +1,14 @@ -import 'dart:developer'; -import 'dart:io'; -import 'package:camera_camera/camera_camera.dart'; import 'package:flutter/material.dart'; import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; import 'package:latlong2/latlong.dart'; -import 'package:rogapp/pages/camera/camera_page.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination_map/destination_map_page.dart'; import 'package:rogapp/pages/drawer/drawer_page.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/services/external_service.dart'; import 'package:rogapp/widgets/destination_widget.dart'; -import 'package:timeline_tile/timeline_tile.dart'; class DestnationPage extends StatelessWidget { DestnationPage({Key? key}) : super(key: key); @@ -33,12 +27,12 @@ class DestnationPage extends StatelessWidget { } Position position = await Geolocator.getCurrentPosition( desiredAccuracy: LocationAccuracy.high); - indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14); + indexController.rogMapController.move(LatLng(position.latitude, position.longitude), 14); } Image getImage(int index){ if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); + return const Image(image: AssetImage('assets/images/empty_image.png')); } else{ return Image(image: NetworkImage(destinationController.destinations[index].photos!)); @@ -48,13 +42,13 @@ class DestnationPage extends StatelessWidget { Widget getRoutingImage(int route){ switch (route) { case 0: - return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,); + return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,); case 1: - return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,); + return const Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,); case 2: - return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,); + return const Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,); default: - return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,); + return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,); } } @@ -69,6 +63,7 @@ class DestnationPage extends StatelessWidget { return false; }, child: Scaffold( + drawer: DrawerPage(), bottomNavigationBar: BottomAppBar( child: Row( @@ -85,12 +80,12 @@ class DestnationPage extends StatelessWidget { children: [ Padding( padding: const EdgeInsets.only(top:30.0, bottom: 30), - child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),), + child: Center(child: Text("select_travel_mode".tr, style: const TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),), ), ListTile( selected: destinationController.travelMode == 0 ? true : false, selectedTileColor: Colors.amber.shade200, - leading: Image(image: AssetImage('assets/images/p4_9_man.png'),), + leading: const Image(image: AssetImage('assets/images/p4_9_man.png'),), title: Text("walking".tr), onTap:(){ destinationController.travelMode.value = 0; @@ -101,7 +96,7 @@ class DestnationPage extends StatelessWidget { ListTile( selected: destinationController.travelMode == 1 ? true : false, selectedTileColor: Colors.amber.shade200, - leading: Image(image: AssetImage('assets/images/p4_8_car.png'),), + leading: const Image(image: AssetImage('assets/images/p4_8_car.png'),), title: Text("driving".tr), onTap:(){ destinationController.travelMode.value = 1; @@ -147,13 +142,13 @@ class DestnationPage extends StatelessWidget { indexController.toggleDestinationMode(); }, tooltip: 'Increment', + elevation: 4.0, child: Obx(() => indexController.desination_mode == 1 ? - Image(image: AssetImage('assets/images/list2.png')) + const Image(image: AssetImage('assets/images/list2.png')) : - Image(image: AssetImage('assets/images/map.png')) + const Image(image: AssetImage('assets/images/map.png')) ), - elevation: 4.0, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, appBar:AppBar( @@ -170,12 +165,12 @@ class DestnationPage extends StatelessWidget { destinationController.is_at_goal == true ? IconButton( onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);}, - icon: Icon(Icons.assistant_photo), + icon: const Icon(Icons.assistant_photo), ) : IconButton( onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);}, - icon: Icon(Icons.accessibility), + icon: const Icon(Icons.accessibility), ), ), // Obx(() => @@ -185,9 +180,6 @@ class DestnationPage extends StatelessWidget { ToggleButtons( disabledColor: Colors.grey.shade200, selectedColor: Colors.red, - children: [ - Icon(Icons.explore, size: 35.0, - )], onPressed: (int index) { destinationController.is_gps_selected.value = !destinationController.is_gps_selected.value; if(destinationController.is_gps_selected.value){ @@ -197,6 +189,9 @@ class DestnationPage extends StatelessWidget { } }, isSelected: [destinationController.is_gps_selected.value], + children: const [ + Icon(Icons.explore, size: 35.0, + )], ), ), // IconButton(onPressed: (){ diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart index 8f16599..63bd1ab 100644 --- a/lib/pages/destination_map/destination_map_page.dart +++ b/lib/pages/destination_map/destination_map_page.dart @@ -5,21 +5,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_map/plugin_api.dart'; import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart'; -import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart'; -import 'package:geojson/geojson.dart'; -import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; import 'package:latlong2/latlong.dart'; import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/services/destination_service.dart'; import 'package:rogapp/utils/text_util.dart'; import 'package:rogapp/widgets/base_layer_widget.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -import 'package:rogapp/widgets/bread_crum_widget.dart'; class DestinationMapPage extends StatelessWidget { @@ -46,7 +40,7 @@ class DestinationMapPage extends StatelessWidget { int index = -1; for (int i = 0; i < destinationController.destinations.length; i++) { Destination d = destinationController.destinations[i]; - print("^^^^ ${d} ^^^^"); + print("^^^^ $d ^^^^"); Marker m = Marker( point: LatLng(d.lat!, d.lon!), anchorPos: AnchorPos.align(AnchorAlign.center), @@ -55,21 +49,19 @@ class DestinationMapPage extends StatelessWidget { return InkWell( onTap: (){ print("-- Destination is --- ${d.name} ------"); - if(d != null){ - if(indexController.currentDestinationFeature.length > 0) { - indexController.currentDestinationFeature.clear(); - } - indexController.currentDestinationFeature.add(d); - //indexController.getAction(); - - showModalBottomSheet(context: Get.context!, isScrollControlled: true, - builder:((context) => BottomSheetNew()) - ).whenComplete((){ - print("---- set skip gps to false -----"); - destinationController.skip_gps = false; - }); + if(indexController.currentDestinationFeature.isNotEmpty) { + indexController.currentDestinationFeature.clear(); } - }, + indexController.currentDestinationFeature.add(d); + //indexController.getAction(); + + showModalBottomSheet(context: Get.context!, isScrollControlled: true, + builder:((context) => BottomSheetNew()) + ).whenComplete((){ + print("---- set skip gps to false -----"); + destinationController.skip_gps = false; + }); + }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -79,19 +71,19 @@ class DestinationMapPage extends StatelessWidget { decoration: BoxDecoration( color: Colors.red, shape: BoxShape.circle, - border: new Border.all( + border: Border.all( color: Colors.white, width: d.checkin_radious != null ? d.checkin_radious! : 1, ), ), - child: new Center( - child: new Text( + child: Center( + child: Text( (i + 1).toString(), - style: TextStyle(color: Colors.white), + style: const TextStyle(color: Colors.white), ), ), ), - Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)), + Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: const TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)), ], ), ); @@ -132,28 +124,28 @@ class DestinationMapPage extends StatelessWidget { options: MapOptions( onMapReady: (){ indexController.is_rog_mapcontroller_loaded.value = true; - subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) { + subscription = indexController.rogMapController.mapEventStream.listen((MapEvent mapEvent) { if (mapEvent is MapEventMoveStart) { } if (mapEvent is MapEventMoveEnd) { //destinationController.is_gps_selected.value = true; //indexController.mapController!.move(c.center, c.zoom); - LatLngBounds bounds = indexController.rogMapController!.bounds!; + LatLngBounds bounds = indexController.rogMapController.bounds!; indexController.currentBound.clear(); indexController.currentBound.add(bounds); - if(indexController.currentUser.length <= 0){ + if(indexController.currentUser.isEmpty){ indexController.loadLocationsBound(); } } }); } , - bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), + bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), zoom: 1, maxZoom: 42, interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, ), children: [ - BaseLayer(), + const BaseLayer(), Obx(() => indexController.routePointLenght > 0 ? PolylineLayer( diff --git a/lib/pages/drawer/drawer_page.dart b/lib/pages/drawer/drawer_page.dart index c782f38..169cbad 100644 --- a/lib/pages/drawer/drawer_page.dart +++ b/lib/pages/drawer/drawer_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/services/auth_service.dart'; @@ -33,16 +32,16 @@ class DrawerPage extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: - indexController.currentUser.length == 0 ? - Flexible(child: Text("drawer_title".tr, style: TextStyle(color: Colors.black, fontSize: 20),)) + indexController.currentUser.isEmpty ? + Flexible(child: Text("drawer_title".tr, style: const TextStyle(color: Colors.black, fontSize: 20),)) : - Text(indexController.currentUser[0]['user']['email'], style: TextStyle(color: Colors.black, fontSize: 20),), + Text(indexController.currentUser[0]['user']['email'], style: const TextStyle(color: Colors.black, fontSize: 20),), ), ) ), ), Obx(() => - indexController.currentUser.length == 0 ? + indexController.currentUser.isEmpty ? ListTile( leading: const Icon(Icons.login), title: Text("login".tr), @@ -59,7 +58,7 @@ class DrawerPage extends StatelessWidget { }, ) ), - indexController.currentUser.length > 0 ? + indexController.currentUser.isNotEmpty ? ListTile( leading: const Icon(Icons.password), title: Text("change_password".tr), @@ -67,8 +66,8 @@ class DrawerPage extends StatelessWidget { Get.toNamed(AppPages.CHANGE_PASSWORD); }, ) : - Container(width: 0, height: 0,), - indexController.currentUser.length == 0 ? + const SizedBox(width: 0, height: 0,), + indexController.currentUser.isEmpty ? ListTile( leading: const Icon(Icons.person), title: Text("sign_up".tr), @@ -76,14 +75,14 @@ class DrawerPage extends StatelessWidget { Get.toNamed(AppPages.REGISTER); }, ) : - Container(width: 0, height: 0,), - indexController.currentUser.length > 0 ? + const SizedBox(width: 0, height: 0,), + indexController.currentUser.isNotEmpty ? ListTile( leading: const Icon(Icons.delete_forever), title: Text("delete_account".tr), onTap: (){ - String _token = indexController.currentUser[0]['token']; - AuthService.deleteUser(_token).then((value){ + String token = indexController.currentUser[0]['token']; + AuthService.deleteUser(token).then((value){ if(value.isNotEmpty){ indexController.logout(); Get.toNamed(AppPages.TRAVEL); @@ -92,7 +91,7 @@ class DrawerPage extends StatelessWidget { }); }, ) : - Container(width: 0, height: 0,), + const SizedBox(width: 0, height: 0,), // ListTile( // leading: const Icon(Icons.person), // title: Text("profile".tr), @@ -108,7 +107,7 @@ class DrawerPage extends StatelessWidget { // title: Text("point_rank".tr), // onTap: (){}, // ), - indexController.currentUser.length > 0 ? + indexController.currentUser.isNotEmpty ? ListTile( leading: const Icon(Icons.featured_video), title: Text("rog_web".tr), @@ -116,7 +115,7 @@ class DrawerPage extends StatelessWidget { _launchURL("https://www.gifuai.net/?page_id=17397"); }, ) : - Container(width: 0, height: 0,), + const SizedBox(width: 0, height: 0,), ListTile( leading: const Icon(Icons.privacy_tip), title: Text("privacy".tr), diff --git a/lib/pages/history/history_page.dart b/lib/pages/history/history_page.dart new file mode 100644 index 0000000..11e6781 --- /dev/null +++ b/lib/pages/history/history_page.dart @@ -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 createState() => _HistoryPageState(); +} + +class _HistoryPageState extends State { + 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> 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(); + }), + ], + ), + ), + ); + } +} diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 47a2086..779b2ee 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -3,6 +3,8 @@ import 'package:get/get.dart'; import 'package:rogapp/pages/search/search_page.dart'; class HomePage extends GetView{ + const HomePage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Scaffold( diff --git a/lib/pages/index/index_binding.dart b/lib/pages/index/index_binding.dart index 6202ebb..298fc61 100644 --- a/lib/pages/index/index_binding.dart +++ b/lib/pages/index/index_binding.dart @@ -1,12 +1,17 @@ -import 'package:flutter_map/plugin_api.dart'; import 'package:get/get.dart'; -import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; class IndexBinding extends Bindings { + + IndexBinding(this.token); + + String? token; + @override void dependencies() { - Get.put(IndexController()); + final IndexController indexController = IndexController(); + indexController.userToken = token; + Get.put(indexController); } } diff --git a/lib/pages/index/index_controller.dart b/lib/pages/index/index_controller.dart index da25c94..e19b84f 100644 --- a/lib/pages/index/index_controller.dart +++ b/lib/pages/index/index_controller.dart @@ -20,6 +20,7 @@ import 'package:rogapp/services/cat_service.dart'; import 'package:rogapp/services/location_service.dart'; import 'package:rogapp/services/perfecture_service.dart'; import 'package:rogapp/utils/database_helper.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class IndexController extends GetxController { List locations = [].obs; @@ -34,6 +35,8 @@ class IndexController extends GetxController { List currentCat = [].obs; + String? userToken; + List> currentUser = >[].obs; List currentAction = [].obs; List routePoints = [].obs; @@ -58,8 +61,7 @@ class IndexController extends GetxController { bool showPopup = true; - - String dropdownValue = "9"; + String dropdownValue = "9"; String subDropdownValue = "-1"; String areaDropdownValue = "-1"; String cateogory = "-all-"; @@ -71,49 +73,50 @@ class IndexController extends GetxController { final Connectivity _connectivity = Connectivity(); late StreamSubscription _connectivitySubscription; - void toggleMode(){ - if(mode.value==0){ + void toggleMode() { + if (mode.value == 0) { mode += 1; - } - else{ + } else { mode -= 1; } } - void toggleDestinationMode(){ - if(desination_mode.value==0){ + void toggleDestinationMode() { + if (desination_mode.value == 0) { desination_mode.value += 1; - } - else{ + } else { desination_mode.value -= 1; } } - void switchPage(String page){ + void switchPage(String page) { //print("######## ${currentUser[0]["user"]["id"]}"); switch (page) { - case AppPages.INITIAL :{ - rog_mode.value = 0; - print("-- rog mode is ctrl is ${rog_mode.value}"); - Get.toNamed(page); - } + case AppPages.INITIAL: + { + rog_mode.value = 0; + print("-- rog mode is ctrl is ${rog_mode.value}"); + Get.toNamed(page); + } break; - case AppPages.TRAVEL : { - rog_mode.value = 1; - //Get.back(); - Get.off(DestnationPage(), binding: DestinationBinding()); - - } - break; - case AppPages.LOGIN :{ - rog_mode.value = 2; - Get.toNamed(page); - } - break; - default:{ - rog_mode.value = 0; - Get.toNamed(AppPages.INITIAL); - } + case AppPages.TRAVEL: + { + rog_mode.value = 1; + //Get.back(); + Get.off(DestnationPage(), binding: DestinationBinding()); + } + break; + case AppPages.LOGIN: + { + rog_mode.value = 2; + Get.toNamed(page); + } + break; + default: + { + rog_mode.value = 0; + Get.toNamed(AppPages.INITIAL); + } } } @@ -121,32 +124,33 @@ class IndexController extends GetxController { void onInit() { _ever = ever(rog_mode, (_) => print("$_ has been changed (ever)")); - if(perfectures.length == 0){ - PerfectureService.loadPerfectures().then((value){ + if (perfectures.isEmpty) { + PerfectureService.loadPerfectures().then((value) { perfectures.add(value); loadAreaFor("9"); - + //loadSubPerfFor("9"); }); - } + } - _connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); + _connectivitySubscription = + _connectivity.onConnectivityChanged.listen(_updateConnectionStatus); super.onInit(); -} + } -@override -void onClose() { + @override + void onClose() { _connectivitySubscription.cancel(); super.onClose(); -} + } -Future _updateConnectionStatus(ConnectivityResult result) async { - connectionStatus = result; - connectionStatusName.value = result.name; -} + Future _updateConnectionStatus(ConnectivityResult result) async { + connectionStatus = result; + connectionStatusName.value = result.name; + } -Future initConnectivity() async { + Future initConnectivity() async { late ConnectivityResult result; // Platform messages may fail, so we use a try/catch PlatformException. try { @@ -159,211 +163,221 @@ Future initConnectivity() async { return _updateConnectionStatus(result); } -LatLngBounds boundsFromLatLngList(List list) { - double? x0, x1, y0, y1; - for (LatLng latLng in list) { - if (x0 == null || x1 == null || y0 == null || y1 == null) { - x0 = x1 = latLng.latitude; - y0 = y1 = latLng.longitude; - } else { - if (latLng.latitude > x1) x1 = latLng.latitude; - if (latLng.latitude < x0) x0 = latLng.latitude; - if (latLng.longitude > y1) y1 = latLng.longitude; - if (latLng.longitude < y0) y0 = latLng.longitude; + LatLngBounds boundsFromLatLngList(List list) { + double? x0, x1, y0, y1; + for (LatLng latLng in list) { + if (x0 == null || x1 == null || y0 == null || y1 == null) { + x0 = x1 = latLng.latitude; + y0 = y1 = latLng.longitude; + } else { + if (latLng.latitude > x1) x1 = latLng.latitude; + if (latLng.latitude < x0) x0 = latLng.latitude; + if (latLng.longitude > y1) y1 = latLng.longitude; + if (latLng.longitude < y0) y0 = latLng.longitude; + } } + + return LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!)); } - return LatLngBounds(LatLng(x1!, y1!), LatLng(x0!, y0!)); -} + List getLocationsList() { + List locs = []; + for (int i = 0; i <= locations[0].collection.length - 1; i++) { + GeoJsonMultiPoint p = + locations[0].collection[i].geometry as GeoJsonMultiPoint; - -List getLocationsList(){ - List locs = []; - for(int i=0; i<= locations[0].collection.length - 1; i++){ - GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint; - - LatLng latLng = LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude); - locs.add(latLng); + LatLng latLng = LatLng(p.geoSerie!.geoPoints[0].latitude, + p.geoSerie!.geoPoints[0].longitude); + locs.add(latLng); + } + return locs; } - return locs; -} + void saveToDevice(String val) async { + final SharedPreferences prefs = await SharedPreferences.getInstance(); + await prefs.setString("user_token", val); + } -void login(String email, String password, BuildContext context){ - AuthService.login(email, password).then((value){ - print("------- logged in user details ######## ${value} ###### --------"); - if(value.isNotEmpty){ - currentUser.clear(); - currentUser.add(value); - is_loading.value = false; - Navigator.pop(context); - loadUserDetails(); - loadLocationsBound(); - cats.clear(); - if(currentFeature.isNotEmpty){ - getAction(); - } + void changeUser(Map 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.length > 0){ - rog_mode.value = 0 ; - } - else{ - rog_mode.value = 1; - } + 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{ + if (rog_mode.value == 1) { + switchPage(AppPages.TRAVEL); + } else { + switchPage(AppPages.INITIAL); + } + //Get.toNamed(AppPages.INITIAL); + } + + void login(String email, String password, BuildContext context) { + AuthService.login(email, password).then((value) { + print("------- logged in user details ######## $value ###### --------"); + if (value.isNotEmpty) { + Navigator.pop(context); + print("--------- user details login ----- $value"); + changeUser(value); + } else { is_loading.value = false; Get.snackbar( - "Failed", - "User login failed, please try again.", - icon: Icon(Icons.error, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - } - - }); - } + "Failed", + "User login failed, please try again.", + icon: const Icon(Icons.error, size: 40.0, color: Colors.blue), + snackPosition: SnackPosition.TOP, + duration: const Duration(milliseconds: 800), + backgroundColor: Colors.yellow, + //icon:Image(image:AssetImage("assets/images/dora.png")) + ); + } + }); + } - void changePassword(String oldpassword, String newpassword, BuildContext context){ - String _token = currentUser[0]['token']; - //print("------- change password ######## ${currentUser[0]['token']} ###### --------"); - AuthService.changePassword(oldpassword, newpassword, _token).then((value){ - print("------- change password ######## ${value} ###### --------"); - if(value.isNotEmpty){ + void changePassword( + String oldpassword, String newpassword, BuildContext context) { + String token = currentUser[0]['token']; + //print("------- change password ######## ${currentUser[0]['token']} ###### --------"); + AuthService.changePassword(oldpassword, newpassword, token).then((value) { + print("------- change password ######## $value ###### --------"); + if (value.isNotEmpty) { is_loading.value = false; Navigator.pop(context); - if(rog_mode.value == 1){ + if (rog_mode.value == 1) { switchPage(AppPages.TRAVEL); - } - else{ + } else { switchPage(AppPages.INITIAL); } - }else{ + } else { Get.snackbar( - 'failed'.tr, - 'password_change_failed_please_try_again'.tr, - icon: Icon(Icons.error, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - } - - }); - is_loading.value = false; - } + 'failed'.tr, + 'password_change_failed_please_try_again'.tr, + icon: const Icon(Icons.error, size: 40.0, color: Colors.blue), + snackPosition: SnackPosition.TOP, + duration: const Duration(milliseconds: 800), + backgroundColor: Colors.yellow, + //icon:Image(image:AssetImage("assets/images/dora.png")) + ); + } + }); + is_loading.value = false; + } - void logout() async{ + void logout() async { locations.clear(); DatabaseHelper db = DatabaseHelper.instance; - db.deleteAllDestinations().then((value){ - DestinationController destinationController = Get.find(); - if(destinationController != null){ - destinationController.PopulateDestinations(); - } + db.deleteAllDestinations().then((value) { + DestinationController destinationController = + Get.find(); + destinationController.PopulateDestinations(); }); currentUser.clear(); cats.clear(); - } + } - void register(String email, String password, BuildContext context){ - AuthService.register(email, password).then((value){ - if(value.isNotEmpty){ + void register(String email, String password, BuildContext context) { + AuthService.register(email, password).then((value) { + if (value.isNotEmpty) { currentUser.clear(); currentUser.add(value); is_loading.value = false; Navigator.pop(context); loadUserDetails(); Get.toNamed(AppPages.INITIAL); - }else{ - is_loading.value = false; - Get.snackbar( - 'failed'.tr, - 'user_registration_failed_please_try_again'.tr, - icon: Icon(Icons.error, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); - } - }); - } - - void makeAction(BuildContext context){ - int user_id = currentUser[0]["user"]["id"] as int; - int location_id = currentFeature[0].properties!["location_id"] as int; - bool wanttogo = currentAction[0][0]["wanttogo"]; - bool like = currentAction[0][0]["like"]; - bool checkin = currentAction[0][0]["checkin"]; - if(user_id > 0){ - ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){ - }); - } - - } - - String getCatText(){ - String _cat = 'all'.tr; - if(currentUser.length > 0){ - Map _urs = currentUser[0]; - print('-- is_rogaining :-- ${_urs['user']['is_rogaining']} ------'); - if(_urs['user']['is_rogaining'] == true){ - _cat = 'rogaining'.tr; + } else { + is_loading.value = false; + Get.snackbar( + 'failed'.tr, + 'user_registration_failed_please_try_again'.tr, + icon: const Icon(Icons.error, size: 40.0, color: Colors.blue), + snackPosition: SnackPosition.TOP, + duration: const Duration(milliseconds: 800), + backgroundColor: Colors.yellow, + //icon:Image(image:AssetImage("assets/images/dora.png")) + ); } - else { - _cat = 'sight_seeing'.tr; - } - } - return _cat; + }); } - void loadCatsv2(){ - dynamic initVal = {'category':getCatText()}; - LatLngBounds bounds = mapController!.bounds!; - if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) { - cats.clear(); - cats.add(initVal); - for(dynamic cat in value!){ - if(cat['category'] != null){ - cats.add(cat!); - } - } - }); - } - } + void makeAction(BuildContext context) { + int userId = currentUser[0]["user"]["id"] as int; + int locationId = currentFeature[0].properties!["location_id"] as int; + bool wanttogo = currentAction[0][0]["wanttogo"]; + bool like = currentAction[0][0]["like"]; + bool checkin = currentAction[0][0]["checkin"]; + if (userId > 0) { + ActionService.makeAction(userId, locationId, wanttogo, like, checkin) + .then((value) {}); + } + } - void loadCatForCity(String city){ - dynamic initVal = {'category':getCatText()}; - LatLngBounds bounds = mapController!.bounds!; - if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - CatService.loadCatByCity(city).then((value) { - cats.clear(); - cats.add(initVal); - for(dynamic cat in value!){ - if(cat['category'] != null){ - cats.add(cat!); - } - } - }); - } - } + String getCatText() { + String cat = 'all'.tr; + if (currentUser.isNotEmpty) { + Map urs = currentUser[0]; + print('-- is_rogaining :-- ${urs['user']['is_rogaining']} ------'); + if (urs['user']['is_rogaining'] == true) { + cat = 'rogaining'.tr; + } else { + cat = 'sight_seeing'.tr; + } + } + return cat; + } + void loadCatsv2() { + dynamic initVal = {'category': getCatText()}; + LatLngBounds bounds = mapController.bounds!; + CatService.loadCats( + bounds.southWest.latitude, + bounds.southWest.longitude, + bounds.northWest.latitude, + bounds.northWest.longitude, + bounds.northEast.latitude, + bounds.northEast.longitude, + bounds.southEast.latitude, + bounds.southEast.longitude) + .then((value) { + cats.clear(); + cats.add(initVal); + for (dynamic cat in value!) { + if (cat['category'] != null) { + cats.add(cat!); + } + } + }); + } + void loadCatForCity(String city) { + dynamic initVal = {'category': getCatText()}; + LatLngBounds bounds = mapController.bounds!; + CatService.loadCatByCity(city).then((value) { + cats.clear(); + cats.add(initVal); + for (dynamic cat in value!) { + if (cat['category'] != null) { + cats.add(cat!); + } + } + }); + } - void refreshLocationForCat(){ + void refreshLocationForCat() { loadLocationsBound(); // if(subDropdownValue == "-1"){ // LocationService.loadLocationsFor(dropdownValue, currentCat[0]).then((value){ @@ -372,7 +386,7 @@ void login(String email, String password, BuildContext context){ // is_loading.value = false; // }); // print("loading main------"); - // } + // } // else{ // LocationService.loadLocationsSubFor(subDropdownValue, currentCat[0]).then((value){ // locations.clear(); @@ -381,59 +395,75 @@ void login(String email, String password, BuildContext context){ // }); // print("loading sub------"); // } - } + } - void loadAreaFor(String perf){ + void loadAreaFor(String perf) { areas.clear(); - dynamic initVal = {'id':'-1', 'area_nm':'----'}; - PerfectureService.loadGifuAreas(perf).then((value){ + dynamic initVal = {'id': '-1', 'area_nm': '----'}; + PerfectureService.loadGifuAreas(perf).then((value) { value!.add(initVal); areas.add(value); }); } - void loadUserDetails(){ - if(currentUser.length > 0){ - int user_id = currentUser[0]["user"]["id"] as int; - AuthService.UserDetails(user_id).then((value){ - print("--------- user details ----- ${value}"); - if(value != null && value.isNotEmpty){ - bool paid = value![0]["paid"] as bool; - if(paid){ - loadCustomAreas(); - } - } + void loadUserDetails() { + if (currentUser.isNotEmpty) { + int userId = currentUser[0]["user"]["id"] as int; + AuthService.UserDetails(userId).then((value) { + print("--------- user details ----- $value"); + // if (value != null && value.isNotEmpty) { + // bool paid = value[0]["paid"] as bool; + // if (paid) { + // loadCustomAreas(); + // } + // } }); } } + 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(); - PerfectureService.loadCustomAreas().then((value){ - print("--- loading custom areas ${value}"); + PerfectureService.loadCustomAreas().then((value) { + print("--- loading custom areas $value"); customAreas.add(value); }); } - - void loadSubPerfFor(String perf){ + void loadSubPerfFor(String perf) { subPerfs.clear(); - dynamic initVal = {'id':'-1', 'adm2_ja':'----'}; - PerfectureService.loadSubPerfectures(perf).then((value){ + dynamic initVal = {'id': '-1', 'adm2_ja': '----'}; + PerfectureService.loadSubPerfectures(perf).then((value) { value!.add(initVal); subPerfs.add(value); subDropdownValue = getSubInitialVal(); }); } - String getSubInitialVal(){ + String getSubInitialVal() { int min = 0; - if(subPerfs.length > 0){ + if (subPerfs.isNotEmpty) { min = int.parse(subPerfs[0][0]['id'].toString()); - for(var sub in subPerfs[0]){ + for (var sub in subPerfs[0]) { int x = int.parse(sub['id'].toString()); // as int; - if(x < min){ + if (x < min) { min = x; } } @@ -453,12 +483,13 @@ void login(String email, String password, BuildContext context){ mapController.fitBounds(currentBound[0]); } - void loadLocationforSubPerf(String subperf, MapController mapController) async { + void loadLocationforSubPerf( + String subperf, MapController mapController) async { String cat = currentCat.isNotEmpty == true ? currentCat[0] : ""; - if(currentCat.isNotEmpty && currentCat[0] == "-all-"){ + if (currentCat.isNotEmpty && currentCat[0] == "-all-") { cat = ""; } - LocationService.loadLocationsSubFor(subperf, cat).then((value){ + LocationService.loadLocationsSubFor(subperf, cat).then((value) { locations.clear(); locations.add(value!); }); @@ -466,219 +497,228 @@ void login(String email, String password, BuildContext context){ void loadCustomLocation(String customarea) async { String cat = currentCat.isNotEmpty == true ? currentCat[0] : ""; - if(currentCat.isNotEmpty && currentCat[0] == "-all-"){ + if (currentCat.isNotEmpty && currentCat[0] == "-all-") { cat = ""; } - print("----- ${customarea}"); - LocationService.loadCustomLocations(customarea, cat).then((value){ + print("----- $customarea"); + LocationService.loadCustomLocations(customarea, cat).then((value) { locations.clear(); locations.add(value!); List locs = getLocationsList(); LatLngBounds bounds = boundsFromLatLngList(locs); - mapController!.fitBounds(bounds); + mapController.fitBounds(bounds); setBound(bounds); - Future.delayed(Duration(microseconds: 400), () { - mapController!.fitBounds(bounds); + Future.delayed(const Duration(microseconds: 400), () { + mapController.fitBounds(bounds); }); - }); } - void loadLocationsBound(){ - if(is_custom_area_selected.value == true){ + void loadLocationsBound() { + if (is_custom_area_selected.value == true) { return; } locations.clear(); String cat = currentCat.isNotEmpty ? currentCat[0] : ""; - if(currentCat.isNotEmpty && currentCat[0] == "-all-"){ + if (currentCat.isNotEmpty && currentCat[0] == "-all-") { cat = ""; } - LatLngBounds bounds = mapController!.bounds!; + LatLngBounds bounds = mapController.bounds!; currentBound.clear(); currentBound.add(bounds); //print(currentCat); - if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ - LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){ + LocationService.loadLocationsBound( + bounds.southWest.latitude, + bounds.southWest.longitude, + bounds.northWest.latitude, + bounds.northWest.longitude, + bounds.northEast.latitude, + bounds.northEast.longitude, + bounds.southEast.latitude, + bounds.southEast.longitude, + cat) + .then((value) { //print("---value length ------ ${value!.collection.length}"); - if(value == null){ + if (value == null) { return; } - if(value != null && value.collection.isEmpty){ - if(showPopup == false) { + if (value.collection.isEmpty) { + if (showPopup == false) { return; } Get.snackbar( - "Too many Points", - "please zoom in", - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), - snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), - backgroundColor: Colors.yellow, - //icon:Image(image:AssetImage("assets/images/dora.png")) - ); + "Too many Points", + "please zoom in", + icon: const Icon(Icons.assistant_photo_outlined, + size: 40.0, color: Colors.blue), + snackPosition: SnackPosition.TOP, + duration: const Duration(milliseconds: 800), + backgroundColor: Colors.yellow, + //icon:Image(image:AssetImage("assets/images/dora.png")) + ); showPopup = false; //Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",)); } - if(value != null && value.collection.isNotEmpty){ - //print("---- added---"); - locations.add(value); - loadCatsv2(); - } - }); - } - + if (value.collection.isNotEmpty) { + //print("---- added---"); + locations.add(value); + loadCatsv2(); + } + }); } - void setBound(LatLngBounds bounds){ + void setBound(LatLngBounds bounds) { currentBound.clear(); currentBound.add(bounds); } - void zoomtoMainPerf(String id){ - - PerfectureService.getMainPerfExt(id).then((value){ + void zoomtoMainPerf(String id) { + PerfectureService.getMainPerfExt(id).then((value) { LatLng lat1 = LatLng(value![1], value[0]); LatLng lat2 = LatLng(value[3], value[2]); LatLngBounds bound = LatLngBounds(lat1, lat2); - mapController!.fitBounds(bound); + mapController.fitBounds(bound); setBound(bound); }); - } - void zoomtoSubPerf(String id){ - + void zoomtoSubPerf(String id) { print("zooooom"); - - PerfectureService.getSubExt(id).then((value){ + + PerfectureService.getSubExt(id).then((value) { LatLng lat1 = LatLng(value![1], value[0]); LatLng lat2 = LatLng(value[3], value[2]); LatLngBounds bound = LatLngBounds(lat1, lat2); - mapController!.fitBounds(bound); + mapController.fitBounds(bound); setBound(bound); }); - } - - void populateForPerf(String perf, MapController mapController){ + void populateForPerf(String perf, MapController mapController) { loadSubPerfFor(perf); loadLocationforPerf(perf, mapController); zoomtoMainPerf(perf); is_loading.value = false; } - void populateForSubPerf(String subperf, MapController mapController){ + void populateForSubPerf(String subperf, MapController mapController) { //subDropdownValue = subperf; loadLocationforSubPerf(subperf, mapController); zoomtoSubPerf(subperf); is_loading.value = false; } - void populateSubPerForArea(String area, MapController mapController){ + void populateSubPerForArea(String area, MapController mapController) { loadSubPerfFor(area); //loadCustomLocation("cus", mapController); //zoomtoSubPerf(subperf); is_loading.value = false; } - - GeoJsonFeature? getFeatureForLatLong(double lat, double long){ - if(locations.length > 0){ - for(GeoJsonFeature i in locations[0].collection){ - GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint; - if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){ - return i; - } + GeoJsonFeature? getFeatureForLatLong(double lat, double long) { + if (locations.isNotEmpty) { + for (GeoJsonFeature i in locations[0].collection) { + GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint; + if (p.geoSerie!.geoPoints[0].latitude == lat && + p.geoSerie!.geoPoints[0].longitude == long) { + return i; } } + } + return null; } - void getAction(){ + void getAction() { //print(currentUser[0]["user"]["id"]); //print(currentFeature[0].properties!["location_id"]); - if(currentUser.length == 0){ + if (currentUser.isEmpty) { return; } - int user_id = currentUser[0]["user"]["id"] as int; + int userId = currentUser[0]["user"]["id"] as int; print("---- loc id ${currentFeature[0].properties}"); - int location_id = currentFeature[0].properties!["location_id"] as int; - ActionService.userAction(user_id, location_id).then((value){ - print("------${value}"); - if(value != null && value.length > 0){ + int locationId = currentFeature[0].properties!["location_id"] as int; + ActionService.userAction(userId, locationId).then((value) { + print("------$value"); + if (value != null && value.isNotEmpty) { currentAction.clear(); currentAction.add(value); print("------${currentAction[0]}"); - }else{ - List initval = [{"user": user_id, "location": location_id, "wanttogo": false, "like": false, "checkin": false}]; + } else { + List initval = [ + { + "user": userId, + "location": locationId, + "wanttogo": false, + "like": false, + "checkin": false + } + ]; currentAction.clear(); currentAction.add(initval); } }); } - void makeNext(GeoJsonFeature fs){ + void makeNext(GeoJsonFeature fs) { + if (rog_mode == 1) { + DestinationController destinationController = + Get.find(); + } else { + GeoJsonFeature pt = + fs as GeoJsonFeature; - if(rog_mode == 1){ - DestinationController destinationController = Get.find(); - } - else { - GeoJsonFeature pt = fs as GeoJsonFeature; + for (int i = 0; i <= locations[0].collection.length - 1; i++) { + GeoJsonMultiPoint p = + locations[0].collection[i].geometry as GeoJsonMultiPoint; - for(int i=0; i<= locations[0].collection.length - 1; i++){ - GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint; - - if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){ - - if(currentFeature.length > 0){ + if (p.geoSerie!.geoPoints[0].latitude == + pt.geometry!.geoSerie!.geoPoints[0].latitude && + p.geoSerie!.geoPoints[0].longitude == + pt.geometry!.geoSerie!.geoPoints[0].longitude) { + if (currentFeature.isNotEmpty) { currentFeature.clear(); } - if(i >= locations[0].collection.length - 1 ){ - currentFeature.add(locations[0].collection[0] as GeoJsonFeature); + if (i >= locations[0].collection.length - 1) { + currentFeature.add(locations[0].collection[0]); + getAction(); + } else { + currentFeature.add(locations[0].collection[i + 1]); getAction(); } - else{ - currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature); - getAction(); - } - } - } - } - - - - } - - void makePrevious(GeoJsonFeature fs){ - - if(rog_mode == 1){ - DestinationController destinationController = Get.find(); - } - else { - - GeoJsonFeature pt = fs as GeoJsonFeature; - - for(int i=0; i<= locations[0].collection.length - 1; i++){ - GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint; - - if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){ - - if(currentFeature.length > 0){ - currentFeature.clear(); - } - if(i == 0 ){ - currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature); - getAction(); - } - else{ - currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature); - getAction(); - } } } } } + void makePrevious(GeoJsonFeature fs) { + if (rog_mode == 1) { + DestinationController destinationController = + Get.find(); + } else { + GeoJsonFeature pt = + fs as GeoJsonFeature; + for (int i = 0; i <= locations[0].collection.length - 1; i++) { + GeoJsonMultiPoint p = + locations[0].collection[i].geometry as GeoJsonMultiPoint; -} \ No newline at end of file + if (p.geoSerie!.geoPoints[0].latitude == + pt.geometry!.geoSerie!.geoPoints[0].latitude && + p.geoSerie!.geoPoints[0].longitude == + pt.geometry!.geoSerie!.geoPoints[0].longitude) { + if (currentFeature.isNotEmpty) { + currentFeature.clear(); + } + if (i == 0) { + currentFeature.add( + locations[0].collection[locations[0].collection.length - 1]); + getAction(); + } else { + currentFeature.add(locations[0].collection[i - 1]); + getAction(); + } + } + } + } + } +} diff --git a/lib/pages/index/index_page.dart b/lib/pages/index/index_page.dart index ad49ddc..4cfef8a 100644 --- a/lib/pages/index/index_page.dart +++ b/lib/pages/index/index_page.dart @@ -1,26 +1,18 @@ -import 'dart:ui'; - import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/drawer/drawer_page.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; -import 'package:rogapp/services/maxtrix_service.dart'; -import 'package:rogapp/utils/database_helper.dart'; -import 'package:rogapp/widgets/bread_crum_widget.dart'; -import 'package:rogapp/widgets/cat_widget.dart'; import 'package:rogapp/widgets/list_widget.dart'; import 'package:rogapp/widgets/map_widget.dart'; -import 'package:flutter_polyline_points/flutter_polyline_points.dart'; - class IndexPage extends GetView { IndexPage({Key? key}) : super(key: key); final IndexController indexController = Get.find(); - final DestinationController destinationController = Get.find(); + final DestinationController destinationController = + Get.find(); @override Widget build(BuildContext context) { @@ -30,33 +22,37 @@ class IndexPage extends GetView { return false; }, child: Scaffold( - //drawer: const DrawerPage(), - appBar: AppBar( - leading: IconButton( - icon: Icon(Icons.arrow_back_ios), - onPressed: (){ - indexController.switchPage(AppPages.TRAVEL); + drawer: DrawerPage(), + appBar: AppBar( + // leading: IconButton( + // icon: const Icon(Icons.arrow_back_ios), + // onPressed: (){ + // indexController.switchPage(AppPages.TRAVEL); + // }, + // ), + //automaticallyImplyLeading: false, + title: Text("add_location".tr), + actions: [ + InkWell( + onTap: () { + Get.toNamed(AppPages.SEARCH); }, - ), - //automaticallyImplyLeading: false, - title: Text("add_location".tr), - actions: [ - InkWell( - onTap: (){ - Get.toNamed(AppPages.SEARCH); - }, - child: Container( - height: 32, - width: 75, - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(25), - - ), - child: const Center(child: Icon(Icons.search),), - ), + child: Container( + height: 32, + width: 75, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(25), ), - //CatWidget(indexController: indexController,), + child: const Center( + child: Icon(Icons.search), + ), + ), + ), + IconButton(onPressed: () { + Get.toNamed(AppPages.HISTORY); + }, icon: const Icon(Icons.history)) + + //CatWidget(indexController: indexController,), ], ), bottomNavigationBar: BottomAppBar( @@ -64,51 +60,59 @@ class IndexPage extends GetView { mainAxisAlignment: MainAxisAlignment.end, children: [ 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: - Obx(() => - destinationController.is_gps_selected == true ? - Padding( - padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), - child: InkWell( - child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,), - onTap: (){ - indexController.switchPage(AppPages.TRAVEL); - }, - ), - ) : - Padding( - padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), - child: InkWell( - child: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,), - onTap: (){ - indexController.switchPage(AppPages.TRAVEL); - }, - ), - ) - ) - ), + child: + Obx(() => destinationController.is_gps_selected == true + ? Padding( + padding: const EdgeInsets.only( + right: 10.0, top: 4.0, bottom: 4.0), + child: InkWell( + child: const Image( + image: AssetImage( + 'assets/images/route3_off.png'), + width: 35, + height: 35, + ), + onTap: () { + 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( - onPressed: (){ + onPressed: () { indexController.toggleMode(); - if(indexController.currentCat.isNotEmpty){ - print(indexController.currentCat[0].toString()); - } - + if (indexController.currentCat.isNotEmpty) { + print(indexController.currentCat[0].toString()); + } }, tooltip: 'Increment', - child: Obx(() => - indexController.mode == 0 ? - Image(image: AssetImage('assets/images/list2.png')) - : - Image(image: AssetImage('assets/images/map.png')), - ), elevation: 4.0, + child: Obx( + () => indexController.mode == 0 + ? const Image(image: AssetImage('assets/images/list2.png')) + : const Image(image: AssetImage('assets/images/map.png')), + ), ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, body: SafeArea( @@ -132,11 +136,11 @@ class IndexPage extends GetView { // // ), // child: SingleChildScrollView( // scrollDirection: Axis.horizontal, - // child: Obx(() => + // child: Obx(() => // Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [ - // indexController.is_mapController_loaded.value == false ? + // indexController.is_mapController_loaded.value == false ? // Center(child: CircularProgressIndicator()) // : // BreadCrumbWidget(mapController: indexController.mapController), @@ -149,7 +153,7 @@ class IndexPage extends GetView { // // onPressed: (){ // // indexController.currentCat.clear(); // // indexController.loadLocationsBound(); - // // }, + // // }, // // icon: Icon(Icons.cancel, color: Colors.red,) // // ) : // // Container(width: 0, height: 0,) @@ -161,18 +165,13 @@ class IndexPage extends GetView { // ), // ), Expanded( - child: Obx(() => - indexController.mode == 0 ? - MapWidget() : - ListWidget(), - ) - - ) + child: Obx( + () => indexController.mode == 0 ? MapWidget() : ListWidget(), + )) ], ), ), ), ); } - -} \ No newline at end of file +} diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 8cd20df..67127f8 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -17,18 +17,18 @@ class _LandingPageState extends State { child: Container( width: double.infinity, height: MediaQuery.of(context).size.height, - padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30), + padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Text( + const Text( "こんにちは!", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40), ), - SizedBox(height: 30,), + const SizedBox(height: 30,), Text("ログインを有効にして本人確認を行うと、サーバーが改善されます", textAlign: TextAlign.center, style: TextStyle( @@ -38,11 +38,11 @@ class _LandingPageState extends State { ), Container( height: MediaQuery.of(context).size.height/3, - decoration: BoxDecoration( + decoration: const BoxDecoration( image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg')) ), ), - SizedBox(height: 20.0,), + const SizedBox(height: 20.0,), MaterialButton( minWidth: double.infinity, height:60, @@ -51,18 +51,18 @@ class _LandingPageState extends State { }, color: Colors.indigoAccent[400], shape: RoundedRectangleBorder( - side: BorderSide( + side: const BorderSide( color: Colors.black, ), borderRadius: BorderRadius.circular(40) ), - child: Text("ログイン",style: TextStyle( + child: const Text("ログイン",style: TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), ), - SizedBox(height: 15.0,), + const SizedBox(height: 15.0,), MaterialButton( minWidth: double.infinity, @@ -74,7 +74,7 @@ class _LandingPageState extends State { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("サインアップ",style: TextStyle( + child: const Text("サインアップ",style: TextStyle( fontWeight: FontWeight.w600,fontSize: 16, ),), diff --git a/lib/pages/loading/loading_page.dart b/lib/pages/loading/loading_page.dart index dd6f82c..5444425 100644 --- a/lib/pages/loading/loading_page.dart +++ b/lib/pages/loading/loading_page.dart @@ -7,8 +7,8 @@ class LoadingPage extends StatelessWidget { Widget build(BuildContext context) { return Container( alignment: Alignment.topCenter, - margin: EdgeInsets.only(top: 20), - child: CircularProgressIndicator( + margin: const EdgeInsets.only(top: 20), + child: const CircularProgressIndicator( value: 0.8, ) ); diff --git a/lib/pages/login/login_page.dart b/lib/pages/login/login_page.dart index f0d6ff6..31b1d57 100644 --- a/lib/pages/login/login_page.dart +++ b/lib/pages/login/login_page.dart @@ -11,6 +11,8 @@ class LoginPage extends StatelessWidget { TextEditingController emailController = TextEditingController(); TextEditingController passwordController = TextEditingController(); + LoginPage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Scaffold( @@ -22,11 +24,11 @@ class LoginPage extends StatelessWidget { leading: IconButton( onPressed: (){ Navigator.pop(context); - },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), + },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), ), body: - indexController.currentUser.length == 0 ? - Container( + indexController.currentUser.isEmpty ? + SizedBox( width: double.infinity, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -37,16 +39,16 @@ class LoginPage extends StatelessWidget { children: [ Container( height: MediaQuery.of(context).size.height/6, - decoration: BoxDecoration( + decoration: const BoxDecoration( image:DecorationImage(image: AssetImage('assets/images/login_image.jpg')) ), ), - SizedBox(height: 5,), + const SizedBox(height: 5,), ], ), Padding( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 40 ), child: Column( @@ -57,9 +59,9 @@ class LoginPage extends StatelessWidget { ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 40), + padding: const EdgeInsets.symmetric(horizontal: 40), child: Container( - padding: EdgeInsets.only(top: 3,left: 3), + padding: const EdgeInsets.only(top: 3,left: 3), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), ), @@ -74,7 +76,7 @@ class LoginPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: CircularProgressIndicator(), + child: const CircularProgressIndicator(), ) : Column( children: [ @@ -86,9 +88,9 @@ class LoginPage extends StatelessWidget { Get.snackbar( "no_values".tr, "email_and_password_required".tr, - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), + duration: const Duration(milliseconds: 800), backgroundColor: Colors.yellow, //icon:Image(image:AssetImage("assets/images/dora.png")) ); @@ -101,12 +103,12 @@ class LoginPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("ログイン",style: TextStyle( + child: const Text("ログイン",style: TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), ), - SizedBox(height: 5.0,), + const SizedBox(height: 5.0,), MaterialButton( minWidth: double.infinity, height:40, @@ -117,12 +119,12 @@ class LoginPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("sign_up".tr,style: TextStyle( + child: Text("sign_up".tr,style: const TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), ), - SizedBox(height: 2.0,), + const SizedBox(height: 2.0,), MaterialButton( minWidth: double.infinity, height:40, @@ -133,7 +135,7 @@ class LoginPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("cancel".tr,style: TextStyle( + child: Text("cancel".tr,style: const TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), @@ -144,14 +146,14 @@ class LoginPage extends StatelessWidget { ), ) ), - SizedBox(height: 5,), + const SizedBox(height: 5,), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Flexible( child: Padding( padding: const EdgeInsets.all(8.0), - child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle( + child: Text("rogaining_user_need_tosign_up".tr, style: const TextStyle( overflow: TextOverflow.ellipsis, ),), ), @@ -164,7 +166,7 @@ class LoginPage extends StatelessWidget { Flexible( child: Padding( padding: const EdgeInsets.all(8.0), - child: Text("app_developed_by_gifu_dx".tr, style: TextStyle( + child: Text("app_developed_by_gifu_dx".tr, style: const TextStyle( overflow: TextOverflow.ellipsis, fontSize: 10.0 ),), ), @@ -182,7 +184,7 @@ class LoginPage extends StatelessWidget { onPressed: (){ indexController.currentUser.clear(); }, - child: Text("Already Logged in, Click to logout"), + child: const Text("Already Logged in, Click to logout"), ), ) , @@ -194,17 +196,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText = return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(label,style:TextStyle( + Text(label,style:const TextStyle( fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87 ),), - SizedBox(height: 5,), + const SizedBox(height: 5,), TextField( controller: controller, obscureText: obsureText, decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), + contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: (Colors.grey[400])!, @@ -216,7 +218,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText = ), ), ), - SizedBox(height: 30.0,) + const SizedBox(height: 30.0,) ], ); } diff --git a/lib/pages/login_popup/login_popup_page.dart b/lib/pages/login_popup/login_popup_page.dart index 4e0796b..98a5277 100644 --- a/lib/pages/login_popup/login_popup_page.dart +++ b/lib/pages/login_popup/login_popup_page.dart @@ -22,11 +22,11 @@ class LoginPopupPage extends StatelessWidget { leading: IconButton( onPressed: (){ Navigator.pop(context); - },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), + },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), ), body: - indexController.currentUser.length == 0 ? - Container( + indexController.currentUser.isEmpty ? + SizedBox( width: double.infinity, child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -37,16 +37,16 @@ class LoginPopupPage extends StatelessWidget { children: [ Container( height: MediaQuery.of(context).size.height/5, - decoration: BoxDecoration( + decoration: const BoxDecoration( image:DecorationImage(image: AssetImage('assets/images/login_image.jpg')) ), ), - SizedBox(height: 5,), + const SizedBox(height: 5,), ], ), Padding( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 40 ), child: Column( @@ -57,9 +57,9 @@ class LoginPopupPage extends StatelessWidget { ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 40), + padding: const EdgeInsets.symmetric(horizontal: 40), child: Container( - padding: EdgeInsets.only(top: 3,left: 3), + padding: const EdgeInsets.only(top: 3,left: 3), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), ), @@ -74,7 +74,7 @@ class LoginPopupPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: CircularProgressIndicator(), + child: const CircularProgressIndicator(), ) : Column( children: [ @@ -86,9 +86,9 @@ class LoginPopupPage extends StatelessWidget { Get.snackbar( "no_values".tr, "email_and_password_required".tr, - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), + duration: const Duration(milliseconds: 800), backgroundColor: Colors.yellow, //icon:Image(image:AssetImage("assets/images/dora.png")) ); @@ -101,12 +101,12 @@ class LoginPopupPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("ログイン",style: TextStyle( + child: const Text("ログイン",style: TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), ), - SizedBox(height: 19.0,), + const SizedBox(height: 19.0,), MaterialButton( minWidth: double.infinity, height:50, @@ -117,12 +117,12 @@ class LoginPopupPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("sign_up".tr,style: TextStyle( + child: Text("sign_up".tr,style: const TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), ), - SizedBox(height: 19.0,), + const SizedBox(height: 19.0,), MaterialButton( minWidth: double.infinity, height:50, @@ -133,7 +133,7 @@ class LoginPopupPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("cancel".tr,style: TextStyle( + child: Text("cancel".tr,style: const TextStyle( fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 ), ), @@ -144,14 +144,14 @@ class LoginPopupPage extends StatelessWidget { ), ) ), - SizedBox(height: 20,), + const SizedBox(height: 20,), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Flexible( child: Padding( padding: const EdgeInsets.all(8.0), - child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle( + child: Text("rogaining_user_need_tosign_up".tr, style: const TextStyle( overflow: TextOverflow.ellipsis, ),), ), @@ -169,7 +169,7 @@ class LoginPopupPage extends StatelessWidget { onPressed: (){ indexController.currentUser.clear(); }, - child: Text("Already Logged in, Click to logout"), + child: const Text("Already Logged in, Click to logout"), ), ) , @@ -181,17 +181,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText = return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(label,style:TextStyle( + Text(label,style:const TextStyle( fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87 ),), - SizedBox(height: 5,), + const SizedBox(height: 5,), TextField( controller: controller, obscureText: obsureText, decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), + contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: (Colors.grey[400])!, @@ -203,7 +203,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText = ), ), ), - SizedBox(height: 30.0,) + const SizedBox(height: 30.0,) ], ); } diff --git a/lib/pages/mainperf/mainperf_page.dart b/lib/pages/mainperf/mainperf_page.dart index 47f1664..2684d80 100644 --- a/lib/pages/mainperf/mainperf_page.dart +++ b/lib/pages/mainperf/mainperf_page.dart @@ -11,7 +11,7 @@ class MainPerfPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Select Main Perfecture"), + title: const Text("Select Main Perfecture"), ), body: ListView.builder( itemCount: indexController.perfectures.length, @@ -19,7 +19,7 @@ class MainPerfPage extends StatelessWidget { return ListTile( onTap: (){ indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString(); - indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!); + indexController.populateForPerf(indexController.dropdownValue, indexController.mapController); Get.back(); }, title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()), diff --git a/lib/pages/permission/permission.dart b/lib/pages/permission/permission.dart index 307e1ac..b244ecf 100644 --- a/lib/pages/permission/permission.dart +++ b/lib/pages/permission/permission.dart @@ -4,7 +4,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:rogapp/routes/app_pages.dart'; class PermissionHandlerScreen extends StatefulWidget { - PermissionHandlerScreen({Key? key}) : super(key: key); + const PermissionHandlerScreen({Key? key}) : super(key: key); @override State createState() => _PermissionHandlerScreenState(); @@ -20,9 +20,9 @@ class _PermissionHandlerScreenState extends State { builder: (BuildContext context) { return AlertDialog( title: const Text('ロケーション許可'), - content: SingleChildScrollView( + content: const SingleChildScrollView( child: ListBody( - children: const [ + children: [ Text( 'このアプリでは、位置情報の収集を行います。'), Text( 'このアプリでは、開始時点で位置情報を収集します。'), ], @@ -57,22 +57,20 @@ class _PermissionHandlerScreenState extends State { permissionServiceCall() async { await permissionServices().then( (value) { - if (value != null) { - if (value[Permission.location]!.isGranted ) { - /* ========= New Screen Added ============= */ + if (value[Permission.location]!.isGranted ) { + /* ========= New Screen Added ============= */ - Get.toNamed(AppPages.TRAVEL); + Get.toNamed(AppPages.TRAVEL); - // Navigator.pushReplacement( - // context, - // MaterialPageRoute(builder: (context) => SplashScreen()), - // ); - } - else{ - _showMyDialog(); - } + // Navigator.pushReplacement( + // context, + // MaterialPageRoute(builder: (context) => SplashScreen()), + // ); } - }, + else{ + _showMyDialog(); + } + }, ); } @@ -122,7 +120,7 @@ class _PermissionHandlerScreenState extends State { }); return Scaffold( body: Container( - child: Text(""), + child: const Text(""), ), ); } @@ -132,9 +130,9 @@ class _PermissionHandlerScreenState extends State { context: context, builder: (_) => AlertDialog( title: const Text('ロケーション許可'), - content: SingleChildScrollView( + content: const SingleChildScrollView( child: ListBody( - children: const [ + children: [ Text( 'このアプリでは、位置情報の収集を行います。'), Text('岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'), ], diff --git a/lib/pages/progress/progress.dart b/lib/pages/progress/progress.dart index fb4549d..1a85543 100644 --- a/lib/pages/progress/progress.dart +++ b/lib/pages/progress/progress.dart @@ -1,7 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/src/foundation/key.dart'; -import 'package:flutter/src/widgets/container.dart'; -import 'package:flutter/src/widgets/framework.dart'; class ProgressPage extends StatelessWidget { const ProgressPage({Key? key}) : super(key: key); @@ -10,7 +7,7 @@ class ProgressPage extends StatelessWidget { Widget build(BuildContext context) { return Container( color: Colors.transparent, - child: Center( + child: const Center( child: CircularProgressIndicator(), ), ); diff --git a/lib/pages/register/register_page.dart b/lib/pages/register/register_page.dart index d02e2be..1a1c7a7 100644 --- a/lib/pages/register/register_page.dart +++ b/lib/pages/register/register_page.dart @@ -13,6 +13,8 @@ class RegisterPage extends StatelessWidget { TextEditingController passwordController = TextEditingController(); TextEditingController confirmPasswordController = TextEditingController(); + RegisterPage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Scaffold( @@ -24,11 +26,11 @@ class RegisterPage extends StatelessWidget { leading: IconButton( onPressed: (){ Navigator.pop(context); - },icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), + },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), ), body: SafeArea( child: SingleChildScrollView( - child: Container( + child: SizedBox( height: MediaQuery.of(context).size.height, width: double.infinity, child: Column( @@ -39,20 +41,20 @@ class RegisterPage extends StatelessWidget { Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Text ("サインアップ", style: TextStyle( + const Text ("サインアップ", style: TextStyle( fontSize: 30, fontWeight: FontWeight.bold, ),), - SizedBox(height: 20,), + const SizedBox(height: 20,), Text("アカウントを作成し、無料です",style: TextStyle( fontSize: 15, color: Colors.grey[700], ),), - SizedBox(height: 30,) + const SizedBox(height: 30,) ], ), Padding( - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( horizontal: 40 ), child: Column( @@ -64,12 +66,12 @@ class RegisterPage extends StatelessWidget { ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 40), + padding: const EdgeInsets.symmetric(horizontal: 40), child: Container( - padding: EdgeInsets.only(top: 3,left: 3), + padding: const EdgeInsets.only(top: 3,left: 3), decoration: BoxDecoration( borderRadius: BorderRadius.circular(40), - border: Border( + border: const Border( bottom: BorderSide(color: Colors.black), top: BorderSide(color: Colors.black), right: BorderSide(color: Colors.black), @@ -84,9 +86,9 @@ class RegisterPage extends StatelessWidget { Get.snackbar( "No match", "Passwords does not match", - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), + duration: const Duration(milliseconds: 800), backgroundColor: Colors.yellow, //icon:Image(image:AssetImage("assets/images/dora.png")) ); @@ -95,9 +97,9 @@ class RegisterPage extends StatelessWidget { Get.snackbar( "no_values".tr, "email_and_password_required".tr, - icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), + icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), snackPosition: SnackPosition.TOP, - duration: Duration(milliseconds: 800), + duration: const Duration(milliseconds: 800), backgroundColor: Colors.yellow, //icon:Image(image:AssetImage("assets/images/dora.png")) ); @@ -110,23 +112,23 @@ class RegisterPage extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(40) ), - child: Text("sign_up".tr,style: TextStyle( + child: Text("sign_up".tr,style: const TextStyle( fontWeight: FontWeight.w600,fontSize: 16, ),), ), ), ), - SizedBox(height: 20,), + const SizedBox(height: 20,), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Flexible(child: Text("すでにアカウントをお持ちですか?")), + const Flexible(child: Text("すでにアカウントをお持ちですか?")), TextButton( onPressed: (){ Get.toNamed(AppPages.LOGIN); }, - child: Text("ログイン",style: TextStyle( + child: const Text("ログイン",style: TextStyle( fontWeight: FontWeight.w600, fontSize: 18 ),), @@ -149,17 +151,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText = return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(label,style:TextStyle( + Text(label,style:const TextStyle( fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87 ),), - SizedBox(height: 5,), + const SizedBox(height: 5,), TextField( controller: controller, obscureText: obsureText, decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), + contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: (Colors.grey[400])!, @@ -171,7 +173,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText = ), ), ), - SizedBox(height: 30,) + const SizedBox(height: 30,) ], ); diff --git a/lib/pages/search/search_controller.dart b/lib/pages/search/search_controller.dart index b6f188a..6102f6e 100644 --- a/lib/pages/search/search_controller.dart +++ b/lib/pages/search/search_controller.dart @@ -1,8 +1,5 @@ -import 'package:flutter/material.dart'; import 'package:geojson/geojson.dart'; import 'package:get/get.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; -import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/index/index_controller.dart'; class SearchBarController extends GetxController { diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart index d404527..b89b8fb 100644 --- a/lib/pages/search/search_page.dart +++ b/lib/pages/search/search_page.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:geojson/geojson.dart'; @@ -15,7 +14,7 @@ class SearchPage extends StatelessWidget { Image getImage(int index){ if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); + return const Image(image: AssetImage('assets/images/empty_image.png')); } else{ return Image( @@ -39,7 +38,7 @@ class SearchPage extends StatelessWidget { }, icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)), title: TypeAheadField( - textFieldConfiguration: TextFieldConfiguration( + textFieldConfiguration: const TextFieldConfiguration( autofocus: true, ), suggestionsCallback: (pattern) async{ @@ -49,7 +48,7 @@ class SearchPage extends StatelessWidget { itemBuilder: (context, GeoJsonFeature suggestion){ return ListTile( title: Text(suggestion.properties!["location_name"]), - subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""), + subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : const Text(""), //leading: getImage(index), ); }, diff --git a/lib/pages/subperf/subperf_page.dart b/lib/pages/subperf/subperf_page.dart index 31bf5e9..a1fe067 100644 --- a/lib/pages/subperf/subperf_page.dart +++ b/lib/pages/subperf/subperf_page.dart @@ -11,7 +11,7 @@ class SubPerfPage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Select Sub Perfecture"), + title: const Text("Select Sub Perfecture"), ), body: ListView.builder( itemCount: indexController.subPerfs.length, diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index 2f48fdc..562ef86 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -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/destination/destination_binding.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_page.dart'; @@ -48,6 +49,7 @@ class AppPages { static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD; static const CAMERA_PAGE = Routes.CAMERA_PAGE; static const PROGRESS = Routes.PROGRESS; + static const HISTORY = Routes.HISTORY; static final routes = [ // GetPage( @@ -72,7 +74,7 @@ class AppPages { ), GetPage( name: Routes.LANDING, - page: () => LandingPage(), + page: () => const LandingPage(), //binding: SpaBinding(), ), GetPage( @@ -92,7 +94,7 @@ class AppPages { ), GetPage( name: Routes.LOADING, - page: () => LoadingPage(), + page: () => const LoadingPage(), //binding: DestinationBinding(), ), GetPage( @@ -102,12 +104,12 @@ class AppPages { ), GetPage( name: Routes.HOME, - page: () => HomePage(), + page: () => const HomePage(), binding: HomeBinding(), ), GetPage( name: Routes.PERMISSION, - page: () => PermissionHandlerScreen(), + page: () => const PermissionHandlerScreen(), ), GetPage( name: Routes.SEARCH, @@ -124,11 +126,11 @@ class AppPages { ), GetPage( name: Routes.CITY, - page: () => CityPage(), + page: () => const CityPage(), ), GetPage( name: Routes.CATEOGORY, - page: () => CategoryPage(), + page: () => const CategoryPage(), ), GetPage( name: Routes.CHANGE_PASSWORD, @@ -140,7 +142,11 @@ class AppPages { ), GetPage( name: Routes.PROGRESS, - page: () => ProgressPage(), + page: () => const ProgressPage(), + ), + GetPage( + name: Routes.HISTORY, + page: () => const HistoryPage(), ) ]; } \ No newline at end of file diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index b48d014..753b9fc 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -24,4 +24,5 @@ abstract class Routes { static const CHANGE_PASSWORD = '/change_password'; static const CAMERA_PAGE = '/camera_page'; static const PROGRESS = '/progress'; + static const HISTORY = '/history'; } diff --git a/lib/services/action_service.dart b/lib/services/action_service.dart index 9fb1d2c..a67a9ea 100644 --- a/lib/services/action_service.dart +++ b/lib/services/action_service.dart @@ -5,14 +5,14 @@ import 'package:rogapp/utils/const.dart'; class ActionService{ - static Future> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async { - print("----- action is ---- ${like}-- ${wanttogo}-- ${checkin}"); + static Future> makeAction(int userId, int locationId, bool wanttogo, bool like, bool checkin) async { + print("----- action is ---- $like-- $wanttogo-- $checkin"); Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}"; + String serverUrl = ConstValues.currentServer(); + String url = "$serverUrl/api/makeaction/?user_id=$userId&location_id=$locationId&wanttogo=$wanttogo&like=$like&checkin=$checkin"; //String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}"; - print('++++++++${url}'); - print("url is ------ ${url}"); + print('++++++++$url'); + print("url is ------ $url"); final http.Response response = await http.get( Uri.parse(url), headers: { @@ -27,11 +27,11 @@ class ActionService{ } - static Future?> userAction(int user_id, int location_id) async { + static Future?> userAction(int userId, int locationId) async { List cats = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/useraction/?user_id=$userId&location_id=$locationId'; + print('++++++++$url'); //String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}'; final response = await http.get(Uri.parse(url), headers: { diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index 3e31372..341a06f 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -8,14 +8,14 @@ class AuthService{ static Future> changePassword(String oldpassword, String newpassword, String token) async { Map changePassword = {}; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/change-password/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/change-password/'; + print('++++++++$url'); final http.Response response = await http.put( Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' + 'Authorization': 'Token $token' }, body: jsonEncode({ 'old_password': oldpassword, @@ -31,11 +31,11 @@ class AuthService{ static Future> login(String email, String password) async { - print("------- in logged email ${email} pwd ${password} ###### --------"); + print("------- in logged email $email pwd $password ###### --------"); Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/login/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/login/'; + print('++++++++$url'); //String url = 'http://localhost:8100/api/login/'; final http.Response response = await http.post( Uri.parse(url), @@ -57,9 +57,9 @@ class AuthService{ static Future> register(String email, String password) async { Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/register/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/register/'; + print('++++++++$url'); final http.Response response = await http.post( Uri.parse(url), headers: { @@ -79,14 +79,14 @@ class AuthService{ static Future> deleteUser(String token) async { Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/delete-account/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/delete-account/'; + print('++++++++$url'); final http.Response response = await http.get( Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' + 'Authorization': 'Token $token' } ); @@ -99,10 +99,10 @@ class AuthService{ static Future?> UserDetails(int userid) async { List cats = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/userdetials?user_id=${userid}'; - print('++++++++${url}'); - print("---- UserDetails url is ${url}"); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/userdetials?user_id=$userid'; + print('++++++++$url'); + print("---- UserDetails url is $url"); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -117,6 +117,28 @@ class AuthService{ } + static Future?> userForToken(String token) async { + Map 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: { + '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}]; + } + + diff --git a/lib/services/cat_service.dart b/lib/services/cat_service.dart index 50e54f3..5ed4c94 100644 --- a/lib/services/cat_service.dart +++ b/lib/services/cat_service.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import '../utils/const.dart'; @@ -9,9 +8,9 @@ class CatService{ static Future?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async { List cats = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/cats/?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -28,9 +27,9 @@ class CatService{ static Future?> loadCatByCity(String cityname)async { List cats = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/catbycity/?${cityname}'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/catbycity/?$cityname'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', diff --git a/lib/services/destination_service.dart b/lib/services/destination_service.dart index e45f966..23bf4a3 100644 --- a/lib/services/destination_service.dart +++ b/lib/services/destination_service.dart @@ -11,11 +11,11 @@ import '../utils/const.dart'; class DestinationService{ - static Future> getDestinations(int user_id) async { + static Future> getDestinations(int userId) async { List cats = []; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/destinations/?user_id=${user_id}"; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = "$serverUrl/api/destinations/?user_id=$userId"; + print('++++++++$url'); final http.Response response = await http.get( Uri.parse(url), headers: { @@ -29,11 +29,11 @@ class DestinationService{ return cats; } - static Future> deleteDestination(int dest_id) async { + static Future> deleteDestination(int destId) async { Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}"; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = "$serverUrl/api/delete_destination/?dest_id=$destId"; + print('++++++++$url'); final http.Response response = await http.get( Uri.parse(url), headers: { @@ -44,15 +44,15 @@ class DestinationService{ if (response.statusCode == 200) { cats = json.decode(utf8.decode(response.bodyBytes)); } - print("####### ---- ${cats}"); + print("####### ---- $cats"); return cats; } - static Future updateOrder(int action_id, int order, String dir) async { + static Future updateOrder(int actionId, int order, String dir) async { int cats = 0; - String server_url = ConstValues.currentServer(); - String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = "$serverUrl/api/updateorder/?user_action_id=$actionId&order=$order&dir=$dir"; + print('++++++++$url'); final http.Response response = await http.get( Uri.parse(url), headers: { @@ -69,7 +69,7 @@ class DestinationService{ static Future>? getDestinationLine(List destinations, Map mtx) async{ PolylinePoints polylinePoints = PolylinePoints(); - if(destinations.length <= 0){ + if(destinations.isEmpty){ return []; } @@ -90,7 +90,7 @@ class DestinationService{ int j = 0; - PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: false); + PolylineWayPoint pwp = PolylineWayPoint(location: "$la,$ln", stopOver: false); //print("----- UUUUUU ${pwp}"); @@ -101,15 +101,15 @@ class DestinationService{ } final DestinationController destinationController = Get.find(); - int trav_mode = destinationController.travelMode.value; - String _mode = "WALKING"; - if(trav_mode == 1){ + int travMode = destinationController.travelMode.value; + String mode = "WALKING"; + if(travMode == 1){ //_mode = TravelMode.driving; - _mode = "DRIVING"; + mode = "DRIVING"; } - else if(trav_mode == 2) { + else if(travMode == 2) { //_mode = TravelMode.transit; - _mode = "TRANSIT"; + mode = "TRANSIT"; } diff --git a/lib/services/external_service.dart b/lib/services/external_service.dart index cabda6b..836fb71 100644 --- a/lib/services/external_service.dart +++ b/lib/services/external_service.dart @@ -2,12 +2,10 @@ import 'dart:io'; import 'package:get/get.dart'; import 'package:http/http.dart' as http; import 'package:intl/intl.dart'; -import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/rog.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/utils/database_helper.dart'; -import 'package:sqflite/sqlite_api.dart'; import 'dart:convert'; import '../utils/const.dart'; @@ -33,100 +31,100 @@ class ExternalService { final IndexController indexController = Get.find(); - Map _res = {}; + Map res = {}; - int user_id = indexController.currentUser[0]["user"]["id"]; + int userId = indexController.currentUser[0]["user"]["id"]; //print("--- Pressed -----"); - String _team = indexController.currentUser[0]["user"]['team_name']; + String team = indexController.currentUser[0]["user"]['team_name']; //print("--- _team : ${_team}-----"); - String _event_code = indexController.currentUser[0]["user"]["event_code"]; + String eventCode = indexController.currentUser[0]["user"]["event_code"]; if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){ DatabaseHelper db = DatabaseHelper.instance; - Rog _rog = Rog( + Rog rog = Rog( id:1, - team_name: _team, - event_code : _event_code, - user_id: user_id, + team_name: team, + event_code : eventCode, + user_id: userId, cp_number: -1, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, image: null, rog_action_type: 0 ); - db.insertRogaining(_rog); + db.insertRogaining(rog); } else { String url = 'https://natnats.mobilous.com/start_from_rogapp'; - print('++++++++${url}'); + print('++++++++$url'); final http.Response response = await http.post( Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode({ - 'team_name': _team, - 'event_code': _event_code + 'team_name': team, + 'event_code': eventCode }), ); print("---- start rogianing api status ---- ${response.statusCode}"); if (response.statusCode == 200) { - _res = json.decode(utf8.decode(response.bodyBytes)); - print('----_res : ${_res} ----'); + res = json.decode(utf8.decode(response.bodyBytes)); + print('----_res : $res ----'); } } - return _res; + return res; } - Future> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async { - Map _res = {}; + Future> makeCheckpoint(int userId, String token, String checkinTime, String teamname, int cp, String eventcode, String imageurl) async { + Map res = {}; String url = 'https://natnats.mobilous.com/checkin_from_rogapp'; - print('++++++++${url}'); + print('++++++++$url'); final IndexController indexController = Get.find(); if(imageurl != null){ if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){ DatabaseHelper db = DatabaseHelper.instance; - Rog _rog = Rog( + Rog rog = Rog( id:1, team_name: teamname, event_code : eventcode, - user_id: user_id, + user_id: userId, cp_number: cp, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, image: imageurl, rog_action_type: 1, ); - db.insertRogaining(_rog); + db.insertRogaining(rog); } else { - String server_url = ConstValues.currentServer(); - String url1 = "${server_url}/api/checkinimage/"; - final im1Bytes = File(imageurl!).readAsBytesSync(); + String serverUrl = ConstValues.currentServer(); + String url1 = "$serverUrl/api/checkinimage/"; + final im1Bytes = File(imageurl).readAsBytesSync(); String im1_64 = base64Encode(im1Bytes); final http.Response response = await http.post( Uri.parse(url1), headers: { 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' + 'Authorization': 'Token $token' }, // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' body: jsonEncode({ - 'user' : user_id.toString(), + 'user' : userId.toString(), 'team_name': teamname, 'event_code': eventcode, 'checkinimage' : im1_64, - 'checkintime' : checkin_time, + 'checkintime' : checkinTime, 'cp_number' : cp.toString() }), ); - _res = json.decode(utf8.decode(response.bodyBytes)); + res = json.decode(utf8.decode(response.bodyBytes)); - print("-----@@@@@ ${_res} -----"); + print("-----@@@@@ $res -----"); if(response.statusCode == 201){ //print('---- toekn is ${token} -----'); @@ -139,13 +137,13 @@ class ExternalService { 'team_name': teamname, 'cp_number': cp.toString(), 'event_code': eventcode, - 'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') + 'image': res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') }), ); print("--- checnin response ${response2.statusCode}----"); if (response2.statusCode == 200) { - _res = json.decode(utf8.decode(response2.bodyBytes)); - print('----checkin res _res : ${_res} ----'); + res = json.decode(utf8.decode(response2.bodyBytes)); + print('----checkin res _res : $res ----'); } } } @@ -153,17 +151,17 @@ class ExternalService { else{ if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){ DatabaseHelper db = DatabaseHelper.instance; - Rog _rog = Rog( + Rog rog = Rog( id:1, team_name: teamname, event_code : eventcode, - user_id: user_id, + user_id: userId, cp_number: cp, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, image: null, rog_action_type: 1, ); - db.insertRogaining(_rog); + db.insertRogaining(rog); } else { final http.Response response3 = await http.post( @@ -180,64 +178,64 @@ class ExternalService { ); print("--- checnin response ${response3.statusCode}----"); if (response3.statusCode == 200) { - _res = json.decode(utf8.decode(response3.bodyBytes)); - print('----checkin res _res : ${_res} ----'); + res = json.decode(utf8.decode(response3.bodyBytes)); + print('----checkin res _res : $res ----'); } } } - return _res; + return res; } - Future> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async { - Map _res2 = {}; + Future> makeGoal(int userId, String token, String teamname, String image, String goalTime, String eventcode) async { + Map res2 = {}; final IndexController indexController = Get.find(); final DestinationController destinationController = Get.find(); //if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){ DatabaseHelper db = DatabaseHelper.instance; - Rog _rog = Rog( + Rog rog = Rog( id:1, team_name: teamname, event_code : eventcode, - user_id: user_id, + user_id: userId, cp_number: -1, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, image: image, rog_action_type: 1, ); - db.insertRogaining(_rog); + db.insertRogaining(rog); // } // else{ - String server_url = ConstValues.currentServer(); - String url1 = "${server_url}/api/goalimage/"; - final im1Bytes = File(image!).readAsBytesSync(); + String serverUrl = ConstValues.currentServer(); + String url1 = "$serverUrl/api/goalimage/"; + final im1Bytes = File(image).readAsBytesSync(); String im1_64 = base64Encode(im1Bytes); final http.Response response = await http.post( Uri.parse(url1), headers: { 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' + 'Authorization': 'Token $token' }, // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' body: jsonEncode({ - 'user' : user_id.toString(), + 'user' : userId.toString(), 'team_name': teamname, 'event_code': eventcode, - 'goaltime' : goal_time, + 'goaltime' : goalTime, 'goalimage' : im1_64, 'cp_number' : "-1" }), ); String url = 'https://natnats.mobilous.com/goal_from_rogapp'; - print('++++++++${url}'); + print('++++++++$url'); if (response.statusCode == 201) { - Map _res = json.decode(utf8.decode(response.bodyBytes)); - print('----_res : ${_res} ----'); - print('---- image url ${_res["goalimage"]} ----'); + Map res = json.decode(utf8.decode(response.bodyBytes)); + print('----_res : $res ----'); + print('---- image url ${res["goalimage"]} ----'); final http.Response response2 = await http.post( Uri.parse(url), headers: { @@ -246,26 +244,26 @@ class ExternalService { body: jsonEncode({ 'team_name': teamname, 'event_code': eventcode, - 'goal_time' : goal_time, - 'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') + 'goal_time' : goalTime, + 'image' : res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') } ), ); - print('----- response2 is ${response2} --------'); + print('----- response2 is $response2 --------'); if (response2.statusCode == 200) { - _res2 = json.decode(utf8.decode(response2.bodyBytes)); + res2 = json.decode(utf8.decode(response2.bodyBytes)); } } //} destinationController.resetRogaining(); - return _res2; + return res2; } static Future> usersEventCode(String teamcode, String password) async { - Map _res = {}; - String url = "https://natnats.mobilous.com/check_event_code?zekken_number=${teamcode}&password=${password}"; - print('++++++++${url}'); + Map res = {}; + String url = "https://natnats.mobilous.com/check_event_code?zekken_number=$teamcode&password=$password"; + print('++++++++$url'); final http.Response response = await http.get( Uri.parse(url), headers: { @@ -274,9 +272,9 @@ class ExternalService { ); if (response.statusCode == 200) { - _res = json.decode(utf8.decode(response.bodyBytes)); + res = json.decode(utf8.decode(response.bodyBytes)); } - return _res; + return res; } } \ No newline at end of file diff --git a/lib/services/location_line_service.dart b/lib/services/location_line_service.dart index bc98e3a..a587f42 100644 --- a/lib/services/location_line_service.dart +++ b/lib/services/location_line_service.dart @@ -8,9 +8,9 @@ class LocationLineService{ static Future loadLocationLines() async { final geo = GeoJson(); GeoJsonFeature? fs; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/location_line/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/location_line/'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', diff --git a/lib/services/location_polygon_service.dart b/lib/services/location_polygon_service.dart index 3a583f5..7e91145 100644 --- a/lib/services/location_polygon_service.dart +++ b/lib/services/location_polygon_service.dart @@ -9,9 +9,9 @@ class LocationPolygonervice{ final geo = GeoJson(); GeoJsonFeature? fs; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/location_polygon/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/location_polygon/'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', diff --git a/lib/services/location_service.dart b/lib/services/location_service.dart index 40b9d8a..4a62cec 100644 --- a/lib/services/location_service.dart +++ b/lib/services/location_service.dart @@ -37,31 +37,31 @@ class LocationService{ static Future loadLocationsFor(String perfecture, String cat) async { final IndexController indexController = Get.find(); String url = ""; - String server_url = ConstValues.currentServer(); + String serverUrl = ConstValues.currentServer(); if(cat.isNotEmpty){ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture + '&cat=' + cat; + url = '$serverUrl/api/inperf/?rog=$r&perf=$perfecture&cat=$cat'; } else { - url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat; + url = '$serverUrl/api/inperf/?perf=$perfecture&cat=$cat'; } } else{ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture; + url = '$serverUrl/api/inperf/?rog=$r&perf=$perfecture'; } else { - url = '${server_url}/api/inperf/?perf=' + perfecture; + url = '$serverUrl/api/inperf/?perf=$perfecture'; } } - print('++++++++${url}'); + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -78,13 +78,13 @@ class LocationService{ static Future?> getLocationsExt(String token) async { List ext = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/locsext/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/locsext/'; + print('++++++++$url'); final response = await http.post(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', - 'Authorization': 'Token ${token}' + 'Authorization': 'Token $token' }, body: jsonEncode({ 'token': token, @@ -102,30 +102,30 @@ class LocationService{ static Future loadLocationsSubFor(String subperfecture, String cat) async { final IndexController indexController = Get.find(); String url = ""; - String server_url = ConstValues.currentServer(); + String serverUrl = ConstValues.currentServer(); if(cat.isNotEmpty){ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture + '&cat=' + cat; + url = '$serverUrl/api/insubperf?rog=$r&subperf=$subperfecture&cat=$cat'; } else{ - url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat; + url = '$serverUrl/api/insubperf?subperf=$subperfecture&cat=$cat'; } } else{ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture; + url = '$serverUrl/api/insubperf?rog=$r&subperf=$subperfecture'; } else{ - url = '${server_url}/api/insubperf?subperf=' + subperfecture; + url = '$serverUrl/api/insubperf?subperf=$subperfecture'; } } - print('++++++++${url}'); + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -142,34 +142,35 @@ class LocationService{ static Future loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async { - print("-------- in location for bound -------------"); final IndexController indexController = Get.find(); + print("-------- in location for bound -------------"); + print("-------- in location for bound current user ${indexController.currentUser} -------------"); String url = ""; - String server_url = ConstValues.currentServer(); + String serverUrl = ConstValues.currentServer(); if(cat.isNotEmpty){ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat; + url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4&cat=$cat'; } else{ - url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat; + url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4&cat=$cat'; } } else{ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - print("-------- requested user group ${grp} -------------"); - url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}'; + print("-------- requested user group $grp -------------"); + url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4'; } else{ - url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}'; + url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4'; } } - print('++++++++${url}'); + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -200,31 +201,31 @@ class LocationService{ if(cat == "-all-"){ cat = ""; } - String server_url = ConstValues.currentServer(); - print("loadCustomLocations url is ----- ${cat}"); + String serverUrl = ConstValues.currentServer(); + print("loadCustomLocations url is ----- $cat"); if(cat.isNotEmpty){ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/custom_area/?rog=${r}&&cat=' + cat; + url = '$serverUrl/api/custom_area/?rog=$r&&cat=$cat'; } else{ - url = '${server_url}/api/custom_area/?&cat=' + cat; + url = '$serverUrl/api/custom_area/?&cat=$cat'; } } else{ if(indexController.currentUser.isNotEmpty){ - bool _rog = indexController.currentUser[0]['user']['is_rogaining']; - String r = _rog == true ? 'True': 'False'; + bool rog = indexController.currentUser[0]['user']['is_rogaining']; + String r = rog == true ? 'True': 'False'; var grp = indexController.currentUser[0]['user']['event_code']; - url = '${server_url}/api/customarea?rog=${r}&name=${name}'; + url = '$serverUrl/api/customarea?rog=$r&name=$name'; } else{ - url = '${server_url}/api/customarea?name=${name}'; + url = '$serverUrl/api/customarea?name=$name'; } } - print('++++++++${url}'); + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', diff --git a/lib/services/maxtrix_service.dart b/lib/services/maxtrix_service.dart index 8d6accd..bd9b39e 100644 --- a/lib/services/maxtrix_service.dart +++ b/lib/services/maxtrix_service.dart @@ -18,7 +18,7 @@ class MatrixService{ int i = 0; for(Destination d in destinations){ - print("---- getting matrix for ${d} ------------"); + print("---- getting matrix for $d ------------"); if(i==0){ origin = "${d.lat}, ${d.lon}"; @@ -37,24 +37,24 @@ class MatrixService{ i++; } - locs = "optimize:false|${locs}"; + locs = "optimize:false|$locs"; - String _mode = "walking"; + String mode = "walking"; switch (destinationController.travelMode.value) { case 1: - _mode = "driving"; + mode = "driving"; break; case 2: - _mode = "transit"; + mode = "transit"; break; default: - _mode = "walking"; + mode = "walking"; break; } Map cats = {}; - String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"; - print('++++++++${url}'); + String url = "https://maps.googleapis.com/maps/api/directions/json?destination=$destination&mode=$mode&waypoints=$locs&origin=$origin&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"; + print('++++++++$url'); final http.Response response = await http.get( Uri.parse(url), headers: { diff --git a/lib/services/perfecture_service.dart b/lib/services/perfecture_service.dart index 5fa099f..987144b 100644 --- a/lib/services/perfecture_service.dart +++ b/lib/services/perfecture_service.dart @@ -7,9 +7,9 @@ class PerfectureService{ static Future?> loadPerfectures() async { List perfs = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/perf_main/'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/perf_main/'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -25,9 +25,9 @@ class PerfectureService{ static Future?> loadSubPerfectures(String area) async { List perfs = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/subperfinmain/?area=' + area; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/subperfinmain/?area=$area'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -44,9 +44,9 @@ class PerfectureService{ static Future?> getMainPerfExt(String id) async { List perfs = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/mainperfext/?perf=' + id; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/mainperfext/?perf=$id'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -62,9 +62,9 @@ class PerfectureService{ static Future?> loadGifuAreas(String perf) async { List perfs = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/allgifuareas/?perf=' + perf; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/allgifuareas/?perf=$perf'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -80,9 +80,9 @@ class PerfectureService{ static Future?> loadCustomAreas() async { List perfs = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/customareanames'; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/customareanames'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', @@ -99,9 +99,9 @@ class PerfectureService{ static Future?> getSubExt(String id) async { List perfs = []; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/perfext/?sub_perf=' + id; - print('++++++++${url}'); + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/perfext/?sub_perf=$id'; + print('++++++++$url'); final response = await http.get(Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', diff --git a/lib/services/reacking_service.dart b/lib/services/reacking_service.dart index 15236ac..fd6c882 100644 --- a/lib/services/reacking_service.dart +++ b/lib/services/reacking_service.dart @@ -1,26 +1,25 @@ import 'dart:convert'; -import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'package:rogapp/utils/const.dart'; class TrackingService { - static Future> addTrack(String user_id, double lat, double lon) async { + static Future> addTrack(String userId, double lat, double lon) async { Map cats = {}; - String server_url = ConstValues.currentServer(); - String url = '${server_url}/api/track/'; - print('++++++++${url}'); - final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}'; + String serverUrl = ConstValues.currentServer(); + String url = '$serverUrl/api/track/'; + print('++++++++$url'); + final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}'; final http.Response response = await http.post( Uri.parse(url), headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: jsonEncode({ - 'user_id': user_id, + 'user_id': userId, 'geom': geom }), ); diff --git a/lib/utils/database_helper.dart b/lib/utils/database_helper.dart index 13cd840..68a4446 100644 --- a/lib/utils/database_helper.dart +++ b/lib/utils/database_helper.dart @@ -1,6 +1,5 @@ import 'dart:io'; import 'package:path_provider/path_provider.dart'; -import 'package:rogapp/model/Rogaining.dart'; import 'package:rogapp/model/destination.dart'; import 'package:sqflite/sqflite.dart'; import 'package:path/path.dart'; @@ -86,14 +85,14 @@ class DatabaseHelper{ var rog = await db.query('rog'); List roglist = rog.isNotEmpty ? rog.map((e) => Rog.fromMap(e)).toList() : []; - print("--------- ${rog}"); + print("--------- $rog"); return roglist; } Future> getRogainingByLatLon(double lat, double lon) async { Database db = await instance.database; - var rog = await db.query('rog', where: "lat = ${lat} and lon= ${lon}"); + var rog = await db.query('rog', where: "lat = $lat and lon= $lon"); List roglist = rog.isNotEmpty ? rog.map((e) => Rog.fromMap(e)).toList() : []; return roglist; @@ -101,12 +100,12 @@ class DatabaseHelper{ Future clearSelection() async { Database db = await instance.database; - Map row_clear = { + Map rowClear = { "selected": false }; return await db.update( "destination", - row_clear + rowClear ); } @@ -114,7 +113,7 @@ class DatabaseHelper{ Database db = await instance.database; bool val = !dest.selected!; - Map row_target = { + Map rowTarget = { "selected": val }; @@ -122,7 +121,7 @@ class DatabaseHelper{ return await db.update( "destination", - row_target, + rowTarget, where: 'location_id = ?', whereArgs: [dest.location_id!] ); @@ -130,7 +129,7 @@ class DatabaseHelper{ Future deleteRogaining(int id) async { Database db = await instance.database; - var rog = await db.delete('rog', where: "id = ${id}"); + var rog = await db.delete('rog', where: "id = $id"); int ret = rog > 0 ? rog : -1; return ret; @@ -145,8 +144,8 @@ class DatabaseHelper{ FutureisRogAlreadyAvailable(int id) async{ Database db = await instance.database; - var rog = await db.query('rog', where: "id = ${id}"); - return rog.length > 0 ? true : false; + var rog = await db.query('rog', where: "id = $id"); + return rog.isNotEmpty ? true : false; } FuturelatestGoal() async{ @@ -157,16 +156,16 @@ class DatabaseHelper{ Future insertRogaining(Rog rog) async { Database db = await instance.database; - int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog')); - next_order = next_order==null ? 0 : next_order; - next_order = next_order + 1; - rog.id = next_order; + int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog')); + nextOrder = nextOrder ?? 0; + nextOrder = nextOrder + 1; + rog.id = nextOrder; int res = await db.insert( 'rog', rog.toMap(), conflictAlgorithm: ConflictAlgorithm.replace, ); - print("------ database helper insert ${res}-----------::::::::"); + print("------ database helper insert $res-----------::::::::"); return res; } @@ -176,13 +175,13 @@ class DatabaseHelper{ var dest = await db.query('destination', orderBy: 'list_order'); List destList = dest.isNotEmpty ? dest.map((e) => Destination.fromMap(e)).toList() : []; - print("--------- ${destList}"); + print("--------- $destList"); return destList; } Future> getDestinationById(int id) async { Database db = await instance.database; - var rog = await db.query('destination', where: "location_id = ${id}"); + var rog = await db.query('destination', where: "location_id = $id"); List deslist = rog.isNotEmpty ? rog.map((e) => Destination.fromMap(e)).toList() : []; return deslist; @@ -191,15 +190,15 @@ class DatabaseHelper{ Future> getDestinationByLatLon(double lat, double lon) async { Database db = await instance.database; - var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}", orderBy: 'list_order'); + var dest = await db.query('destination', where: "lat = $lat and lon= $lon", orderBy: 'list_order'); List destList = dest.isNotEmpty ? dest.map((e) => Destination.fromMap(e)).toList() : []; return destList; } - Future deleteDestination(int location_id) async { + Future deleteDestination(int locationId) async { Database db = await instance.database; - var dest = await db.delete('destination', where: "location_id = ${location_id}"); + var dest = await db.delete('destination', where: "location_id = $locationId"); int ret = dest > 0 ? dest : -1; //after deleting set correct order @@ -212,19 +211,19 @@ class DatabaseHelper{ Database db = await instance.database; var byOrder = await db.query('destination', orderBy: 'list_order'); - List des_db = byOrder.isNotEmpty + List desDb = byOrder.isNotEmpty ? byOrder.map((e) => Destination.fromMap(e)).toList() : []; int order = 1; - for( Destination d in des_db){ + for( Destination d in desDb){ - Map row_target = { + Map rowTarget = { "list_order": order }; await db.update( "destination", - row_target, + rowTarget, where: 'location_id = ?', whereArgs: [d.location_id] ); @@ -238,18 +237,18 @@ class DatabaseHelper{ await db.delete('destination'); } - FutureisAlreadyAvailable(int location_id) async{ + FutureisAlreadyAvailable(int locationId) async{ Database db = await instance.database; - var dest = await db.query('destination', where: "location_id = ${location_id}"); - return dest.length > 0 ? true : false; + var dest = await db.query('destination', where: "location_id = $locationId"); + return dest.isNotEmpty ? true : false; } Future insertDestination(Destination dest) async { Database db = await instance.database; - int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination')); - next_order = next_order==null ? 0 : next_order; - next_order = next_order + 1; - dest.list_order = next_order; + int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination')); + nextOrder = nextOrder ?? 0; + nextOrder = nextOrder + 1; + dest.list_order = nextOrder; int res = await db.insert( 'destination', dest.toMap(), @@ -278,23 +277,23 @@ class DatabaseHelper{ var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}"); var dest = await db.query('destination', where: "location_id = ${d.location_id}"); - print("--- target in db is ${target}"); - print("--- destine in db is ${dest}"); + print("--- target in db is $target"); + print("--- destine in db is $dest"); if(target.isNotEmpty){ - List target_indb = target.isNotEmpty + List targetIndb = target.isNotEmpty ? target.map((e) => Destination.fromMap(e)).toList() : []; - List dest_indb = dest.isNotEmpty + List destIndb = dest.isNotEmpty ? dest.map((e) => Destination.fromMap(e)).toList() : []; - Map row_target = { + Map rowTarget = { "list_order": d.list_order }; - Map row_des = { - "list_order": dest_indb[0].list_order! + dir + Map rowDes = { + "list_order": destIndb[0].list_order! + dir }; // print("--- target destination is ${target_indb[0].location_id}"); @@ -302,16 +301,16 @@ class DatabaseHelper{ await db.update( "destination", - row_target, + rowTarget, where: 'location_id = ?', - whereArgs: [target_indb[0]!.location_id] + whereArgs: [targetIndb[0].location_id] ); await db.update( "destination", - row_des, + rowDes, where: 'location_id = ?', - whereArgs: [dest_indb[0]!.location_id] + whereArgs: [destIndb[0].location_id] ); } } diff --git a/lib/utils/text_util.dart b/lib/utils/text_util.dart index 725ec4e..2417aa2 100644 --- a/lib/utils/text_util.dart +++ b/lib/utils/text_util.dart @@ -12,7 +12,7 @@ class TextUtils{ // txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}"; // } //if(f.properties!["buy_point"] != null && f.properties!["buy_point"] > 0){ - txt = txt + "${f.properties!["sub_loc_id"]}"; + txt = "$txt${f.properties!["sub_loc_id"]}"; //} return txt; } @@ -22,9 +22,9 @@ class TextUtils{ RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); String txt = ""; if(dp.cp! > 0){ - txt = "${dp.cp.toString().replaceAll(regex, '')}"; + txt = dp.cp.toString().replaceAll(regex, ''); if(dp.checkin_point != null && dp.checkin_point! > 0){ - txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}"; + txt = "$txt{${dp.checkin_point.toString().replaceAll(regex, '')}}"; } if(dp.buy_point != null && dp.buy_point! > 0){ print("^^^^^^^^^ ${dp.sub_loc_id}^^^^^^^^^^"); diff --git a/lib/widgets/base_layer_widget.dart b/lib/widgets/base_layer_widget.dart index d29252f..ec43b65 100644 --- a/lib/widgets/base_layer_widget.dart +++ b/lib/widgets/base_layer_widget.dart @@ -13,7 +13,7 @@ class BaseLayer extends StatelessWidget { FMTCTileProviderSettings( behavior: CacheBehavior.values .byName('cacheFirst'), - cachedValidDuration: Duration( + cachedValidDuration: const Duration( days: 14 ), ), diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index 9e098d4..8334742 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -1,15 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_map/plugin_api.dart'; import 'package:geojson/geojson.dart'; import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:image_picker/image_picker.dart'; import 'package:latlong2/latlong.dart'; -import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; import 'package:rogapp/model/destination.dart'; -import 'package:rogapp/pages/camera/camera_page.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; @@ -21,765 +16,989 @@ import 'package:rogapp/widgets/bottom_sheet_controller.dart'; import 'package:url_launcher/url_launcher.dart'; class BottomSheetNew extends GetView { - BottomSheetNew({ Key? key }) : super(key: key); + BottomSheetNew({Key? key}) : super(key: key); final IndexController indexController = Get.find(); - final DestinationController destinationController = Get.find(); + final DestinationController destinationController = + Get.find(); - Image getImage(){ - - String server_url = ConstValues.currentServer(); - if(indexController.rog_mode == 1){ + Image getImage() { + String serverUrl = ConstValues.currentServer(); + if (indexController.rog_mode == 1) { //print("----- rogaining mode 1"); - if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); - } - else{ - //print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@"); - String _photo = indexController.currentDestinationFeature[0].photos!; - if(_photo.contains('http')){ - return Image(image: NetworkImage( - indexController.currentDestinationFeature[0].photos!, + if (indexController.currentDestinationFeature.isEmpty || + indexController.currentDestinationFeature[0].photos! == "") { + return const Image(image: AssetImage('assets/images/empty_image.png')); + } else { + //print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@"); + String photo = indexController.currentDestinationFeature[0].photos!; + if (photo.contains('http')) { + return Image( + image: NetworkImage( + indexController.currentDestinationFeature[0].photos!, ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { + errorBuilder: (BuildContext context, Object exception, + StackTrace? stackTrace) { return Image.asset("assets/images/empty_image.png"); }, ); - } - else { - return Image(image: NetworkImage( - '${server_url}/media/compressed/' + indexController.currentDestinationFeature[0].photos!, + } else { + return Image( + image: NetworkImage( + '$serverUrl/media/compressed/${indexController.currentDestinationFeature[0].photos!}', ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { + errorBuilder: (BuildContext context, Object exception, + StackTrace? stackTrace) { return Image.asset("assets/images/empty_image.png"); }, ); } } - } - else{ + } else { GeoJsonFeature gf = indexController.currentFeature[0]; - if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); + if (gf.properties!["photos"] == null || gf.properties!["photos"] == "") { + return const Image(image: AssetImage('assets/images/empty_image.png')); + } else { + String photo = gf.properties!["photos"]; + if (photo.contains('http')) { + return Image( + image: NetworkImage( + gf.properties!["photos"], + ), + errorBuilder: (BuildContext context, Object exception, + StackTrace? stackTrace) { + return Image.asset("assets/images/empty_image.png"); + }, + ); + } else { + return Image( + image: NetworkImage( + '$serverUrl/media/compressed/' + gf.properties!["photos"], + ), + errorBuilder: (BuildContext context, Object exception, + StackTrace? stackTrace) { + return Image.asset("assets/images/empty_image.png"); + }, + ); + } } - else{ - String _photo = gf!.properties!["photos"]; - if(_photo.contains('http')){ - return Image(image: NetworkImage( - gf.properties!["photos"], - ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } - else { - return Image(image: NetworkImage( - '${server_url}/media/compressed/' + gf.properties!["photos"], - ), - errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { - return Image.asset("assets/images/empty_image.png"); - }, - ); - } } - } - - } void _launchURL(url) async { if (!await launch(url)) throw 'Could not launch $url'; } - bool isInDestination(String locationid){ + bool isInDestination(String locationid) { int lid = int.parse(locationid); - if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){ + if (destinationController.destinations + .where((element) => element.location_id == lid) + .isNotEmpty) { return true; - } - else{ + } else { return false; } } - @override Widget build(BuildContext context) { destinationController.skip_gps = true; print('---- rog_mode ----- ${indexController.rog_mode} -----'); - return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context); + return indexController.rog_mode == 0 + ? detailsSheet(context) + : destinationSheet(context); } // Show destination detais SingleChildScrollView destinationSheet(BuildContext context) { - - print('---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----'); + print( + '---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----'); return SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Row( - children: [ - MaterialButton( - onPressed: () { - Get.back(); - //destinationController.makePrevious(indexController.currentDestinationFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_back_ios, - size: 14, - ), - padding: EdgeInsets.all(16), - shape: CircleBorder(), - ), - Expanded( - child: Container( - alignment: Alignment.center, - child: Obx(() => - indexController.currentUser.length > 0 ? - Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - : - Text("${indexController.currentDestinationFeature[0].name!}", style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Row( + children: [ + MaterialButton( + onPressed: () { + Get.back(); + //destinationController.makePrevious(indexController.currentDestinationFeature[0]); + }, + color: Colors.blue, + textColor: Colors.white, + padding: const EdgeInsets.all(16), + shape: const CircleBorder(), + child: const Icon( + Icons.arrow_back_ios, + size: 14, ), - ) - ), + ), + Expanded( + child: Container( + alignment: Alignment.center, + child: Obx(() => indexController.currentUser.isNotEmpty + ? Text( + "${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", + style: const TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ) + : Text( + indexController + .currentDestinationFeature[0].name!, + style: const TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + )), + ), + ), + ], ), ), - ], - ), - ), - ), - Row( - children: [ - Expanded( - child: SizedBox( - height: 260.0, - child: Obx(() => getImage()), + ), + Row( + children: [ + Expanded( + child: SizedBox( + height: 260.0, + child: Obx(() => getImage()), + )), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Obx( + () => indexController.currentDestinationFeature.isNotEmpty && + destinationController.is_in_checkin.value == true && + destinationController.is_at_start.value == false + ? Row( + children: [ + ElevatedButton( + onPressed: () { + if (indexController.currentDestinationFeature[0] + .checkedin == + null || + indexController.currentDestinationFeature[0] + .checkedin == + false) { + if (indexController + .currentDestinationFeature[0] + .hidden_location == + 0) { + destinationController.skip_gps = false; + destinationController.is_photo_shoot.value = + true; + Get.back(); + } else { + destinationController.makeCheckin( + indexController + .currentDestinationFeature[0], + true, + ""); + if (indexController + .currentDestinationFeature[0].cp != + -1) { + destinationController + .rogaining_counted.value = true; + } + } + } else { + destinationController.makeCheckin( + indexController + .currentDestinationFeature[0], + false, + ""); + } + //Get.back(); + }, + child: Text( + //Checkin + indexController.currentDestinationFeature[0] + .checkedin == + null || + indexController + .currentDestinationFeature[0] + .checkedin == + false + ? "チェックイン" + : "チェックアウト")), + ], + ) + : Container(), + ), + Obx( + () => destinationController.is_at_start.value == true + ? ElevatedButton( + onPressed: () { + destinationController.is_in_rog.value = true; + destinationController.addToRogaining( + destinationController.current_lat, + destinationController.current_lon, + indexController + .currentDestinationFeature[0].location_id!); + ExternalService() + .StartRogaining() + .then((value) => Get.back()); + }, + child: Text( + // start + indexController.currentDestinationFeature[0] + .checkedin != + null || + indexController.currentDestinationFeature[0] + .checkedin == + true + ? "ロゲイニングを開始" + : "間違った目的地...")) + : Container(), + ), + Obx( + () => destinationController.is_at_goal.value == true && + destinationController.rogaining_counted == true + ? ElevatedButton( + onPressed: () { + Get.toNamed(AppPages.CAMERA_PAGE); + Get.back(); + }, + child: Text( + //goal + indexController.currentDestinationFeature[0] + .checkedin != + null || + indexController.currentDestinationFeature[0] + .checkedin == + true + ? "ロゲイニングを終える" + : "間違った目的地 ...")) + : Container(), + ), + ], + ), + Obx( + () => indexController.currentDestinationFeature[0].address != + null && + indexController + .currentDestinationFeature[0].address!.isNotEmpty + ? getDetails(context, "address".tr, + indexController.currentDestinationFeature[0].address! ?? '') + : const SizedBox( + width: 0.0, + height: 0, + ), + ), + Obx( + () => indexController.currentDestinationFeature[0].phone != null && + indexController + .currentDestinationFeature[0].phone!.isNotEmpty + ? getDetails(context, "telephone".tr, + indexController.currentDestinationFeature[0].phone! ?? '') + : const SizedBox( + width: 0.0, + height: 0, + ), + ), + Obx( + () => indexController.currentDestinationFeature[0].email != null && + indexController + .currentDestinationFeature[0].email!.isNotEmpty + ? getDetails(context, "email".tr, + indexController.currentDestinationFeature[0].email! ?? '') + : const SizedBox( + width: 0.0, + height: 0, + ), + ), + Obx( + () => indexController.currentDestinationFeature[0].webcontents != + null && + indexController + .currentDestinationFeature[0].webcontents!.isNotEmpty + ? getDetails( + context, + "web".tr, + indexController.currentDestinationFeature[0].webcontents! ?? + '', + isurl: true) + : const SizedBox( + width: 0.0, + height: 0, + ), + ), + Obx( + () => indexController.currentDestinationFeature[0].videos != null && + indexController + .currentDestinationFeature[0].videos!.isNotEmpty + ? getDetails(context, "video".tr, + indexController.currentDestinationFeature[0].videos! ?? '', + isurl: true) + : const SizedBox( + width: 0.0, + height: 0, + ), + ), + const SizedBox( + height: 20.0, + ), + // Obx(() => + // //wantToGo(context), + + // FutureBuilder( + // future: wantToGo(context), + // builder: (context, snapshot) { + // return Container( + // child: snapshot.data, + // ); + // }, + // ), + + // ), + const SizedBox( + height: 60.0, ) - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Obx(() => - indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true && destinationController.is_at_start.value == false ? - Row( - children: [ - ElevatedButton( - onPressed: (){ - if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){ - if(indexController.currentDestinationFeature[0].hidden_location == 0){ - destinationController.skip_gps = false; - destinationController.is_photo_shoot.value = true; - Get.back(); - - } - else{ - destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, ""); - if(indexController.currentDestinationFeature[0].cp != -1){ - destinationController.rogaining_counted.value =true; - } - } - - } - else{ - destinationController.makeCheckin(indexController.currentDestinationFeature[0], false, ""); - } - //Get.back(); - }, - child: Text( - //Checkin - indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ? - "チェックイン" - : - "チェックアウト" - ) - ), - ], - ) - : - Container(), - ), - Obx(() => - destinationController.is_at_start.value == true ? - ElevatedButton( - onPressed: (){ - destinationController.is_in_rog.value = true; - destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!); - ExternalService().StartRogaining().then((value) => Get.back()); - }, - child: Text( - // start - indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? - "ロゲイニングを開始" - : - "間違った目的地..." - ) - ) - : - Container(), - - ), - Obx(() => - destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ? - ElevatedButton( - onPressed: (){ - Get.toNamed(AppPages.CAMERA_PAGE); - Get.back(); - }, - child: Text( - //goal - indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? - "ロゲイニングを終える" - : - "間違った目的地 ..." - ) - ) - : - Container(), - - ), - ], - ), - Obx(() => - indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ? - getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '') - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].phone != null && indexController.currentDestinationFeature[0].phone!.isNotEmpty ? - getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '') - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].email != null && indexController.currentDestinationFeature[0].email!.isNotEmpty ? - getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '') - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].webcontents != null && indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ? - getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true) - : - Container(width: 0.0, height: 0,), - ), - Obx(() => - indexController.currentDestinationFeature[0].videos != null && indexController.currentDestinationFeature[0].videos!.isNotEmpty ? - getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true) - : - Container(width: 0.0, height: 0,), - ), - SizedBox(height: 20.0,), - // Obx(() => - // //wantToGo(context), - - // FutureBuilder( - // future: wantToGo(context), - // builder: (context, snapshot) { - // return Container( - // child: snapshot.data, - // ); - // }, - // ), - - // ), - SizedBox(height: 60.0,) - ], - ), - ); + ], + ), + ); } - - // show add location details + // show add location details SingleChildScrollView detailsSheet(BuildContext context) { return SingleChildScrollView( - child: Column( - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Row( - children: [ - MaterialButton( - onPressed: () { - Get.back(); - //indexController.makePrevious(indexController.currentFeature[0]); - }, - color: Colors.blue, - textColor: Colors.white, - child: Icon( - Icons.arrow_back_ios, - //Icons.arrow_back_ios, - size: 14, - ), - padding: EdgeInsets.all(16), - shape: CircleBorder(), - ), - Expanded( - child: Container( - alignment: Alignment.center, - child: Obx(() => - Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.bold, - ), - ) - ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Row( + children: [ + MaterialButton( + onPressed: () { + Get.back(); + //indexController.makePrevious(indexController.currentFeature[0]); + }, + color: Colors.blue, + textColor: Colors.white, + padding: const EdgeInsets.all(16), + shape: const CircleBorder(), + child: const Icon( + Icons.arrow_back_ios, + //Icons.arrow_back_ios, + size: 14, + ), + ), + Expanded( + child: Container( + alignment: Alignment.center, + child: Obx(() => Text( + indexController + .currentFeature[0].properties!["location_name"], + style: const TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + )), + ), + ), + ], ), ), - ], - ), - ), - ), - Row( - children: [ - Expanded( - child: SizedBox( - height: 260.0, - child: Obx(() => getImage()), + ), + Row( + children: [ + Expanded( + child: SizedBox( + height: 260.0, + child: Obx(() => getImage()), + )), + ], + ), + Obx(() => Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Obx( + () => indexController + .currentDestinationFeature.isNotEmpty && + indexController + .currentDestinationFeature[0].cp == + -1 && + indexController.currentDestinationFeature[0] + .checkedin == + false && + destinationController.is_at_start.value == + true + ? ElevatedButton( + onPressed: () { + destinationController.is_in_rog.value = + true; + destinationController.addToRogaining( + destinationController.current_lat, + destinationController.current_lon, + indexController + .currentDestinationFeature[0] + .location_id!); + ExternalService() + .StartRogaining() + .then((value) => Get.back()); + }, + child: Text( + // start + indexController + .currentDestinationFeature[ + 0] + .checkedin != + null || + indexController + .currentDestinationFeature[ + 0] + .checkedin == + true + ? "ロゲイニングを開始" + : "間違った目的地...")) + : Container(), + ), + Obx( + () => destinationController.is_at_goal.value == + true && + destinationController.rogaining_counted == + true + ? ElevatedButton( + onPressed: () { + Get.toNamed(AppPages.CAMERA_PAGE); + Get.back(); + }, + child: Text( + //goal + indexController + .currentDestinationFeature[ + 0] + .checkedin != + null || + indexController + .currentDestinationFeature[ + 0] + .checkedin == + true + ? "ロゲイニングを終える" + : "間違った目的地 ...")) + : Container(), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ElevatedButton( + onPressed: () async { + GeoJsonFeature mp = + indexController.currentFeature[0] + as GeoJsonFeature; + Position position = + await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.high); + Destination ds = Destination( + lat: position.latitude, + lon: position.longitude); + + Destination tp = Destination( + lat: mp.geometry!.geoSerie!.geoPoints[0] + .latitude, + lon: mp.geometry!.geoSerie!.geoPoints[0] + .longitude); + + Get.back(); + + destinationController + .destinationMatrixFromCurrentPoint([ds, tp]); + }, + style: ElevatedButton.styleFrom( + backgroundColor: Theme.of(context) + .colorScheme + .onPrimaryContainer), + child: Text( + "ここへ行く", + style: TextStyle( + color: + Theme.of(context).colorScheme.onPrimary), + )), + SizedBox( + width: 10, + ), + ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: + Theme.of(context).colorScheme.secondary), + onPressed: () async { + destinationController.CallforCheckin( + destinationController.festuretoDestination( + indexController.currentFeature[0])); + }, + child: Text("チェックイン", + style: TextStyle( + color: Theme.of(context) + .colorScheme + .onSecondary))), + ], + ), + Row( + children: [ + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + indexController.currentDestinationFeature + .isNotEmpty && + destinationController + .is_in_checkin.value == + true + ? Container() + : FutureBuilder( + future: wantToGo(context), + builder: (context, snapshot) { + return Container( + child: snapshot.data, + ); + }, + ), + indexController.currentFeature[0] + .properties!["location_name"] != + null && + (indexController.currentFeature[0] + .properties!["location_name"] + as String) + .isNotEmpty + ? Flexible( + child: Text(indexController + .currentFeature[0] + .properties!["location_name"])) + : const SizedBox( + width: 0.0, + height: 0, + ), + ], + ), + ), + ], + ), + const SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + const Icon(Icons.roundabout_left), + const SizedBox( + width: 8.0, + ), + indexController.currentFeature[0] + .properties!["address"] != + null && + (indexController.currentFeature[0] + .properties!["address"] as String) + .isNotEmpty + ? getDetails( + context, + "address".tr, + indexController.currentFeature[0] + .properties!["address"] ?? + '') + : const SizedBox( + width: 0.0, + height: 0, + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + const Icon(Icons.phone), + const SizedBox( + width: 8.0, + ), + indexController.currentFeature[0] + .properties!["phone"] != + null && + (indexController.currentFeature[0] + .properties!["phone"] as String) + .isNotEmpty + ? getDetails( + context, + "telephone".tr, + indexController.currentFeature[0] + .properties!["phone"] ?? + '') + : const SizedBox( + width: 0.0, + height: 0, + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + const Icon(Icons.email), + const SizedBox( + width: 8.0, + ), + indexController.currentFeature[0] + .properties!["email"] != + null && + (indexController.currentFeature[0] + .properties!["email"] as String) + .isNotEmpty + ? getDetails( + context, + "email".tr, + indexController.currentFeature[0] + .properties!["email"] ?? + '') + : const SizedBox( + width: 0.0, + height: 0, + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + const Icon(Icons.language), + const SizedBox( + width: 8.0, + ), + indexController.currentFeature[0] + .properties!["webcontents"] != + null && + (indexController.currentFeature[0] + .properties!["webcontents"] as String) + .isNotEmpty + ? getDetails( + context, + "web".tr, + indexController.currentFeature[0] + .properties!["webcontents"] ?? + '', + isurl: true) + : const SizedBox( + width: 0.0, + height: 0, + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + children: [ + const SizedBox( + width: 8.0, + ), + indexController.currentFeature[0] + .properties!["remark"] != + null && + (indexController.currentFeature[0] + .properties!["remark"] as String) + .isNotEmpty + ? getDetails( + context, + "remarks".tr, + indexController.currentFeature[0] + .properties!["remark"] ?? + '', + isurl: false) + : const SizedBox( + width: 0.0, + height: 0, + ), + ], + ), + ), + // Text('${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["cp"].toString())} - id: ${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["checkin_point"].toString())}'), + ], + ), + )), + const SizedBox( + height: 60.0, ) - ), - ], - ), - Obx(() => - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Obx(() => - indexController.currentDestinationFeature.isNotEmpty && indexController.currentDestinationFeature[0].cp == -1 && indexController.currentDestinationFeature[0].checkedin == false && destinationController.is_at_start.value == true ? - ElevatedButton( - onPressed: (){ - destinationController.is_in_rog.value = true; - destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!); - ExternalService().StartRogaining().then((value) => Get.back()); - }, - child: Text( - // start - indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? - "ロゲイニングを開始" - : - "間違った目的地..." - ) - ) - : - Container(), - - ), - Obx(() => - destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ? - ElevatedButton( - onPressed: (){ - Get.toNamed(AppPages.CAMERA_PAGE); - Get.back(); - }, - child: Text( - //goal - indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ? - "ロゲイニングを終える" - : - "間違った目的地 ..." - ) - ) - : - Container(), - ), - ], - ), - Row( - children: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ? - Container() - : - FutureBuilder( - future: wantToGo(context), - builder: (context, snapshot) { - return Container( - child: snapshot.data, - ); - }, - ), - indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ? - Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"])) - : - Container(width: 0.0, height: 0,), - ], - ), - ), - ElevatedButton( - onPressed:() async { - destinationController.CallforCheckin(destinationController.festuretoDestination(indexController.currentFeature[0])); - }, - child:Text("チェックイン") - ), - SizedBox(width: 16,), - ElevatedButton( - onPressed:() async { - GeoJsonFeature mp = indexController.currentFeature[0] as GeoJsonFeature; - Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high); - Destination ds = Destination( - lat: position.latitude, - lon: position.longitude - ); - - Destination tp = Destination( - lat: mp.geometry!.geoSerie!.geoPoints[0].latitude, - lon: mp.geometry!.geoSerie!.geoPoints[0].longitude - ); - - Get.back(); - - destinationController.destinationMatrixFromCurrentPoint([ds, tp]); - }, - child:Text("ここへ行く") - ), - ], - ), - SizedBox(height: 8.0,), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.roundabout_left), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ? - getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '') - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.phone), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ? - getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '') - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.email), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ? - getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '') - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - Icon(Icons.language), - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ? - getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true) - : - Container(width: 0.0, height: 0,), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - SizedBox(width: 8.0,), - indexController.currentFeature[0].properties!["remark"] != null && (indexController.currentFeature[0].properties!["remark"] as String).isNotEmpty ? - getDetails(context, "remarks".tr, indexController.currentFeature[0].properties!["remark"] ?? '', isurl: false) - : - Container(width: 0.0, height: 0,), - ], - ), - ), - // Text('${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["cp"].toString())} - id: ${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["checkin_point"].toString())}'), - ], - ), - ) - ), - SizedBox(height: 60.0,) - ], - ), - ); + ], + ), + ); } - - - - Future wantToGo(BuildContext context)async { - - bool _selected = false; - print('---target-- ${indexController.currentFeature[0].properties!["location_id"]}----'); - for(Destination d in destinationController.destinations){ + Future wantToGo(BuildContext context) async { + bool selected = false; + print( + '---target-- ${indexController.currentFeature[0].properties!["location_id"]}----'); + for (Destination d in destinationController.destinations) { print('---- ${d.location_id.toString()} ----'); - if(d.location_id == indexController.currentFeature[0].properties!["location_id"]){ - _selected = true; + if (d.location_id == + indexController.currentFeature[0].properties!["location_id"]) { + selected = true; break; } } DatabaseHelper db = DatabaseHelper.instance; - return - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - indexController.rog_mode == 0 ? - IconButton( - icon: Icon(Icons.pin_drop_sharp, size: 32, color: _selected == true ? Colors.amber : Colors.blue,), - onPressed: (){ - if(_selected){ - // show remove from destination - Get.defaultDialog( - title: "本当にこのポイントを通過順から外しますか?", - middleText: "場所は目的地リストから削除されます", - backgroundColor: Colors.blue.shade300, - titleStyle: TextStyle(color: Colors.white), - middleTextStyle: TextStyle(color: Colors.white), - textConfirm: "はい", - textCancel: "いいえ", - cancelTextColor: Colors.white, - confirmTextColor: Colors.blue, - buttonColor: Colors.white, - barrierDismissible: false, - radius: 10, - content: Column( - children: [ - ], - ), - onConfirm: (){ - int _id = indexController.currentFeature[0].properties!["location_id"]; - Destination? d = destinationController.destinationById(_id); - print('--- des id is : ${d} -----'); - if(d != null) { - //print('--- des id is : ${d.location_id} -----'); - destinationController.deleteDestination(d); - Get.back(); - Get.back(); - Get.snackbar("追加した", "場所が削除されました"); - } - } - ); - return; - } - // show add to destination - Get.defaultDialog( - title: "この場所を登録してもよろしいですか", - middleText: "ロケーションがロガニング リストに追加されます", - backgroundColor: Colors.blue.shade300, - titleStyle: TextStyle(color: Colors.white), - middleTextStyle: TextStyle(color: Colors.white), - textConfirm: "はい", - textCancel: "いいえ", - cancelTextColor: Colors.white, - confirmTextColor: Colors.blue, - buttonColor: Colors.white, - barrierDismissible: false, - radius: 10, - content: Column( - children: [ - ], - ), - onConfirm: (){ - GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint; - LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); - - print("----- want to go sub location is ---- ${indexController.currentFeature[0].properties!["sub_loc_id"]} -----"); - - Destination dest = Destination( - name: indexController.currentFeature[0].properties!["location_name"], - address: indexController.currentFeature[0].properties!["address"], - phone: indexController.currentFeature[0].properties!["phone"], - email: indexController.currentFeature[0].properties!["email"], - webcontents: indexController.currentFeature[0].properties!["webcontents"], - videos: indexController.currentFeature[0].properties!["videos"], - category: indexController.currentFeature[0].properties!["category"], - series: 1, - lat: pt.latitude, - lon: pt.longitude, - sub_loc_id: indexController.currentFeature[0].properties!["sub_loc_id"], - location_id: indexController.currentFeature[0].properties!["location_id"], - list_order: 1, - photos: indexController.currentFeature[0].properties!["photos"], - checkin_radious: indexController.currentFeature[0].properties!["checkin_radius"], - auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0, - cp: indexController.currentFeature[0].properties!["cp"], - checkin_point: indexController.currentFeature[0].properties!["checkin_point"], - buy_point: indexController.currentFeature[0].properties!["buy_point"], - selected: false, - checkedin: false, - hidden_location: indexController.currentFeature[0].properties!["hidden_location"] == true ?1 : 0 - ); - destinationController.addDestinations(dest); - Get.back(); - Get.back(); - Get.snackbar("追加した", "場所が追加されました"); - } - ); - - }, - ): - Container(), - SizedBox(width: 8.0,) , - Obx((() => - - indexController.rog_mode == 1 ? - ElevatedButton( - onPressed: () async { - Destination dest = indexController.currentDestinationFeature[0]!; - //print("------ curent destination is ${dest!.checkedIn}-------"); - if(dest != null){ - //print("------ curent destination is ${dest!.checkedin}-------::::::::::"); - destinationController.makeCheckin(dest, !dest.checkedin!, ""); - } - }, - child: indexController.currentDestinationFeature[0].checkedin == false ? - Text("チェックイン") - : - Text("チェックアウト") - ): - Container() - - ) + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + indexController.rog_mode == 0 + ? IconButton( + icon: Icon( + Icons.pin_drop_sharp, + size: 32, + color: selected == true + ? Colors.amber + : Theme.of(context).colorScheme.primary, ), - ], - ), - ], - ); + onPressed: () { + if (selected) { + // show remove from destination + Get.defaultDialog( + title: "本当にこのポイントを通過順から外しますか?", + middleText: "場所は目的地リストから削除されます", + backgroundColor: Theme.of(context) + .colorScheme + .secondaryContainer, + titleStyle: const TextStyle(color: Colors.white), + middleTextStyle: TextStyle( + color: Theme.of(context) + .colorScheme + .onSecondaryContainer), + textConfirm: "はい", + textCancel: "いいえ", + cancelTextColor: Colors.white, + confirmTextColor: Colors.blue, + buttonColor: Colors.white, + barrierDismissible: false, + radius: 10, + content: const Column( + children: [], + ), + onConfirm: () { + int id = indexController + .currentFeature[0].properties!["location_id"]; + Destination? d = + destinationController.destinationById(id); + print('--- des id is : $d -----'); + if (d != null) { + //print('--- des id is : ${d.location_id} -----'); + destinationController.deleteDestination(d); + Get.back(); + Get.back(); + Get.snackbar("追加した", "場所が削除されました"); + } + }); + return; + } + // show add to destination + Get.defaultDialog( + title: "この場所を登録してもよろしいですか", + middleText: "ロケーションがロガニング リストに追加されます", + backgroundColor: Colors.blue.shade300, + titleStyle: const TextStyle(color: Colors.white), + middleTextStyle: const TextStyle(color: Colors.white), + textConfirm: "はい", + textCancel: "いいえ", + cancelTextColor: Colors.white, + confirmTextColor: Colors.blue, + buttonColor: Colors.white, + barrierDismissible: false, + radius: 10, + content: const Column( + children: [], + ), + onConfirm: () { + GeoJsonMultiPoint mp = indexController + .currentFeature[0] + .geometry as GeoJsonMultiPoint; + LatLng pt = LatLng( + mp.geoSerie!.geoPoints[0].latitude, + mp.geoSerie!.geoPoints[0].longitude); + + print( + "----- want to go sub location is ---- ${indexController.currentFeature[0].properties!["sub_loc_id"]} -----"); + + Destination dest = Destination( + name: indexController.currentFeature[0] + .properties!["location_name"], + address: indexController + .currentFeature[0].properties!["address"], + phone: indexController + .currentFeature[0].properties!["phone"], + email: indexController + .currentFeature[0].properties!["email"], + webcontents: indexController.currentFeature[0] + .properties!["webcontents"], + videos: indexController + .currentFeature[0].properties!["videos"], + category: indexController + .currentFeature[0].properties!["category"], + series: 1, + lat: pt.latitude, + lon: pt.longitude, + sub_loc_id: indexController.currentFeature[0] + .properties!["sub_loc_id"], + location_id: indexController.currentFeature[0] + .properties!["location_id"], + list_order: 1, + photos: indexController.currentFeature[0].properties!["photos"], + checkin_radious: indexController.currentFeature[0].properties!["checkin_radius"], + auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0, + cp: indexController.currentFeature[0].properties!["cp"], + checkin_point: indexController.currentFeature[0].properties!["checkin_point"], + buy_point: indexController.currentFeature[0].properties!["buy_point"], + selected: false, + checkedin: false, + hidden_location: indexController.currentFeature[0].properties!["hidden_location"] == true ? 1 : 0); + destinationController.addDestinations(dest); + Get.back(); + Get.back(); + Get.snackbar("追加した", "場所が追加されました"); + }); + }, + ) + : Container(), + const SizedBox( + width: 8.0, + ), + Obx((() => indexController.rog_mode == 1 + ? ElevatedButton( + onPressed: () async { + Destination dest = + indexController.currentDestinationFeature[0]; + //print("------ curent destination is ${dest!.checkedIn}-------"); + //print("------ curent destination is ${dest!.checkedin}-------::::::::::"); + destinationController.makeCheckin( + dest, !dest.checkedin!, ""); + }, + child: indexController + .currentDestinationFeature[0].checkedin == + false + ? const Text("チェックイン") + : const Text("チェックアウト")) + : Container())), + ], + ), + ], + ); } - Widget getCheckin(BuildContext context){ - + Widget getCheckin(BuildContext context) { //print("------ currentAction ----- ${indexController.currentAction}-----"); return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - indexController.currentAction[0][0]["checkin"] == false ? - Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + indexController.currentAction[0][0]["checkin"] == false + ? Column( + children: [ + Row( + mainAxisSize: MainAxisSize.max, children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - ElevatedButton( - child: Text("Image"), onPressed: (){ - final ImagePicker _picker = ImagePicker(); - _picker.pickImage(source: ImageSource.camera).then((value){ + ElevatedButton( + child: const Text("Image"), + onPressed: () { + final ImagePicker picker = ImagePicker(); + picker + .pickImage(source: ImageSource.camera) + .then((value) { //print("----- image---- ${value!.path}"); }); - }, - ) - ], - ), - ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - //print(indexController.currentAction[0]); - indexController.currentAction[0][0]["checkin"] = true; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - //print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); }, - child: Text("checkin".tr) - ) + ) ], - ) - : + ), ElevatedButton( - onPressed: (){ - if(indexController.currentAction.isNotEmpty){ - //print(indexController.currentAction[0]); - indexController.currentAction[0][0]["checkin"] = false; - Map temp = Map.from(indexController.currentAction[0][0]); - indexController.currentAction.clear(); - //print("---temp---${temp}"); - indexController.currentAction.add([temp]); - } - indexController.makeAction(context); - }, - - child: Icon( - Icons.favorite, color: Colors.red) - - , - ) - ], - ) - ], - ); - } - - - - Widget getDetails(BuildContext context, String label, String text, {bool isurl=false}){ - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(label), - SizedBox(width: 10.0,), - InkWell( - onTap: (){ - if(isurl){ - if(indexController.rog_mode == 0){ - _launchURL(indexController.currentFeature[0].properties!["webcontents"]); - } - else { - indexController.currentDestinationFeature[0].webcontents; - } - + onPressed: () { + if (indexController.currentAction.isNotEmpty) { + //print(indexController.currentAction[0]); + indexController.currentAction[0][0]["checkin"] = + true; + Map temp = + Map.from( + indexController.currentAction[0][0]); + indexController.currentAction.clear(); + //print("---temp---${temp}"); + indexController.currentAction.add([temp]); + } + indexController.makeAction(context); + }, + child: Text("checkin".tr)) + ], + ) + : ElevatedButton( + onPressed: () { + if (indexController.currentAction.isNotEmpty) { + //print(indexController.currentAction[0]); + indexController.currentAction[0][0]["checkin"] = false; + Map temp = Map.from( + indexController.currentAction[0][0]); + indexController.currentAction.clear(); + //print("---temp---${temp}"); + indexController.currentAction.add([temp]); } + indexController.makeAction(context); }, - child: Container( - width: MediaQuery.of(context).size.width - 160, - child: Text(text, - style: TextStyle( - color: isurl ? Colors.blue : Colors.black, - ), - ), - ), - ), - ], - ); + child: const Icon(Icons.favorite, color: Colors.red), + ) + ], + ) + ], + ); } - - - -} \ No newline at end of file + Widget getDetails(BuildContext context, String label, String text, + {bool isurl = false}) { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(label), + const SizedBox( + width: 10.0, + ), + InkWell( + onTap: () { + if (isurl) { + if (indexController.rog_mode == 0) { + _launchURL(indexController + .currentFeature[0].properties!["webcontents"]); + } else { + indexController.currentDestinationFeature[0].webcontents; + } + } + }, + child: SizedBox( + width: MediaQuery.of(context).size.width - 160, + child: Text( + text, + style: TextStyle( + color: isurl ? Colors.blue : Colors.black, + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/bottom_sheet_widget.dart b/lib/widgets/bottom_sheet_widget.dart index 40c2698..6d3c498 100644 --- a/lib/widgets/bottom_sheet_widget.dart +++ b/lib/widgets/bottom_sheet_widget.dart @@ -1,4 +1,3 @@ -import 'dart:io'; import 'package:flutter/material.dart'; import 'package:geojson/geojson.dart'; @@ -13,9 +12,11 @@ class BottomSheetWidget extends StatelessWidget { final IndexController indexController = Get.find(); + BottomSheetWidget({Key? key}) : super(key: key); + Image getImage(GeoJsonFeature? gf){ if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); + return const Image(image: AssetImage('assets/images/empty_image.png')); } else{ return Image(image: NetworkImage( @@ -37,7 +38,7 @@ class BottomSheetWidget extends StatelessWidget { return SingleChildScrollView( child: Column( children: [ - SizedBox(height: 5.0,), + const SizedBox(height: 5.0,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -47,18 +48,18 @@ class BottomSheetWidget extends StatelessWidget { }, color: Colors.blue, textColor: Colors.white, - child: Icon( + padding: const EdgeInsets.all(14), + shape: const CircleBorder(), + child: const Icon( Icons.arrow_back_ios, size: 14, ), - padding: EdgeInsets.all(14), - shape: CircleBorder(), ), Expanded( child: Container( alignment: Alignment.center, child: Obx(() => - Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( + Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, ), @@ -72,12 +73,12 @@ class BottomSheetWidget extends StatelessWidget { }, color: Colors.blue, textColor: Colors.white, - child: Icon( + padding: const EdgeInsets.all(14), + shape: const CircleBorder(), + child: const Icon( Icons.arrow_forward_ios, size: 14, ), - padding: EdgeInsets.all(14), - shape: CircleBorder(), ), ], ), @@ -105,59 +106,59 @@ class BottomSheetWidget extends StatelessWidget { Expanded( child: Container( alignment: Alignment.topRight, - child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)), + child: Text("address".tr, style: const TextStyle(fontWeight: FontWeight.bold),)), ), - SizedBox(width: 12.0,), + const SizedBox(width: 12.0,), Expanded( child: Container( alignment: Alignment.topLeft, child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '', - style: TextStyle(color: Colors.blue,), + style: const TextStyle(color: Colors.blue,), softWrap: true, overflow: TextOverflow.ellipsis,) ), ), ) ], - ): Container(width: 0.0, height: 0,), + ): const SizedBox(width: 0.0, height: 0,), indexController.currentFeature[0].properties!["phone"] != null ? Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded(child: Container( alignment: Alignment.topRight, - child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))), - SizedBox(width: 12.0,), + child: Text("telephone".tr, style: const TextStyle(fontWeight: FontWeight.bold),))), + const SizedBox(width: 12.0,), Expanded( child: Container( alignment: Alignment.topLeft, child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '', - style: TextStyle(color: Colors.blue,), + style: const TextStyle(color: Colors.blue,), overflow: TextOverflow.ellipsis,) ), ), ) ], - ): Container(width: 0, height: 0,), + ): const SizedBox(width: 0, height: 0,), indexController.currentFeature[0].properties!["email"] != null ? Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded(child: Container( alignment: Alignment.topRight, - child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))), - SizedBox(width: 12.0,), + child: Text("email".tr, style: const TextStyle(fontWeight: FontWeight.bold),))), + const SizedBox(width: 12.0,), Expanded( child: Container( alignment: Alignment.topLeft, child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '', - style: TextStyle(color: Colors.blue,), + style: const TextStyle(color: Colors.blue,), overflow: TextOverflow.ellipsis,) ), ), ) ], - ): Container(width: 0, height: 0,), + ): const SizedBox(width: 0, height: 0,), indexController.currentFeature[0].properties!["webcontents"] != null ? Row( mainAxisAlignment: MainAxisAlignment.center, @@ -165,8 +166,8 @@ class BottomSheetWidget extends StatelessWidget { Expanded(child: Container( alignment: Alignment.topRight, child: Text( - "web".tr, style: TextStyle(fontWeight: FontWeight.bold)))), - SizedBox(width: 12.0,), + "web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))), + const SizedBox(width: 12.0,), Expanded( child: Container( alignment: Alignment.topLeft, @@ -175,40 +176,40 @@ class BottomSheetWidget extends StatelessWidget { _launchURL(indexController.currentFeature[0].properties!["webcontents"]); }, child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '', - style: TextStyle(color: Colors.blue,), + style: const TextStyle(color: Colors.blue,), softWrap: false, overflow: TextOverflow.fade,), )), ), ) ], - ): Container(width: 0.0, height: 0.0,), + ): const SizedBox(width: 0.0, height: 0.0,), indexController.currentFeature[0].properties!["videos"] != null ? Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded(child: Container( alignment: Alignment.topRight, - child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))), - SizedBox(width: 12.0,), + child: Text("video".tr, style: const TextStyle(fontWeight: FontWeight.bold)))), + const SizedBox(width: 12.0,), Expanded( child: Container( alignment: Alignment.topLeft, child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '', - style: TextStyle(color: Colors.blue,), + style: const TextStyle(color: Colors.blue,), overflow: TextOverflow.ellipsis,) ), ), ) ], - ): Container(width: 0.0, height: 0.0,), + ): const SizedBox(width: 0.0, height: 0.0,), ], ), ), ), ], ), - SizedBox(height: 20.0,), + const SizedBox(height: 20.0,), Obx(() => indexController.currentAction.isNotEmpty ? Row( @@ -232,7 +233,7 @@ class BottomSheetWidget extends StatelessWidget { indexController.currentAction[0][0]["wanttogo"] = true; Map temp = Map.from(indexController.currentAction[0][0]); indexController.currentAction.clear(); - print("---temp---${temp}"); + print("---temp---$temp"); indexController.currentAction.add([temp]); } indexController.makeAction(context); @@ -246,7 +247,7 @@ class BottomSheetWidget extends StatelessWidget { indexController.currentAction[0][0]["wanttogo"] = false; Map temp = Map.from(indexController.currentAction[0][0]); indexController.currentAction.clear(); - print("---temp---${temp}"); + print("---temp---$temp"); indexController.currentAction.add([temp]); } indexController.makeAction(context); @@ -267,7 +268,7 @@ class BottomSheetWidget extends StatelessWidget { indexController.currentAction[0][0]["like"] = true; Map temp = Map.from(indexController.currentAction[0][0]); indexController.currentAction.clear(); - print("---temp---${temp}"); + print("---temp---$temp"); indexController.currentAction.add([temp]); } indexController.makeAction(context); @@ -281,7 +282,7 @@ class BottomSheetWidget extends StatelessWidget { indexController.currentAction[0][0]["like"] = false; Map temp = Map.from(indexController.currentAction[0][0]); indexController.currentAction.clear(); - print("---temp---${temp}"); + print("---temp---$temp"); indexController.currentAction.add([temp]); } indexController.makeAction(context); @@ -302,7 +303,7 @@ class BottomSheetWidget extends StatelessWidget { : - Container(width: 0, height: 0,), + const SizedBox(width: 0, height: 0,), indexController.rog_mode.value == 1 ? indexController.currentAction[0][0]["checkin"] == false ? Column( @@ -311,9 +312,9 @@ class BottomSheetWidget extends StatelessWidget { mainAxisSize: MainAxisSize.max, children: [ ElevatedButton( - child: Text("Image"), onPressed: (){ - final ImagePicker _picker = ImagePicker(); - _picker.pickImage(source: ImageSource.camera).then((value){ + child: const Text("Image"), onPressed: (){ + final ImagePicker picker = ImagePicker(); + picker.pickImage(source: ImageSource.camera).then((value){ print("----- image---- ${value!.path}"); }); }, @@ -327,7 +328,7 @@ class BottomSheetWidget extends StatelessWidget { indexController.currentAction[0][0]["checkin"] = true; Map temp = Map.from(indexController.currentAction[0][0]); indexController.currentAction.clear(); - print("---temp---${temp}"); + print("---temp---$temp"); indexController.currentAction.add([temp]); } indexController.makeAction(context); @@ -344,18 +345,18 @@ class BottomSheetWidget extends StatelessWidget { indexController.currentAction[0][0]["checkin"] = false; Map temp = Map.from(indexController.currentAction[0][0]); indexController.currentAction.clear(); - print("---temp---${temp}"); + print("---temp---$temp"); indexController.currentAction.add([temp]); } indexController.makeAction(context); }, - child: Icon( + child: const Icon( Icons.favorite, color: Colors.red) , ): - Container(width: 0, height: 0,), + const SizedBox(width: 0, height: 0,), ], ): Row( mainAxisAlignment: MainAxisAlignment.center, @@ -364,11 +365,11 @@ class BottomSheetWidget extends StatelessWidget { onPressed: (){ Get.toNamed(AppPages.LOGIN); }, - child: Flexible(child: Text("その他のオプションについてはログインしてください"))) + child: const Flexible(child: Text("その他のオプションについてはログインしてください"))) ], ), ), - Row( + const Row( children: [ SizedBox(height: 60.0,), ], diff --git a/lib/widgets/bread_crum_widget.dart b/lib/widgets/bread_crum_widget.dart index 6b8e784..63543d0 100644 --- a/lib/widgets/bread_crum_widget.dart +++ b/lib/widgets/bread_crum_widget.dart @@ -15,7 +15,7 @@ class BreadCrumbWidget extends StatelessWidget { @override Widget build(BuildContext context) { - print("------ map controller is ${mapController}------------"); + print("------ map controller is $mapController------------"); return Obx(()=> indexController.perfectures.isNotEmpty && mapController != null ? diff --git a/lib/widgets/cat_widget.dart b/lib/widgets/cat_widget.dart index b96a1ed..9001b0a 100644 --- a/lib/widgets/cat_widget.dart +++ b/lib/widgets/cat_widget.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/services/location_service.dart'; class CatWidget extends StatefulWidget { CatWidget({ Key? key, required this.indexController, }) : super(key: key); @@ -31,7 +30,7 @@ class _CatWidgetState extends State { itemBuilder: (BuildContext context){ List itms = []; for(dynamic d in widget.indexController.cats[0]){ - PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString()); + PopupMenuItem itm = PopupMenuItem(value: d['category'].toString(), child: Text(d['category'].toString())); itms.add(itm); } return itms; diff --git a/lib/widgets/destination_widget.dart b/lib/widgets/destination_widget.dart index c2b70be..0a01911 100644 --- a/lib/widgets/destination_widget.dart +++ b/lib/widgets/destination_widget.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:geojson/geojson.dart'; import 'package:get/get.dart'; import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; @@ -7,8 +6,6 @@ import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/utils/const.dart'; import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; -import 'package:sqflite/sqlite_api.dart'; import 'package:timeline_tile/timeline_tile.dart'; class DestinationWidget extends StatelessWidget { @@ -22,12 +19,12 @@ class DestinationWidget extends StatelessWidget { Image getImage(int index){ if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); + return const Image(image: AssetImage('assets/images/empty_image.png')); } else{ print("------- image is ${destinationController.destinations[index].photos!}------"); - String _photo = destinationController.destinations[index].photos!; - if(_photo.contains('http')){ + String photo = destinationController.destinations[index].photos!; + if(photo.contains('http')){ return Image(image: NetworkImage( destinationController.destinations[index].photos!), errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { @@ -36,10 +33,10 @@ class DestinationWidget extends StatelessWidget { ); } else { - String server_url = ConstValues.currentServer(); + String serverUrl = ConstValues.currentServer(); //print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ==="); return Image(image: NetworkImage( - '${server_url}/media/compressed/' + destinationController.destinations[index].photos!), + '$serverUrl/media/compressed/${destinationController.destinations[index].photos!}'), errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Image.asset("assets/images/empty_image.png"); }, @@ -63,10 +60,10 @@ class DestinationWidget extends StatelessWidget { // } void doDelete() { - destinationController.currentSelectedDestinations.forEach((element) { + for (var element in destinationController.currentSelectedDestinations) { destinationController.deleteDestination(element); destinationController.resetRogaining(); - }); + } // destinationController.destination_index_data.forEach((element) { // //print(element["index"]); // destinationController.deleteDestination(element["index"]); @@ -75,7 +72,7 @@ class DestinationWidget extends StatelessWidget { } void moveUp() { - Destination? d = null; + Destination? d; for(Destination ad in destinationController.destinations){ if(ad.selected == true){ d = ad; @@ -89,7 +86,7 @@ class DestinationWidget extends StatelessWidget { } void moveDown() { - Destination? d = null; + Destination? d; for(Destination ad in destinationController.destinations){ if(ad.selected == true){ d = ad; @@ -107,8 +104,8 @@ class DestinationWidget extends StatelessWidget { title: "are_you_sure_want_to_delete_all".tr, middleText: "all_added_destination_will_be_deleted".tr, backgroundColor: Colors.blue.shade300, - titleStyle: TextStyle(color: Colors.white), - middleTextStyle: TextStyle(color: Colors.white), + titleStyle: const TextStyle(color: Colors.white), + middleTextStyle: const TextStyle(color: Colors.white), textConfirm: "confirm".tr, textCancel: "cancel".tr, cancelTextColor: Colors.white, @@ -116,7 +113,7 @@ class DestinationWidget extends StatelessWidget { buttonColor: Colors.white, barrierDismissible: false, radius: 10, - content: Column( + content: const Column( children: [ ], ), @@ -138,9 +135,9 @@ class DestinationWidget extends StatelessWidget { // }); } - Future getIsLocationAvilable(int location_id) async { + Future getIsLocationAvilable(int locationId) async { DatabaseHelper db = DatabaseHelper.instance; - return await db.isAlreadyAvailable(location_id); + return await db.isAlreadyAvailable(locationId); } @override @@ -164,8 +161,8 @@ class DestinationWidget extends StatelessWidget { isFirst: index == 0 ? true : false, indicatorStyle: IndicatorStyle( indicator: CircleAvatar( - child: Text(destinationController.destinations[index].list_order.toString(), style: TextStyle(color: Colors.white),), backgroundColor: Colors.red, + child: Text(destinationController.destinations[index].list_order.toString(), style: const TextStyle(color: Colors.white),), ), ), key: Key(index.toString()), @@ -178,22 +175,20 @@ class DestinationWidget extends StatelessWidget { onTap: () async { { Destination? fs = destinationController.destinations[index]; - print("----fsf-----${index}"); - if(fs != null){ - - if(indexController.currentDestinationFeature.isNotEmpty) { - indexController.currentDestinationFeature.clear(); - } - indexController.currentDestinationFeature.add(fs); - print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----"); - //indexController.getAction(); - - showModalBottomSheet(context: context, isScrollControlled: true, - //builder:((context) => BottomSheetWidget()) - builder:((context) => BottomSheetNew()) - ); + print("----fsf-----$index"); + + if(indexController.currentDestinationFeature.isNotEmpty) { + indexController.currentDestinationFeature.clear(); } - }; + indexController.currentDestinationFeature.add(fs); + print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----"); + //indexController.getAction(); + + showModalBottomSheet(context: context, isScrollControlled: true, + //builder:((context) => BottomSheetWidget()) + builder:((context) => BottomSheetNew()) + ); + } }, onLongPress: (){ destinationController.toggleSelection(destinationController.destinations[index]); @@ -229,7 +224,7 @@ class DestinationWidget extends StatelessWidget { color: Colors.grey.withOpacity(0.3), spreadRadius: 5, blurRadius: 3, - offset: Offset(0, 7), // changes position of shadow + offset: const Offset(0, 7), // changes position of shadow ), ], ), @@ -239,22 +234,22 @@ class DestinationWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( - icon:Icon(Icons.delete_forever), + icon:const Icon(Icons.delete_forever), //onPressed: (){doDelete();}, onPressed: clearall, ), IconButton( - icon:Icon(Icons.cancel), + icon:const Icon(Icons.cancel), //onPressed: (){doDelete();}, - onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null, + onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? doDelete : null, ), IconButton( - icon:Icon(Icons.move_up), - onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveUp : null, + icon:const Icon(Icons.move_up), + onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveUp : null, ), IconButton( - icon:Icon(Icons.move_down), - onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveDown : null, + icon:const Icon(Icons.move_down), + onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveDown : null, ), // IconButton( // icon:Icon(Icons.sync), diff --git a/lib/widgets/list_widget.dart b/lib/widgets/list_widget.dart index c663d05..a662385 100644 --- a/lib/widgets/list_widget.dart +++ b/lib/widgets/list_widget.dart @@ -6,7 +6,6 @@ import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/utils/const.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; class ListWidget extends StatelessWidget { ListWidget({ Key? key }) : super(key: key); @@ -16,16 +15,16 @@ class ListWidget extends StatelessWidget { Image getImage(int index){ if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){ - return Image(image: AssetImage('assets/images/empty_image.png')); + return const Image(image: AssetImage('assets/images/empty_image.png')); } else{ - print("==== photo index is ${index} ==="); - String server_url = ConstValues.currentServer(); + print("==== photo index is $index ==="); + String serverUrl = ConstValues.currentServer(); GeoJsonFeature gf = indexController.locations[0].collection[index]; - String _photo = gf!.properties!["photos"]; + String photo = gf.properties!["photos"]; return Image( image: NetworkImage( - '${server_url}/media/compressed/' + _photo + '$serverUrl/media/compressed/$photo' ), errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { return Image.asset("assets/images/empty_image.png"); @@ -35,7 +34,7 @@ class ListWidget extends StatelessWidget { } void changeCurrentFeature(GeoJsonFeature fs){ - if(indexController.currentFeature.length > 0){ + if(indexController.currentFeature.isNotEmpty){ indexController.currentFeature.clear(); } indexController.currentFeature.add(fs); @@ -44,21 +43,21 @@ class ListWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Obx(() => - indexController.locations.length > 0 ? + indexController.locations.isNotEmpty ? ListView.builder( itemCount: indexController.locations[0].collection.length, shrinkWrap: true, itemBuilder: (_, index){ - bool _is_found = false; + bool isFound = false; for(Destination d in destinationController.destinations){ if(indexController.locations[0].collection[index].properties!['location_id'] == d.location_id){ - _is_found = true; + isFound = true; break; } } return Card( child: ListTile( - selected: _is_found, + selected: isFound, selectedTileColor: Colors.yellow.shade200, onTap: (){ @@ -72,13 +71,13 @@ class ListWidget extends StatelessWidget { ); }, leading: getImage(index), - title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""), - subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""), - trailing: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : Text(""), + title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : const Text(""), + subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : const Text(""), + trailing: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""), ), ); }, - ) : Container(width: 0, height: 0,), + ) : const SizedBox(width: 0, height: 0,), ); } } \ No newline at end of file diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index eb6e56b..d51a4fe 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -5,14 +5,12 @@ import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart'; import 'package:geojson/geojson.dart'; import 'package:get/get.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:latlong2/latlong.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/utils/text_util.dart'; import 'package:rogapp/widgets/base_layer_widget.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart'; -import 'package:rogapp/widgets/bottom_sheet_widget.dart'; class MapWidget extends StatelessWidget { @@ -69,19 +67,19 @@ class MapWidget extends StatelessWidget { child: Stack( alignment: Alignment.center, children: [ - Icon(Icons.circle,size: 6.0,), + const Icon(Icons.circle,size: 6.0,), i.properties!['cp'] == -1 ? Transform.rotate( alignment: Alignment.centerLeft, origin: Offset.fromDirection(1, 26), angle: 270 * pi / 180, - child: Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)): + child: const Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)): Container(color: Colors.transparent,), ], ) ), ), - Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))), + Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))), ], ); } @@ -91,12 +89,12 @@ class MapWidget extends StatelessWidget { print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------"); - final PopupController _popupController = PopupController(); + final PopupController popupController = PopupController(); return Stack( children: [ Obx(() => - indexController.is_loading == true ? Padding( - padding: const EdgeInsets.only(top: 60.0), + indexController.is_loading == true ? const Padding( + padding: EdgeInsets.only(top: 60.0), child: CircularProgressIndicator(), ): FlutterMap( @@ -110,7 +108,7 @@ class MapWidget extends StatelessWidget { //print(DateTime.now().toString() + ' [MapEventMoveStart] START'); // do something } - if (mapEvent is MapEventMoveEnd && indexController.currentUser. length <= 0) { + if (mapEvent is MapEventMoveEnd && indexController.currentUser.isEmpty) { //print(DateTime.now().toString() + ' [MapEventMoveStart] END'); indexController.loadLocationsBound(); //indexController.rogMapController!.move(c.center, c.zoom); @@ -119,7 +117,7 @@ class MapWidget extends StatelessWidget { }, //center: LatLng(37.15319600454702, 139.58765950528198), - bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), + bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), zoom: 1, interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, @@ -127,11 +125,11 @@ class MapWidget extends StatelessWidget { }, onTap: (_, __) => - _popupController + popupController .hideAllPopups(), // Hide popup when the map is tapped. ), children: [ - BaseLayer(), + const BaseLayer(), CurrentLocationLayer(), indexController.locations.isNotEmpty && indexController.locations[0].collection.isNotEmpty ? MarkerLayer( diff --git a/lib/widgets/perfecture_widget.dart b/lib/widgets/perfecture_widget.dart index 7fecc8c..625b588 100644 --- a/lib/widgets/perfecture_widget.dart +++ b/lib/widgets/perfecture_widget.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:get/get.dart'; import 'package:rogapp/pages/index/index_controller.dart'; -import 'package:rogapp/widgets/cat_widget.dart'; class PerfectureWidget extends StatefulWidget { @@ -41,8 +40,8 @@ class _PerfectureWidgetState extends State { for (Map currency in widget.indexController.perfectures[0]) { //print(currency["id"].toString()); var newDropdown = DropdownMenuItem( - child: Text(currency["adm1_ja"].toString()), value: currency["id"].toString(), + child: Text(currency["adm1_ja"].toString()), ); dropDownItems.add(newDropdown); @@ -57,8 +56,8 @@ class _PerfectureWidgetState extends State { for (Map currency in widget.indexController.subPerfs[0]) { var newDropdown = DropdownMenuItem( - child: Text(currency["adm2_ja"].toString()), value: currency["id"].toString(), + child: Text(currency["adm2_ja"].toString()), ); dropDownItems.add(newDropdown); } @@ -72,8 +71,8 @@ class _PerfectureWidgetState extends State { for (Map currency in widget.indexController.areas[0]) { var newDropdown = DropdownMenuItem( - child: Text(currency["area_nm"].toString()), value: currency["id"].toString(), + child: Text(currency["area_nm"].toString()), ); dropDownItems.add(newDropdown); @@ -85,8 +84,8 @@ class _PerfectureWidgetState extends State { for (Map currency in widget.indexController.customAreas[0]) { var newDropdown = DropdownMenuItem( - child: Text(currency["event_name"].toString()), value: currency["event_name"].toString(), + child: Text(currency["event_name"].toString()), ); dropDownItems.add(newDropdown); @@ -105,7 +104,7 @@ class _PerfectureWidgetState extends State { //print("--------cats ------############### ${widget.indexController.cats.toString()} -------------"); for(dynamic d in widget.indexController.cats){ //print("-------- ddd ------############### ${d} --------dddd-----"); - var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString()); + var newDropdown = DropdownMenuItem(value: d['category'].toString(), child: Text(d['category'].toString())); //print("--------cats ------############### ${d['category'].toString()} -------------"); dropDownItems.add(newDropdown); } @@ -166,12 +165,10 @@ class _PerfectureWidgetState extends State { } setState(() { widget.indexController.locations.clear(); - if(newValue != null){ - widget.indexController.is_loading.value = true; - widget.indexController.areaDropdownValue = newValue; - widget.indexController.populateSubPerForArea(newValue, widget.mapController); - } - }); + widget.indexController.is_loading.value = true; + widget.indexController.areaDropdownValue = newValue; + widget.indexController.populateSubPerForArea(newValue, widget.mapController); + }); }, items: getCustomArea(), ): const Text(""), @@ -203,7 +200,7 @@ class _PerfectureWidgetState extends State { ) : const Text(""), //CatWidget(indexController: widget.indexController,), - widget.indexController.cats.length > 0 ? + widget.indexController.cats.isNotEmpty ? DropdownButton( value: widget.indexController.getCatText(), icon: const Icon(Icons.arrow_downward), diff --git a/pubspec.lock b/pubspec.lock index 16ea261..900cb79 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -13,34 +13,26 @@ packages: dependency: transitive description: name: archive - sha256: "793964beb8e297995714326628881437d4211f10fc8843534bab54129cd896ee" + sha256: "0c8368c9b3f0abbc193b9d6133649a614204b528982bebc7026372d61677ce3a" url: "https://pub.dev" source: hosted - version: "3.3.1" + version: "3.3.7" args: dependency: transitive description: name: args - sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515 + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.2" async: dependency: "direct main" description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" - bezier: - dependency: transitive - description: - name: bezier - sha256: "90d2a89d3a3b20522361244bafb51861210e941bd2f307c4122877d3781d1339" - url: "https://pub.dev" - source: hosted - version: "1.2.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -53,66 +45,66 @@ packages: dependency: transitive description: name: camera - sha256: "12c497020e3778f83191ccfad126dfa31106de91accba6c89cc68a0d30b41f0e" + sha256: f63f2687fb1795c36f7c57b18a03071880eabb0fd8b5291b0fcd3fb979cb0fb1 url: "https://pub.dev" source: hosted - version: "0.10.0+3" + version: "0.10.5+4" camera_android: dependency: transitive description: name: camera_android - sha256: bee8d441a307444ea90a8a2c3ea760cdec45a6908497c75559bd4142c6930256 + sha256: ed4f645848074166fc3b8e20350f83ca07e09a2becc1e185040ee561f955d4df url: "https://pub.dev" source: hosted - version: "0.10.0+3" + version: "0.10.8+8" camera_avfoundation: dependency: transitive description: name: camera_avfoundation - sha256: "43021a22067b8be6d1fc3d9559d503766a7e6ca968c189bfbf79d4ede0bc5f7c" + sha256: "718b60ed2e22b4067fe6e2c0e9ebe2856c2de5c8b1289ba95d10db85b0b00bc2" url: "https://pub.dev" source: hosted - version: "0.9.8+6" + version: "0.9.13+4" camera_camera: dependency: "direct main" description: name: camera_camera - sha256: e769c37ca6c86a2bcdbeb3fa2ec876c705a4a477f7afb7df0be3247b6ad451ae + sha256: fd2cffd6a015f588a5fef7e829ad8dff0789ccba0e9faea980d184a13b91e818 url: "https://pub.dev" source: hosted - version: "3.0.0-dev" + version: "3.0.0" camera_platform_interface: dependency: transitive description: name: camera_platform_interface - sha256: "645cef76744c79ffc82cdc158a00fb6f1ff23b3ae7dba569fe061e2ce155798a" + sha256: "8734d1c682f034bdb12d0d6ff379b0535a9b8e44266b530025bf8266d6a62f28" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.5.2" camera_web: dependency: transitive description: name: camera_web - sha256: "0c4bdd73e28affc36e7693d948bd90415e7b02bef3feea761dd18405e9485e2a" + sha256: d4c2c571c7af04f8b10702ca16bb9ed2a26e64534171e8f75c9349b2c004d8f1 url: "https://pub.dev" source: hosted - version: "0.3.0+1" + version: "0.3.2+3" characters: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: name: checked_yaml - sha256: dd007e4fb8270916820a0d66e24f619266b60773cddd082c6439341645af2659 + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.3" circular_menu: dependency: "direct main" description: @@ -125,10 +117,10 @@ packages: dependency: transitive description: name: cli_util - sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c" + sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 url: "https://pub.dev" source: hosted - version: "0.3.5" + version: "0.4.0" clock: dependency: transitive description: @@ -141,50 +133,66 @@ packages: dependency: "direct main" description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.2" connectivity_plus: dependency: "direct main" description: name: connectivity_plus - sha256: "745ebcccb1ef73768386154428a55250bc8d44059c19fd27aecda2a6dc013a22" + sha256: "77a180d6938f78ca7d2382d2240eb626c0f6a735d0bfdce227d8ffb80f95c48b" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "4.0.2" connectivity_plus_platform_interface: dependency: transitive description: name: connectivity_plus_platform_interface - sha256: b8795b9238bf83b64375f63492034cb3d8e222af4d9ce59dda085edf038fa06f + sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.2.4" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" cross_file: dependency: transitive description: name: cross_file - sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" + sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb url: "https://pub.dev" source: hosted - version: "0.3.3+4" + version: "0.3.3+5" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" dbus: dependency: transitive description: @@ -213,10 +221,10 @@ packages: dependency: transitive description: name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.0" file: dependency: transitive description: @@ -225,27 +233,43 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.4" - file_picker: + file_selector_linux: dependency: transitive description: - name: file_picker - sha256: d090ae03df98b0247b82e5928f44d1b959867049d18d73635e2e0bc3f49542b9 + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" url: "https://pub.dev" source: hosted - version: "5.2.5" + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "182c3f8350cee659f7b115e956047ee3dc672a96665883a545e81581b9a82c72" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + url: "https://pub.dev" + source: hosted + version: "0.9.3+1" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" - flutter_background: - dependency: transitive - description: - name: flutter_background - sha256: "035c31a738509d67ee70bbf174e5aa7db462c371e838ec8259700c5c4e7ca17f" - url: "https://pub.dev" - source: hosted - version: "1.2.0" flutter_breadcrumb: dependency: "direct main" description: @@ -266,18 +290,34 @@ packages: dependency: "direct main" description: name: flutter_image - sha256: fa47ea2392de894efd41026b20c166af085d03077ddb8ac6dd73eb4c23bb97ca + sha256: b41c6cbf9462d8cbdeeb7b5dd84c7bca5176e9e4d6e8b968290e371ab758cc0c url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "4.1.8" flutter_keyboard_visibility: dependency: transitive description: name: flutter_keyboard_visibility - sha256: "40d25e00e511fc7e0735d79002db28c2d4736773e5933c45bf239ad1fb80661c" + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" url: "https://pub.dev" source: hosted - version: "5.3.0" + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_keyboard_visibility_platform_interface: dependency: transitive description: @@ -294,94 +334,78 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_launcher_icons: dependency: "direct main" description: name: flutter_launcher_icons - sha256: a9de6706cd844668beac27c0aed5910fa0534832b3c2cad61a5fd977fce82a5d + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" url: "https://pub.dev" source: hosted - version: "0.10.0" + version: "0.13.1" flutter_lints: dependency: "direct dev" description: name: flutter_lints - sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 url: "https://pub.dev" source: hosted - version: "1.0.4" - flutter_local_notifications: - dependency: transitive - description: - name: flutter_local_notifications - sha256: f222919a34545931e47b06000836b5101baeffb0e6eb5a4691d2d42851740dd9 - url: "https://pub.dev" - source: hosted - version: "12.0.4" - flutter_local_notifications_linux: - dependency: transitive - description: - name: flutter_local_notifications_linux - sha256: "3c6d6db334f609a92be0c0915f40871ec56f5d2adf01e77ae364162c587c0ca8" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - flutter_local_notifications_platform_interface: - dependency: transitive - description: - name: flutter_local_notifications_platform_interface - sha256: "5ec1feac5f7f7d9266759488bc5f76416152baba9aa1b26fe572246caa00d1ab" - url: "https://pub.dev" - source: hosted - version: "6.0.0" + version: "2.0.3" flutter_map: dependency: "direct main" description: name: flutter_map - sha256: "59dfd14267b691bea55760786b47d3172d47cdcc0d79ff930746a5ad123491b8" + sha256: "52c65a977daae42f9aae6748418dd1535eaf27186e9bac9bf431843082bc75a3" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0" flutter_map_location_marker: dependency: "direct main" description: name: flutter_map_location_marker - sha256: "56989cd7de32345247c01216440c98d6a9b9d3970e2c5bb92e806bbc9384afad" + sha256: "9757dceadda71a53d2d4004cff4d53a29210086083bdfebf44a1c4feb07f8eb1" url: "https://pub.dev" source: hosted - version: "5.0.0+1" + version: "6.0.0" flutter_map_marker_cluster: dependency: "direct main" description: name: flutter_map_marker_cluster - sha256: "793e68ccdb323f0e5059eecf3f8777892a9365186ab57c07ebe82e10ad7737ef" + sha256: "362088b16311b6743a7930857129ec6c7c807ecca777fe1033c0ad6688339e36" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.1" flutter_map_marker_popup: dependency: transitive description: name: flutter_map_marker_popup - sha256: b83e11dd8611f27d02050de3f262fac8eeb888abb5e562113b3be578573914f2 + sha256: "7cf30fab25ffe1ba04a9e0fbe1227f44a83c73256d4d70be1c26cf141ce5c41d" url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.1.0" flutter_map_tile_caching: dependency: "direct main" description: name: flutter_map_tile_caching - sha256: "5ca82be70ba7c945bc18ed35a4b30701649f2c2c72e6b363f88824392c638429" + sha256: "48ab77adc7adf70ec682db737b68dd5ac804e78a2e834b951e0d9735a6923971" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "8.0.1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + sha256: f185ac890306b5779ecbd611f52502d8d4d63d27703ef73161ca0407e815f02c url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.16" flutter_polyline_points: dependency: "direct main" description: @@ -399,10 +423,10 @@ packages: dependency: "direct main" description: name: flutter_typeahead - sha256: "99e6dbb1094fe4fd40a4199c44ce110f5e232bc60ac6d3599719095ebba2923c" + sha256: a3539f7a90246b152f569029dedcf0b842532d3f2a440701b520e0bf2acbcf42 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.6.2" flutter_web_plugins: dependency: transitive description: flutter @@ -412,10 +436,10 @@ packages: dependency: transitive description: name: font_awesome_flutter - sha256: "8f0ce0204bd0cafa8631536a6f3b7d05d9c16cdc6e8bd807843f917027c5cefd" + sha256: "5fb789145cae1f4c3245c58b3f8fb287d055c26323879eab57a7bf0cfd1e45f3" url: "https://pub.dev" source: hosted - version: "10.2.1" + version: "10.5.0" geodesy: dependency: transitive description: @@ -436,34 +460,34 @@ packages: dependency: "direct main" description: name: geolocator - sha256: "672ba7193539d9092fac6c92d17692df2294c60109929ecb255cd6e52825ec4d" + sha256: "5c23f3613f50586c0bbb2b8f970240ae66b3bd992088cf60dd5ee2e6f7dde3a8" url: "https://pub.dev" source: hosted - version: "9.0.1" + version: "9.0.2" geolocator_android: dependency: transitive description: name: geolocator_android - sha256: "977d7b47150b331dad7d7c645b83e9fc52ecfd0436afb27fbf9cbee6dcd4075e" + sha256: "835ff5b4888a2f8eba128996494faf9c5d422785322a81dc0565b99e0f6c379d" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.2.2" geolocator_apple: dependency: transitive description: name: geolocator_apple - sha256: "1b17544d250bbfebd2f36157f9ce094b0b07967441c1010243d6ea04f6f5bfe8" + sha256: "36527c555f4c425f7d8fa8c7c07d67b78e3ff7590d40448051959e1860c1cfb4" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.7" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - sha256: "8c10ba5c825abdcc337ba918fbc1d3a5a2b006affe6ba610e3143cd32f54388d" + sha256: af4d69231452f9620718588f41acc4cb58312368716bfff2e92e770b46ce6386 url: "https://pub.dev" source: hosted - version: "4.0.6" + version: "4.0.7" geolocator_web: dependency: transitive description: @@ -476,10 +500,10 @@ packages: dependency: transitive description: name: geolocator_windows - sha256: f5911c88e23f48b598dd506c7c19eff0e001645bdc03bb6fecb9f4549208354d + sha256: "4f4218f122a6978d0ad655fa3541eea74c67417440b09f0657238810d5af6bdc" url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.1.3" geopoint: dependency: transitive description: @@ -500,50 +524,82 @@ packages: dependency: "direct main" description: name: google_api_availability - sha256: a1f58c5213abae549fb1e1451bc68eb499da7033039f77bc289fd6faca384295 + sha256: "3e9548cfd991d983d11425a2436d5bd957d048c279cc9e145ffe3f36fd847385" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "5.0.0" + google_api_availability_android: + dependency: transitive + description: + name: google_api_availability_android + sha256: d95429ae78083585c312de2c6578085e7d53d100a94656d691bce0bb0ce435be + url: "https://pub.dev" + source: hosted + version: "1.0.1" + google_api_availability_platform_interface: + dependency: transitive + description: + name: google_api_availability_platform_interface + sha256: "65b7da62fe5b582bb3d508628ad827d36d890710ea274766a992a56fa5420da6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" google_fonts: dependency: "direct main" description: name: google_fonts - sha256: e70521755a6b08c6bde14ddae27dff5bf21010033888fc61da6c595f8a9f58c1 + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "4.0.4" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "555d5d736339b0478e821167ac521c810d7b51c3b2734e6802a9f046b64ea37a" + url: "https://pub.dev" + source: hosted + version: "6.3.0" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - sha256: "07f81e2d26a4dd2664e3beed547c75eb24b780c5c8519cd42bc0137308a1e7f6" + sha256: d4914cb38b3dcb62c39c085d968d434de0f8050f00f4d9f5ba4a7c7e004934cb url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.5.0" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android - sha256: "7e0234029f1e2531203ea735e0bf69a0a25a6c6d62a19b7cac756f87062c8f5a" + sha256: e6cb018169e49332f88d23b1d2119b09e8ab4e7d3a1b889a1b7b3fd113e034ba url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.5.1" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - sha256: "71213e497600e0c67cf7a096f643e58a72ed36334456c32c7ae0a6b4698018df" + sha256: "2a595c9789070786c654e9772ec0d1bb759ae37d2dd776291af5398531274e06" url: "https://pub.dev" source: hosted - version: "2.1.11" + version: "2.3.1" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - sha256: "0a91acaa7ab6a438f428efe49f145a2b48f18ff039301ee2232696e18bf78784" + sha256: a3e9e6896501e566d902c6c69f010834d410ef4b7b5c18b90c77e871c86b7907 url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.4.1" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: f893d1542c6562bc8299ef768fbbe92ade83c220ab3209b9477ec9f81ad585e4 + url: "https://pub.dev" + source: hosted + version: "0.5.4+2" google_maps_webservice: dependency: "direct main" description: @@ -552,86 +608,142 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.20-nullsafety.5" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" http: dependency: transitive description: name: http - sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" url: "https://pub.dev" source: hosted - version: "0.13.5" + version: "0.13.6" + http2: + dependency: transitive + description: + name: http2 + sha256: "38db0c4aa9f1cd238a5d2e86aa0cc7cc91c77e0c6c94ba64bbe85e4ff732a952" + url: "https://pub.dev" + source: hosted + version: "2.2.0" http_parser: dependency: transitive description: name: http_parser - sha256: db3060f22889f3d9d55f6a217565486737037eec3609f7f3eca4d0c67ee0d8a0 + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.0.2" + http_plus: + dependency: transitive + description: + name: http_plus + sha256: "6e2af403727ea5bd0a6a45edbe8e1ebc9d5d49b38a93893e1c00e2a307035773" + url: "https://pub.dev" + source: hosted + version: "0.2.2" image: dependency: transitive description: name: image - sha256: "9d2c5f73435a70a936d317769ee8e7ef480e37674b9f2bce95ea98969a307855" + sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "4.0.17" image_picker: dependency: "direct main" description: name: image_picker - sha256: f3712cd190227fb92e0960cb0ce22928ba042c7183b16864ade83b259adf8ea6 + sha256: "7d7f2768df2a8b0a3cefa5ef4f84636121987d403130e70b17ef7e2cf650ba84" url: "https://pub.dev" source: hosted - version: "0.8.5+3" + version: "1.0.4" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "822f71a53336bf1e638dbf955047080ca49ba0197f52c4fece9cf584c368648a" + sha256: d32a997bcc4ee135aebca8e272b7c517927aa65a74b9c60a81a2764ef1a0462d url: "https://pub.dev" source: hosted - version: "0.8.5+3" + version: "0.8.7+5" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: "60f306ffbdcada4bc8b2691acc420258a1b758e102c87c4f94fb568d640f0e0e" + sha256: "869fe8a64771b7afbc99fc433a5f7be2fea4d1cb3d7c11a48b6b579eb9c797f0" url: "https://pub.dev" source: hosted - version: "2.1.8" + version: "2.2.0" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: "6ad501265cc47dbbf78620656edf505088fdea644c7b905a72790c3c7e92b508" + sha256: c5538cacefacac733c724be7484377923b476216ad1ead35a0d2eadcdc0fc497 url: "https://pub.dev" source: hosted - version: "0.8.6" + version: "0.8.8+2" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface - sha256: cedb2650709f066ee83fd65a1d99b6ff33e5adf98cea376426dd33c2b22bf6ad + sha256: ed9b00e63977c93b0d2d2b343685bed9c324534ba5abafbb3dfbd6a780b1b514 url: "https://pub.dev" source: hosted - version: "2.6.1" - ini: + version: "2.9.1" + image_picker_windows: dependency: transitive description: - name: ini - sha256: "12a76c53591ffdf86d1265be3f986888a6dfeb34a85957774bc65912d989a173" + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "0.2.1+1" intl: dependency: "direct main" description: name: intl - sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "0.18.1" + isar: + dependency: transitive + description: + name: isar + sha256: "99165dadb2cf2329d3140198363a7e7bff9bbd441871898a87e26914d25cf1ea" + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" + isar_flutter_libs: + dependency: transitive + description: + name: isar_flutter_libs + sha256: bc6768cc4b9c61aabff77152e7f33b4b17d2fc93134f7af1c3dd51500fe8d5e8 + url: "https://pub.dev" + source: hosted + version: "3.1.0+1" iso: dependency: transitive description: @@ -644,34 +756,42 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" + js_wrapping: + dependency: transitive + description: + name: js_wrapping + sha256: e385980f7c76a8c1c9a560dfb623b890975841542471eade630b2871d243851c + url: "https://pub.dev" + source: hosted + version: "0.7.4" json_annotation: dependency: transitive description: name: json_annotation - sha256: cb314f00b2488de7bc575207e54402cd2f92363f333a7933fd1b0631af226baa + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 url: "https://pub.dev" source: hosted - version: "4.6.0" + version: "4.8.1" latlong2: dependency: "direct main" description: name: latlong2 - sha256: "408993a0e3f46e79ce1f129e4cb0386eef6d48dfa6394939ecacfbd7049154ec" + sha256: "08ef7282ba9f76e8495e49e2dc4d653015ac929dce5f92b375a415d30b407ea0" url: "https://pub.dev" source: hosted - version: "0.8.1" + version: "0.8.2" lints: dependency: transitive description: name: lints - sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.1.1" lists: dependency: transitive description: @@ -684,42 +804,42 @@ packages: dependency: transitive description: name: logger - sha256: "5076f09225f91dc49289a4ccb92df2eeea9ea01cf7c26d49b3a1f04c6a49eec1" + sha256: "7ad7215c15420a102ec687bb320a7312afd449bac63bfb1c60d9787c27b9767f" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.4.0" matcher: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" material_design_icons_flutter: dependency: "direct main" description: name: material_design_icons_flutter - sha256: "8c54c21cf336052193559abc64715e4885d6c9220a6dbdfc561a087266cc5385" + sha256: "6f986b7a51f3ad4c00e33c5c84e8de1bdd140489bbcdc8b66fc1283dad4dea5a" url: "https://pub.dev" source: hosted - version: "5.0.6996" + version: "7.0.7296" meta: dependency: "direct main" description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" mgrs_dart: dependency: transitive description: @@ -744,14 +864,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0-pre" - move_to_background: - dependency: transitive - description: - name: move_to_background - sha256: "00caad17a6ce149910777131503f43f8ed80025681f94684e3a6a87d979b914c" - url: "https://pub.dev" - source: hosted - version: "1.0.2" nested: dependency: transitive description: @@ -772,66 +884,58 @@ packages: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_provider: dependency: "direct main" description: name: path_provider - sha256: "050e8e85e4b7fecdf2bb3682c1c64c4887a183720c802d323de8a5fd76d372dd" + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa url: "https://pub.dev" source: hosted - version: "2.0.11" + version: "2.1.1" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "4d5542667150f5b779ba411dd5dc0b674a85d1355e45bda2877e0e82f4ad08d8" + sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" url: "https://pub.dev" source: hosted - version: "2.0.20" - path_provider_ios: + version: "2.2.0" + path_provider_foundation: dependency: transitive description: - name: path_provider_ios - sha256: "03d639406f5343478352433f00d3c4394d52dac8df3d847869c5e2333e0bbce8" + name: path_provider_foundation + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" url: "https://pub.dev" source: hosted - version: "2.0.11" + version: "2.3.1" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.1.7" - path_provider_macos: - dependency: transitive - description: - name: path_provider_macos - sha256: "2a97e7fbb7ae9dcd0dfc1220a78e9ec3e71da691912e617e8715ff2a13086ae8" - url: "https://pub.dev" - source: hosted - version: "2.0.6" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "27dc7a224fcd07444cb5e0e60423ccacea3e13cf00fc5282ac2c918132da931d" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.2.1" pedantic: dependency: transitive description: @@ -844,66 +948,82 @@ packages: dependency: "direct main" description: name: permission_handler - sha256: ae51809c535fd765061c7384a67bc24d304d24cfc455c59e2f6a5cec9a37fc9c + sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.4.3" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: "692e5dd690cd9e978e1cefa67d97bddd3a7f4748ddac6cd8bbd1a354a6a1869f" + sha256: d74e77a5ecd38649905db0a7d05ef16bed42ff263b9efb73ed794317c5764ec3 url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.3.4" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: "6367799be76d1fe70ffe2df7f025abfe28818b450f550621778995badbebf519" + sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" url: "https://pub.dev" source: hosted - version: "9.0.4" + version: "9.1.4" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: ca16451bfdc6d26693d10b37b2d81370bdf3f0318422f3eecfd6004f5bd7d21f + sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9" url: "https://pub.dev" source: hosted - version: "3.7.0" + version: "3.11.3" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - sha256: "40ad5ab4d3c65d75c7f3a069065c77503aae19a1cf01ba246d43489e14f1b90c" + sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 url: "https://pub.dev" source: hosted - version: "0.1.0" + version: "0.1.3" petitparser: dependency: transitive description: name: petitparser - sha256: "2ebb289dc4764ec397f5cd3ca9881c6d17196130a7d646ed022a0dd9c2e25a71" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.4.0" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.2" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "075f927ebbab4262ace8d0b283929ac5410c0ac4e7fc123c76429564facfb757" + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.6" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: "7626e034489820fd599380d2bb4d3f4a0a5e3529370b62bfce53ab736b91adb2" + url: "https://pub.dev" + source: hosted + version: "0.9.3+6" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + url: "https://pub.dev" + source: hosted + version: "3.7.3" polylabel: dependency: transitive description: @@ -912,16 +1032,8 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - positioned_tap_detector: - dependency: "direct main" - description: - name: positioned_tap_detector - sha256: a2e6b0466acfa34ded2d7f4b4ce34d81bac201335f67628bab49a758cc4b94c1 - url: "https://pub.dev" - source: hosted - version: "1.0.3" positioned_tap_detector_2: - dependency: transitive + dependency: "direct main" description: name: positioned_tap_detector_2 sha256: "52e06863ad3e1f82b058fd05054fc8c9caeeb3b47d5cea7a24bd9320746059c1" @@ -964,90 +1076,82 @@ packages: dependency: transitive description: name: quiver - sha256: "93982981971e812c94d4a6fa3a57b89f9ec12b38b6380cd3c1370c3b01e4580e" + sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.1" rename: dependency: "direct main" description: name: rename - sha256: "2e3f2800712e00c66fee8eb6285d290c418e99fe3f69ca794d9fa09654bb005e" + sha256: b0d9407186d834ad73aba9938da95a20208c4be99f151d9f376ac62a08d08bad url: "https://pub.dev" source: hosted - version: "2.0.1" - share_plus: + version: "2.1.1" + sanitize_html: dependency: transitive description: - name: share_plus - sha256: f36abf36434577a6192d3829e4d2cf954f438be7021394135b537411567dcb73 + name: sanitize_html + sha256: "0a445f19bbaa196f5a4f93461aa066b94e6e025622eb1e9bc77872a5e25233a5" url: "https://pub.dev" source: hosted - version: "6.1.0" - share_plus_platform_interface: - dependency: transitive - description: - name: share_plus_platform_interface - sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1" - url: "https://pub.dev" - source: hosted - version: "3.2.0" + version: "2.0.0" shared_preferences: dependency: "direct main" description: name: shared_preferences - sha256: ee6257848f822b8481691f20c3e6d2bfee2e9eccb2a3d249907fcfb198c55b41 + sha256: b7f41bad7e521d205998772545de63ff4e6c97714775902c199353f8bf1511ac url: "https://pub.dev" source: hosted - version: "2.0.18" + version: "2.2.1" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: ad423a80fe7b4e48b50d6111b3ea1027af0e959e49d485712e134863d9c1c521 + sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.2.1" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "1e755f8583229f185cfca61b1d80fb2344c9d660e1c69ede5450d8f478fa5310" + sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.3.4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "3a59ed10890a8409ad0faad7bb2957dab4b92b8fbe553257b05d30ed8af2c707" + sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.3.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "824bfd02713e37603b2bdade0842e47d56e7db32b1dcdd1cae533fb88e2913fc" + sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "0dc2633f215a3d4aa3184c9b2c5766f4711e4e5a6b256e62aafee41f89f1bfb8" + sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.2.1" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "71bcd669bb9cdb6b39f22c4a7728b6d49e934f6cba73157ffa5a54f1eed67436" + sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.3.1" sky_engine: dependency: transitive description: flutter @@ -1065,26 +1169,26 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" sqflite: dependency: "direct main" description: name: sqflite - sha256: b3a8307b9519af28518e271e548594bdc435225fc77e8fb22e71a296c69281cf + sha256: "591f1602816e9c31377d5f008c2d9ef7b8aca8941c3f89cc5fd9d84da0c38a9a" url: "https://pub.dev" source: hosted - version: "2.0.3+1" + version: "2.3.0" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: b504fc5b4576a05586a0bb99d9bcc0d37a78d9d5ed68b96c361d5d3a8e538275 + sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" url: "https://pub.dev" source: hosted - version: "2.2.1+1" + version: "2.5.0" stack_trace: dependency: transitive description: @@ -1105,10 +1209,10 @@ packages: dependency: transitive description: name: stream_transform - sha256: ed464977cb26a1f41537e177e190c67223dbd9f4f683489b6ab2e5d211ec564e + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: @@ -1121,10 +1225,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "7b530acd9cb7c71b0019a1e7fa22c4105e675557a4400b6a401c71c5e0ade1ac" + sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" url: "https://pub.dev" source: hosted - version: "3.0.0+3" + version: "3.1.0" term_glyph: dependency: transitive description: @@ -1137,10 +1241,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.6.0" timeline_tile: dependency: "direct main" description: @@ -1149,38 +1253,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" - timezone: - dependency: transitive - description: - name: timezone - sha256: "24c8fcdd49a805d95777a39064862133ff816ebfffe0ceff110fb5960e557964" - url: "https://pub.dev" - source: hosted - version: "0.9.1" transparent_image: dependency: "direct main" description: name: transparent_image - sha256: e566a616922a781489f4d91cc939b1b3203b6e4a093317805f2f82f0bb0f8dec + sha256: e8991d955a2094e197ca24c645efec2faf4285772a4746126ca12875e54ca02f url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" tuple: dependency: "direct main" description: name: tuple - sha256: fe3ae4f0dca3f9aac0888e2e0d117b642ce283a82d7017b54136290c0a3b0dd3 + sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" unicode: dependency: transitive description: @@ -1193,66 +1289,66 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "4f0d5f9bf7efba3da5a7ff03bd33cc898c84bac978c068e1c94483828e709592" + sha256: "47e208a6711459d813ba18af120d9663c20bdf6985d6ad39fe165d2538378d27" url: "https://pub.dev" source: hosted - version: "6.1.5" + version: "6.1.14" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "9e262cbec69233717d5198f4d0b0c4961fa027e3685ba425442c43c64f38bb9b" + sha256: b04af59516ab45762b2ca6da40fa830d72d0f6045cd97744450b73493fa76330 url: "https://pub.dev" source: hosted - version: "6.0.19" + version: "6.1.0" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "6ba7dddee26c9fae27c9203c424631109d73c8fa26cfa7bc3e35e751cb87f62e" + sha256: "7c65021d5dee51813d652357bc65b8dd4a6177082a9966bc8ba6ee477baa795f" url: "https://pub.dev" source: hosted - version: "6.0.17" + version: "6.1.5" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "360fa359ab06bcb4f7c5cd3123a2a9a4d3364d4575d27c4b33468bd4497dd094" + sha256: b651aad005e0cb06a01dbd84b428a301916dc75f0e7ea6165f80057fee2d8e8e url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.6" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: a9b3ea9043eabfaadfa3fb89de67a11210d85569086d22b3854484beab8b3978 + sha256: b55486791f666e62e0e8ff825e58a023fd6b1f71c49926483f1128d3bbd8fe88 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.7" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "80b860b31a11ebbcbe51b8fe887efc204f3af91522f3b51bcda4622d276d2120" + sha256: "95465b39f83bfe95fcb9d174829d6476216f2d548b79c38ab2506e0458787618" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.5" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "5669882643b96bb6d5786637cac727c6e918a790053b09245fd4513b8a07df2a" + sha256: "2942294a500b4fa0b918685aff406773ba0a4cd34b7f42198742a94083020ce5" url: "https://pub.dev" source: hosted - version: "2.0.13" + version: "2.0.20" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: e3c3b16d3104260c10eea3b0e34272aaa57921f83148b0619f74c2eced9b7ef1 + sha256: "95fef3129dc7cfaba2bc3d5ba2e16063bb561fc6d78e63eee16162bc70029069" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.8" uuid: dependency: transitive description: @@ -1273,18 +1369,26 @@ packages: dependency: transitive description: name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" win32: dependency: transitive description: name: win32 - sha256: "1952a663c0e34fbde55916010d54bbb249bf5f2583113c497602f0ee01c6faa4" + sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.4" wkt_parser: dependency: transitive description: @@ -1297,26 +1401,26 @@ packages: dependency: transitive description: name: xdg_directories - sha256: "11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f" + sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 url: "https://pub.dev" source: hosted - version: "0.2.0+2" + version: "0.2.0+3" xml: dependency: transitive description: name: xml - sha256: ac0e3f4bf00ba2708c33fbabbbe766300e509f8c82dbd4ab6525039813f7e2fb + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "6.3.0" yaml: dependency: transitive description: name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: - dart: ">=2.18.0 <3.0.0" - flutter: ">=3.7.0" + dart: ">=3.1.0 <4.0.0" + flutter: ">=3.13.0" diff --git a/pubspec.yaml b/pubspec.yaml index 4fa69e3..1e2b743 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.12+12 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. # To automatically upgrade your package dependencies to the latest versions @@ -39,10 +39,10 @@ dependencies: flutter_map: any geolocator: ^9.0.1 permission_handler: ^10.0.0 - google_api_availability: ^3.0.1 + google_api_availability: ^5.0.0 tuple: ^2.0.0 latlong2: ^0.8.1 - positioned_tap_detector: ^1.0.3 + positioned_tap_detector_2: ^1.0.4 transparent_image: ^2.0.0 async: ^2.8.2 vector_math: ^2.1.1 @@ -53,27 +53,27 @@ dependencies: path_provider: ^2.0.8 flutter_map_location_marker: any flutter_map_marker_cluster: any - material_design_icons_flutter: ^5.0.6595 - google_fonts: ^2.1.1 - image_picker: ^0.8.4+4 + material_design_icons_flutter: ^7.0.7296 + google_fonts: ^4.0.4 + image_picker: ^1.0.4 #geojson_vi: ^2.0.7 geojson: ^1.0.0 url_launcher: ^6.0.20 flutter_breadcrumb: ^1.0.1 timeline_tile: ^2.0.0 - google_maps_flutter: ^2.1.5 + google_maps_flutter: ^2.5.0 #flutter_map_marker_popup: any flutter_polyline_points: ^1.0.0 google_maps_webservice: ^0.0.19 flutter_typeahead: ^4.0.0 - flutter_launcher_icons: ^0.10.0 + flutter_launcher_icons: ^0.13.1 rename: ^2.0.1 circular_menu: ^2.0.1 camera_camera: ^3.0.0-dev - intl: ^0.17.0 + intl: ^0.18.1 modal_bottom_sheet: ^3.0.0-pre - connectivity_plus: ^3.0.2 - flutter_map_tile_caching: ^6.2.0 + connectivity_plus: ^4.0.2 + flutter_map_tile_caching: ^8.0.1 shared_preferences: ^2.0.15 flutter_icons: @@ -91,7 +91,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # 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 # following page: https://dart.dev/tools/pub/pubspec diff --git a/test/widget_test.dart b/test/widget_test.dart index 5b12e0c..34192c2 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -13,7 +13,7 @@ import 'package:rogapp/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget( MyApp()); + await tester.pumpWidget( const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index bf5dc77..bc61c87 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,20 +7,23 @@ #include "generated_plugin_registrant.h" #include +#include #include +#include #include -#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); GeolocatorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("GeolocatorWindows")); + IsarFlutterLibsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin")); PermissionHandlerWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); - SharePlusWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 17df843..1834cc0 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,9 +4,10 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus + file_selector_windows geolocator_windows + isar_flutter_libs permission_handler_windows - share_plus url_launcher_windows )