Compare commits
100 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| accd0cad43 | |||
| 7e6b5f887a | |||
| dd36ab8399 | |||
| b37a33bc2f | |||
| e35608651b | |||
| c6eb97bbb2 | |||
| cb3a843566 | |||
| f5922d9034 | |||
| 1414d370f4 | |||
| e30c5f255c | |||
| e6a7d37519 | |||
| 2f329669e9 | |||
| 773650be82 | |||
| cd258744fc | |||
| eaee1ce820 | |||
| d7ff309c09 | |||
| d55ba7cfdb | |||
| 992f9f3414 | |||
| c3cb6d758c | |||
| cfa9e055f5 | |||
| 494b27bf9e | |||
| eda5f77e2d | |||
| b9e4df069f | |||
| 2fb095bd50 | |||
| 591b6f7aed | |||
| 8e050267e1 | |||
| c95cb75934 | |||
| 0b5ce75d6c | |||
| c67914f286 | |||
| 9145e0e27d | |||
| 445c53d21b | |||
| 56c07852f9 | |||
| fa0587178f | |||
| 8d1c84d9fb | |||
| 0af1b3139c | |||
| 6f084b2349 | |||
| 44cb728fab | |||
| 13e07b007a | |||
| 9c66dffe69 | |||
| d8fd352a62 | |||
| 23fde37e3d | |||
| 4e4cfda40b | |||
| 8a1e5b1ca8 | |||
| acc03f8e2b | |||
| 3abd306e89 | |||
| 4648b0424d | |||
| b04985b71f | |||
| 954ff36640 | |||
| 85b8c4705f | |||
| e8d65ba725 | |||
| 32ae1f5249 | |||
| 7a154b4390 | |||
| 7412d1e074 | |||
| 0508c50b97 | |||
| 0e2a8f89f3 | |||
| 7fdb6c05ee | |||
| 4db56e9c0f | |||
| 0ca29a5293 | |||
| 93dacc35ae | |||
| 167a321cd5 | |||
| 67c3a46cd5 | |||
| 63a86d75d6 | |||
| f760294a39 | |||
| a2b055fe8b | |||
| 14c8cb6f70 | |||
| cac0c1065f | |||
| 15c70acf7b | |||
| b54c29eb4b | |||
| aa7b13b76a | |||
| 30fea7cf8a | |||
| f64ac1ccfd | |||
| 48f4b833f6 | |||
| d67d17e971 | |||
| c2d9e366d1 | |||
| 6f3249631f | |||
| 720dd149a9 | |||
| 44a3fc21fb | |||
| 36751f6ef7 | |||
| 7b33468e3f | |||
| 0f3bf2c2c7 | |||
| 3f157d7ddf | |||
| 2ab96cc3d0 | |||
| 68bf3e9ab3 | |||
| ed892b915b | |||
| 75770c9f16 | |||
| 83ecc0ec8f | |||
| 9154798448 | |||
| 7a9adf8f06 | |||
| c756c4a5be | |||
| 547891437b | |||
| 4437b5368a | |||
| c0c739046a | |||
| b0a91e301e | |||
| b3a9e35f76 | |||
| 0c0234ad3c | |||
| 8e57515eaf | |||
| 64857d8a8b | |||
| bfb238323b | |||
| 3e06c4cd7f | |||
| 6c8ac75b19 |
@ -56,7 +56,7 @@ android {
|
|||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "com.dvox.gifunavi"
|
applicationId "com.dvox.gifunavi"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion 33
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<application
|
<application
|
||||||
android:label="岐阜ナビ"
|
android:label="岐阜ナビ"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.dvox.rog_app
|
||||||
|
|
||||||
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
class MainActivity: FlutterActivity() {
|
||||||
|
}
|
||||||
@ -1,31 +1,31 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.6.10'
|
ext.kotlin_version = '1.7.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.buildDir = '../build'
|
rootProject.buildDir = '../build'
|
||||||
subprojects {
|
subprojects {
|
||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
subprojects {
|
subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||||
|
|||||||
BIN
assets/images/money.png
Normal file
BIN
assets/images/money.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
@ -21,6 +21,6 @@
|
|||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
<key>MinimumOSVersion</key>
|
<key>MinimumOSVersion</key>
|
||||||
<string>11.0</string>
|
<string>12.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# Uncomment this line to define a global platform for your project
|
# 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.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|||||||
137
ios/Podfile.lock
137
ios/Podfile.lock
@ -4,175 +4,112 @@ PODS:
|
|||||||
- connectivity_plus (0.0.1):
|
- connectivity_plus (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
- DKImagePickerController/Core (4.3.4):
|
|
||||||
- DKImagePickerController/ImageDataManager
|
|
||||||
- DKImagePickerController/Resource
|
|
||||||
- DKImagePickerController/ImageDataManager (4.3.4)
|
|
||||||
- DKImagePickerController/PhotoGallery (4.3.4):
|
|
||||||
- DKImagePickerController/Core
|
|
||||||
- DKPhotoGallery
|
|
||||||
- DKImagePickerController/Resource (4.3.4)
|
|
||||||
- DKPhotoGallery (0.0.17):
|
|
||||||
- DKPhotoGallery/Core (= 0.0.17)
|
|
||||||
- DKPhotoGallery/Model (= 0.0.17)
|
|
||||||
- DKPhotoGallery/Preview (= 0.0.17)
|
|
||||||
- DKPhotoGallery/Resource (= 0.0.17)
|
|
||||||
- SDWebImage
|
|
||||||
- SwiftyGif
|
|
||||||
- DKPhotoGallery/Core (0.0.17):
|
|
||||||
- DKPhotoGallery/Model
|
|
||||||
- DKPhotoGallery/Preview
|
|
||||||
- SDWebImage
|
|
||||||
- SwiftyGif
|
|
||||||
- DKPhotoGallery/Model (0.0.17):
|
|
||||||
- SDWebImage
|
|
||||||
- SwiftyGif
|
|
||||||
- DKPhotoGallery/Preview (0.0.17):
|
|
||||||
- DKPhotoGallery/Model
|
|
||||||
- DKPhotoGallery/Resource
|
|
||||||
- SDWebImage
|
|
||||||
- SwiftyGif
|
|
||||||
- DKPhotoGallery/Resource (0.0.17):
|
|
||||||
- SDWebImage
|
|
||||||
- SwiftyGif
|
|
||||||
- file_picker (0.0.1):
|
|
||||||
- DKImagePickerController/PhotoGallery
|
|
||||||
- Flutter
|
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_compass (0.0.1):
|
- flutter_compass (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_keyboard_visibility (0.0.1):
|
- flutter_keyboard_visibility (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- flutter_local_notifications (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- FMDB (2.7.5):
|
- FMDB (2.7.5):
|
||||||
- FMDB/standard (= 2.7.5)
|
- FMDB/standard (= 2.7.5)
|
||||||
- FMDB/standard (2.7.5)
|
- FMDB/standard (2.7.5)
|
||||||
- geolocator_apple (1.2.0):
|
- geolocator_apple (1.2.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- google_maps_flutter_ios (0.0.1):
|
- image_gallery_saver (2.0.2):
|
||||||
- Flutter
|
- Flutter
|
||||||
- GoogleMaps
|
|
||||||
- GoogleMaps (4.1.0):
|
|
||||||
- GoogleMaps/Maps (= 4.1.0)
|
|
||||||
- GoogleMaps/Base (4.1.0)
|
|
||||||
- GoogleMaps/Maps (4.1.0):
|
|
||||||
- GoogleMaps/Base
|
|
||||||
- image_picker_ios (0.0.1):
|
- image_picker_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- move_to_background (0.0.1):
|
- isar_flutter_libs (1.0.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- path_provider_ios (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- permission_handler_apple (9.0.4):
|
- FlutterMacOS
|
||||||
|
- permission_handler_apple (9.3.0):
|
||||||
|
- Flutter
|
||||||
|
- pointer_interceptor_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- ReachabilitySwift (5.0.0)
|
- ReachabilitySwift (5.0.0)
|
||||||
- SDWebImage (5.15.5):
|
|
||||||
- SDWebImage/Core (= 5.15.5)
|
|
||||||
- SDWebImage/Core (5.15.5)
|
|
||||||
- share_plus (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
- shared_preferences_foundation (0.0.1):
|
- shared_preferences_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- sqflite (0.0.2):
|
- sqflite (0.0.3):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FMDB (>= 2.7.5)
|
- FMDB (>= 2.7.5)
|
||||||
- SwiftyGif (5.4.4)
|
|
||||||
- url_launcher_ios (0.0.1):
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
||||||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
|
||||||
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
|
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
|
||||||
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
|
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
|
||||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||||
- move_to_background (from `.symlinks/plugins/move_to_background/ios`)
|
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
|
||||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
- pointer_interceptor_ios (from `.symlinks/plugins/pointer_interceptor_ios/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`)
|
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
- DKImagePickerController
|
|
||||||
- DKPhotoGallery
|
|
||||||
- FMDB
|
- FMDB
|
||||||
- GoogleMaps
|
|
||||||
- ReachabilitySwift
|
- ReachabilitySwift
|
||||||
- SDWebImage
|
|
||||||
- SwiftyGif
|
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
camera_avfoundation:
|
camera_avfoundation:
|
||||||
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
||||||
connectivity_plus:
|
connectivity_plus:
|
||||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||||
file_picker:
|
|
||||||
:path: ".symlinks/plugins/file_picker/ios"
|
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_compass:
|
flutter_compass:
|
||||||
:path: ".symlinks/plugins/flutter_compass/ios"
|
:path: ".symlinks/plugins/flutter_compass/ios"
|
||||||
flutter_keyboard_visibility:
|
flutter_keyboard_visibility:
|
||||||
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||||
flutter_local_notifications:
|
|
||||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
|
||||||
geolocator_apple:
|
geolocator_apple:
|
||||||
:path: ".symlinks/plugins/geolocator_apple/ios"
|
:path: ".symlinks/plugins/geolocator_apple/ios"
|
||||||
google_maps_flutter_ios:
|
image_gallery_saver:
|
||||||
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
|
:path: ".symlinks/plugins/image_gallery_saver/ios"
|
||||||
image_picker_ios:
|
image_picker_ios:
|
||||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||||
move_to_background:
|
isar_flutter_libs:
|
||||||
:path: ".symlinks/plugins/move_to_background/ios"
|
:path: ".symlinks/plugins/isar_flutter_libs/ios"
|
||||||
path_provider_ios:
|
path_provider_foundation:
|
||||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||||
share_plus:
|
pointer_interceptor_ios:
|
||||||
:path: ".symlinks/plugins/share_plus/ios"
|
:path: ".symlinks/plugins/pointer_interceptor_ios/ios"
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
|
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||||
sqflite:
|
sqflite:
|
||||||
:path: ".symlinks/plugins/sqflite/ios"
|
:path: ".symlinks/plugins/sqflite/ios"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9
|
camera_avfoundation: 759172d1a77ae7be0de08fc104cfb79738b8a59e
|
||||||
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
|
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
|
||||||
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
|
||||||
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
|
||||||
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
|
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
|
||||||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||||
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
|
|
||||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||||
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
|
geolocator_apple: 9157311f654584b9bb72686c55fc02a97b73f461
|
||||||
google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9
|
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
|
||||||
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
|
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
|
||||||
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
|
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
|
||||||
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d
|
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
|
||||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
|
pointer_interceptor_ios: 9280618c0b2eeb80081a343924aa8ad756c21375
|
||||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||||
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
|
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
||||||
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
|
||||||
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
|
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
|
||||||
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
|
||||||
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
|
|
||||||
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
|
||||||
|
|
||||||
PODFILE CHECKSUM: a1c2f8dde3796ecc1697a15e7c75eb5205d8a740
|
PODFILE CHECKSUM: 7a34d5e980f9e05ecf4e24c79da64ca020615638
|
||||||
|
|
||||||
COCOAPODS: 1.12.0
|
COCOAPODS: 1.15.2
|
||||||
|
|||||||
@ -7,13 +7,13 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
084EA8A81CF8B34528999293 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D7C4F924DD034151EFC15038 /* Pods_Runner.framework */; };
|
||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||||
EAFC0FFB27C8DC9071E67D5D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 853FC5087A11FEE54BE443C8 /* Pods_Runner.framework */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
@ -30,14 +30,14 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
13E5CD9612AF4CC8B90A74C3 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
|
||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
|
37AC108B2188F1C5AA1C2C9E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
|
4310B59AA1289CC3AE4DBA82 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
853FC5087A11FEE54BE443C8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@ -45,8 +45,8 @@
|
|||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
BEC4F75C6B655CA90D5B5E18 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
D464128FC0D5DAEBC1011C26 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
F1D3FD8F51C2EAF6C3A7EE25 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
D7C4F924DD034151EFC15038 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -54,7 +54,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
EAFC0FFB27C8DC9071E67D5D /* Pods_Runner.framework in Frameworks */,
|
084EA8A81CF8B34528999293 /* Pods_Runner.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -64,9 +64,9 @@
|
|||||||
6C3C11D7BE49E5BED7989712 /* Pods */ = {
|
6C3C11D7BE49E5BED7989712 /* Pods */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
BEC4F75C6B655CA90D5B5E18 /* Pods-Runner.debug.xcconfig */,
|
4310B59AA1289CC3AE4DBA82 /* Pods-Runner.debug.xcconfig */,
|
||||||
13E5CD9612AF4CC8B90A74C3 /* Pods-Runner.release.xcconfig */,
|
37AC108B2188F1C5AA1C2C9E /* Pods-Runner.release.xcconfig */,
|
||||||
F1D3FD8F51C2EAF6C3A7EE25 /* Pods-Runner.profile.xcconfig */,
|
D464128FC0D5DAEBC1011C26 /* Pods-Runner.profile.xcconfig */,
|
||||||
);
|
);
|
||||||
path = Pods;
|
path = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -89,7 +89,7 @@
|
|||||||
97C146F01CF9000F007C117D /* Runner */,
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
97C146EF1CF9000F007C117D /* Products */,
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
6C3C11D7BE49E5BED7989712 /* Pods */,
|
6C3C11D7BE49E5BED7989712 /* Pods */,
|
||||||
E6F2437A5B5AAF08D2998197 /* Frameworks */,
|
D3D7A1CBA3FB0154A6C84903 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@ -116,10 +116,10 @@
|
|||||||
path = Runner;
|
path = Runner;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
E6F2437A5B5AAF08D2998197 /* Frameworks */ = {
|
D3D7A1CBA3FB0154A6C84903 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
853FC5087A11FEE54BE443C8 /* Pods_Runner.framework */,
|
D7C4F924DD034151EFC15038 /* Pods_Runner.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -131,15 +131,15 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
6B25D2836FC6A82461E36025 /* [CP] Check Pods Manifest.lock */,
|
9ACF47601C5E8A391157E87A /* [CP] Check Pods Manifest.lock */,
|
||||||
9740EEB61CF901F6004384FC /* Run Script */,
|
9740EEB61CF901F6004384FC /* Run Script */,
|
||||||
97C146EA1CF9000F007C117D /* Sources */,
|
97C146EA1CF9000F007C117D /* Sources */,
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
ED4E40E6FE1C0A73CAC736F8 /* [CP] Embed Pods Frameworks */,
|
CD1CB185AC38B6B245F9A672 /* [CP] Embed Pods Frameworks */,
|
||||||
FE7C2E909403F98AB3140FE6 /* [CP] Copy Pods Resources */,
|
4D62FB08D65E9D3D4D84B418 /* [CP] Copy Pods Resources */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@ -156,7 +156,7 @@
|
|||||||
97C146E61CF9000F007C117D /* Project object */ = {
|
97C146E61CF9000F007C117D /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastUpgradeCheck = 1300;
|
LastUpgradeCheck = 1430;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
97C146ED1CF9000F007C117D = {
|
97C146ED1CF9000F007C117D = {
|
||||||
@ -214,7 +214,39 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||||
};
|
};
|
||||||
6B25D2836FC6A82461E36025 /* [CP] Check Pods Manifest.lock */ = {
|
4D62FB08D65E9D3D4D84B418 /* [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;
|
||||||
|
};
|
||||||
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "Run Script";
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||||
|
};
|
||||||
|
9ACF47601C5E8A391157E87A /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
@ -236,22 +268,7 @@
|
|||||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
CD1CB185AC38B6B245F9A672 /* [CP] Embed Pods Frameworks */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
|
||||||
alwaysOutOfDate = 1;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
inputPaths = (
|
|
||||||
);
|
|
||||||
name = "Run Script";
|
|
||||||
outputPaths = (
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
shellPath = /bin/sh;
|
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
|
||||||
};
|
|
||||||
ED4E40E6FE1C0A73CAC736F8 /* [CP] Embed Pods Frameworks */ = {
|
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
@ -268,23 +285,6 @@
|
|||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
showEnvVarsInLog = 0;
|
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 */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
@ -360,8 +360,9 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
@ -375,16 +376,25 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
DEVELOPMENT_TEAM = D5SL68ATB9;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 453;
|
||||||
|
DEVELOPMENT_TEAM = UMNEWT25JR;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
|
FLUTTER_BUILD_NAME = 4.5.0;
|
||||||
|
FLUTTER_BUILD_NUMBER = 453;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = "岐阜ナビ";
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.healthcare-fitness";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 4.5.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.dvox.gifunavi;
|
PRODUCT_BUNDLE_IDENTIFIER = com.dvox.gifunavi;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
@ -438,7 +448,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
@ -487,8 +497,9 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
@ -504,16 +515,25 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
DEVELOPMENT_TEAM = D5SL68ATB9;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 453;
|
||||||
|
DEVELOPMENT_TEAM = UMNEWT25JR;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
|
FLUTTER_BUILD_NAME = 4.5.0;
|
||||||
|
FLUTTER_BUILD_NUMBER = 453;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = "岐阜ナビ";
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.healthcare-fitness";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 4.5.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.dvox.gifunavi;
|
PRODUCT_BUNDLE_IDENTIFIER = com.dvox.gifunavi;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@ -527,16 +547,25 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
DEVELOPMENT_TEAM = D5SL68ATB9;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 453;
|
||||||
|
DEVELOPMENT_TEAM = UMNEWT25JR;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
|
FLUTTER_BUILD_NAME = 4.5.0;
|
||||||
|
FLUTTER_BUILD_NUMBER = 453;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
|
INFOPLIST_KEY_CFBundleDisplayName = "岐阜ナビ";
|
||||||
|
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.healthcare-fitness";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
|
MARKETING_VERSION = 4.5.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.dvox.gifunavi;
|
PRODUCT_BUNDLE_IDENTIFIER = com.dvox.gifunavi;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1300"
|
LastUpgradeVersion = "1430"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
import Flutter
|
import Flutter
|
||||||
import GoogleMaps
|
|
||||||
|
|
||||||
@UIApplicationMain
|
@UIApplicationMain
|
||||||
@objc class AppDelegate: FlutterAppDelegate {
|
@objc class AppDelegate: FlutterAppDelegate {
|
||||||
@ -8,7 +7,6 @@ import GoogleMaps
|
|||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||||
) -> Bool {
|
) -> Bool {
|
||||||
GMSServices.provideAPIKey("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE")
|
|
||||||
GeneratedPluginRegistrant.register(with: self)
|
GeneratedPluginRegistrant.register(with: self)
|
||||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,25 +27,25 @@
|
|||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>写真撮影のためカメラにアクセスします</string>
|
<string>「岐阜ナビは旅のさまざまなチェックポイントで写真を撮影して共有するためにカメラへのアクセスが必要です。これにより、訪問を確認し、体験を向上させることができます。」</string>
|
||||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||||
<string>このアプリでは、位置情報の収集を行います。</string>
|
<string>「岐阜ナビはアプリが閉じられているときでも位置情報へのアクセスが必要です。これにより、チェックポイントでの自動チェックインを提供し、旅の間のナビゲーション体験を向上させます。」</string>
|
||||||
<key>NSLocationAlwaysUsageDescription</key>
|
<key>NSLocationAlwaysUsageDescription</key>
|
||||||
<string>このアプリでは、バックグラウンドで位置情報を収集します。</string>
|
<string>「自動チェックインを有効にし、ナビゲーションを改善するために、岐阜ナビはアプリが使用されていないときでも継続的に位置情報へのアクセスを必要とします。」</string>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string>このアプリでは、開始時点で位置情報を収集します。</string>
|
<string>「岐阜ナビにアプリ使用中の位置情報へのアクセスを許可することで、チェックポイントでのチェックインを有効にし、位置に基づいた情報とガイダンスを提供します。」</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<string>プロフィールに動画を投稿してください。</string>
|
<string>「岐阜ナビは、ナビゲーション体験を向上させるために、音声コマンドやオーディオフィードバックなどの機能にマイクへのアクセスが必要です。」</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>写真ライブラリへのアクセス警告</string>
|
<string>「岐阜ナビはチェックポイントで撮影した写真を保存・管理し、他人と旅の様子を共有するために、写真ライブラリへのアクセスが必要です。」</string>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>Need to save image in phone Album</string>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIMainStoryboardFile</key>
|
<key>UIMainStoryboardFile</key>
|
||||||
<string>Main</string>
|
<string>Main</string>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>ロゲイニングのゴールでは写真撮影が必要です。</string>
|
<string>「岐阜ナビはチェックポイントで撮影した写真を写真ライブラリに保存し、あなたの旅行の記録を保持し、友人と共有することができます。」</string>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
|
||||||
<string> 収録音声の保存が必要です。</string>
|
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
@ -65,5 +65,7 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>FLTEnableImpeller</key>
|
||||||
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
12
ios/RunnerTests/RunnerTests.swift
Normal file
12
ios/RunnerTests/RunnerTests.swift
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import Flutter
|
||||||
|
import UIKit
|
||||||
|
import XCTest
|
||||||
|
|
||||||
|
class RunnerTests: XCTestCase {
|
||||||
|
|
||||||
|
func testExample() {
|
||||||
|
// If you add code to the Runner application, consider adding tests here.
|
||||||
|
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:rogapp/common/state/game/game_controller.dart';
|
|
||||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
|
||||||
|
|
||||||
class GameBinding extends Bindings{
|
|
||||||
@override
|
|
||||||
void dependencies() {
|
|
||||||
Get.lazyPut<AuthController>(() => AuthController());
|
|
||||||
Get.put<GameController>(GameController());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:rogapp/model/user.dart';
|
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
|
||||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
|
||||||
|
|
||||||
class GameController extends GetxController{
|
|
||||||
|
|
||||||
AuthController authController = Get.find<AuthController>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
ever(authController.authList, changeInAuth);
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void changeInAuth(List<AuthResponse> change){
|
|
||||||
if(change.isNotEmpty){
|
|
||||||
Get.toNamed(AppPages.S_HOME);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Get.toNamed(AppPages.S_LOGIN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rogapp/theme/theme.dart';
|
|
||||||
|
|
||||||
class UIs{
|
|
||||||
static AppBar appBar(){
|
|
||||||
return AppBar(
|
|
||||||
title: const Icon(
|
|
||||||
Icons.access_alarm,
|
|
||||||
size:30,
|
|
||||||
color: Pallete.WHITE_COLOR,
|
|
||||||
),
|
|
||||||
automaticallyImplyLeading:false,
|
|
||||||
centerTitle: true,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
200
lib/main.dart
200
lib/main.dart
@ -1,45 +1,125 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
|
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
|
||||||
import 'package:rogapp/common/state/game/game_binding.dart';
|
|
||||||
import 'package:rogapp/pages/index/index_binding.dart';
|
import 'package:rogapp/pages/index/index_binding.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
import 'package:rogapp/theme/theme.dart';
|
import 'package:rogapp/utils/location_controller.dart';
|
||||||
import 'package:rogapp/utils/string_values.dart';
|
import 'package:rogapp/utils/string_values.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:path/path.dart' as p;
|
// import 'package:is_lock_screen/is_lock_screen.dart';
|
||||||
|
|
||||||
void main() async {
|
void saveGameState() async {
|
||||||
|
DestinationController destinationController =
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
Get.find<DestinationController>();
|
||||||
|
SharedPreferences pref = await SharedPreferences.getInstance();
|
||||||
FlutterMapTileCaching.initialise(await RootDirectory.normalCache);
|
pref.setBool("is_in_rog", destinationController.isInRog.value);
|
||||||
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
|
pref.setBool(
|
||||||
await instanceA.manage.createAsync();
|
"rogaining_counted", destinationController.rogainingCounted.value);
|
||||||
await instanceA.metadata.addAsync(
|
pref.setBool("ready_for_goal", DestinationController.ready_for_goal);
|
||||||
key: 'sourceURL',
|
|
||||||
value: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
|
||||||
);
|
|
||||||
await instanceA.metadata.addAsync(
|
|
||||||
key: 'validDuration',
|
|
||||||
value: '14',
|
|
||||||
);
|
|
||||||
await instanceA.metadata.addAsync(
|
|
||||||
key: 'behaviour',
|
|
||||||
value: 'cacheFirst',
|
|
||||||
);
|
|
||||||
|
|
||||||
runApp(MyApp());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
void restoreGame() async {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
SharedPreferences pref = await SharedPreferences.getInstance();
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
destinationController.skipGps = false;
|
||||||
|
destinationController.isInRog.value = pref.getBool("is_in_rog") ?? false;
|
||||||
|
destinationController.rogainingCounted.value =
|
||||||
|
pref.getBool("rogaining_counted") ?? false;
|
||||||
|
DestinationController.ready_for_goal =
|
||||||
|
pref.getBool("ready_for_goal") ?? false;
|
||||||
|
//print(
|
||||||
|
// "--restored -- destinationController.isInRog.value ${pref.getBool("is_in_rog")} -- ${pref.getBool("rogaining_counted")}");
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
await FlutterMapTileCaching.initialise();
|
||||||
|
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
|
||||||
|
await instanceA.manage.createAsync();
|
||||||
|
await instanceA.metadata.addAsync(
|
||||||
|
key: 'sourceURL',
|
||||||
|
value: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
||||||
|
);
|
||||||
|
await instanceA.metadata.addAsync(
|
||||||
|
key: 'validDuration',
|
||||||
|
value: '14',
|
||||||
|
);
|
||||||
|
await instanceA.metadata.addAsync(
|
||||||
|
key: 'behaviour',
|
||||||
|
value: 'cacheFirst',
|
||||||
|
);
|
||||||
|
runApp(const MyApp());
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatefulWidget {
|
||||||
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyApp> createState() => _MyAppState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (context.mounted) {
|
||||||
|
restoreGame();
|
||||||
|
}
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
// void saveGameState() async {
|
||||||
|
// DestinationController destinationController = Get.find<DestinationController>();
|
||||||
|
// SharedPreferences pref = await SharedPreferences.getInstance();
|
||||||
|
// pref.setBool("is_in_rog", destinationController.is_in_rog.value);
|
||||||
|
// pref.setBool("rogaining_counted", destinationController.rogaining_counted.value);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
|
LocationController locationController = Get.find<LocationController>();
|
||||||
|
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
switch (state) {
|
||||||
|
case AppLifecycleState.resumed:
|
||||||
|
locationController.resumePositionStream();
|
||||||
|
//print("RESUMED");
|
||||||
|
restoreGame();
|
||||||
|
break;
|
||||||
|
case AppLifecycleState.inactive:
|
||||||
|
locationController.resumePositionStream();
|
||||||
|
//print("INACTIVE");
|
||||||
|
break;
|
||||||
|
case AppLifecycleState.paused:
|
||||||
|
locationController.resumePositionStream();
|
||||||
|
//print("PAUSED");
|
||||||
|
saveGameState();
|
||||||
|
break;
|
||||||
|
case AppLifecycleState.detached:
|
||||||
|
locationController.resumePositionStream();
|
||||||
|
//print("DETACHED");
|
||||||
|
saveGameState();
|
||||||
|
break;
|
||||||
|
case AppLifecycleState.hidden:
|
||||||
|
locationController.resumePositionStream();
|
||||||
|
//print("DETACHED");
|
||||||
|
saveGameState();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetMaterialApp(
|
return GetMaterialApp(
|
||||||
@ -48,64 +128,20 @@ class MyApp extends StatelessWidget {
|
|||||||
//locale: const Locale('en', 'US'),
|
//locale: const Locale('en', 'US'),
|
||||||
fallbackLocale: const Locale('en', 'US'),
|
fallbackLocale: const Locale('en', 'US'),
|
||||||
title: 'ROGAINING',
|
title: 'ROGAINING',
|
||||||
theme: AppTheme.theme,
|
theme: ThemeData(
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: const Color.fromARGB(255, 36, 135, 221)),
|
||||||
|
useMaterial3: true,
|
||||||
|
),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
defaultTransition: Transition.cupertino,
|
defaultTransition: Transition.cupertino,
|
||||||
opaqueRoute: Get.isOpaqueRouteDefault,
|
opaqueRoute: Get.isOpaqueRouteDefault,
|
||||||
popGesture: Get.isPopGestureEnable,
|
popGesture: Get.isPopGestureEnable,
|
||||||
transitionDuration: const Duration(milliseconds: 230),
|
transitionDuration: const Duration(milliseconds: 230),
|
||||||
initialBinding: GameBinding(),
|
initialBinding: IndexBinding(), //HomeBinding(),
|
||||||
initialRoute: AppPages.S_LOGIN,
|
initialRoute: AppPages.PERMISSION,
|
||||||
getPages: AppPages.routes,
|
getPages: AppPages.routes,
|
||||||
enableLog: true,
|
enableLog: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// class MyApp extends StatelessWidget {
|
|
||||||
// MyApp({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
// // This widget is the root of your application.
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return MaterialApp(
|
|
||||||
// title: 'Flutter Demo',
|
|
||||||
// theme: ThemeData(
|
|
||||||
// primaryColor: Color(0xfff00B074),
|
|
||||||
// textTheme: const TextTheme(
|
|
||||||
// bodyText1: TextStyle(
|
|
||||||
// fontSize: 18.0,
|
|
||||||
// fontFamily: 'Barlow-Medium',
|
|
||||||
// color: Color(0xff464255)),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// home: PermissionHandlerScreen(),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// class SplashScreen extends StatelessWidget {
|
|
||||||
// const SplashScreen({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return WillPopScope(
|
|
||||||
// onWillPop: () async {
|
|
||||||
// SystemNavigator.pop();
|
|
||||||
// return true;
|
|
||||||
// },
|
|
||||||
// child: Scaffold(
|
|
||||||
// body: Center(
|
|
||||||
// child: Text(
|
|
||||||
// "Splash Screen",
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
61
lib/main_nrog.dart
Normal file
61
lib/main_nrog.dart
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:rogapp/nrog/pages/permission_page.dart';
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
await FlutterMapTileCaching.initialise();
|
||||||
|
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
|
||||||
|
await instanceA.manage.createAsync();
|
||||||
|
await instanceA.metadata.addAsync(
|
||||||
|
key: 'sourceURL',
|
||||||
|
value: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
||||||
|
);
|
||||||
|
await instanceA.metadata.addAsync(
|
||||||
|
key: 'validDuration',
|
||||||
|
value: '14',
|
||||||
|
);
|
||||||
|
await instanceA.metadata.addAsync(
|
||||||
|
key: 'behaviour',
|
||||||
|
value: 'cacheFirst',
|
||||||
|
);
|
||||||
|
runApp(
|
||||||
|
const ProviderScope(child: MyApp()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyApp extends StatefulWidget {
|
||||||
|
const MyApp({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<MyApp> createState() => _MyAppState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
debugShowCheckedModeBanner: false,
|
||||||
|
title: 'Flutter Demo',
|
||||||
|
theme: ThemeData(
|
||||||
|
colorScheme: ColorScheme.fromSeed(
|
||||||
|
seedColor: const Color.fromARGB(255, 124, 156, 9)),
|
||||||
|
useMaterial3: true,
|
||||||
|
),
|
||||||
|
home: const PermissionPage());
|
||||||
|
}
|
||||||
|
}
|
||||||
24
lib/model/auth_user.dart
Normal file
24
lib/model/auth_user.dart
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
class AuthUser {
|
||||||
|
AuthUser();
|
||||||
|
|
||||||
|
//AuthUser.from({required this.id, required this.email, required this.is_rogaining, required this.group, required this.zekken_number, required this.event_code, required this.team_name});
|
||||||
|
|
||||||
|
AuthUser.fromMap(Map<String, dynamic> map)
|
||||||
|
: id = int.parse(map["id"].toString()),
|
||||||
|
email = map["email"].toString(),
|
||||||
|
is_rogaining = bool.parse(map["is_rogaining"].toString()),
|
||||||
|
group = map["group"].toString(),
|
||||||
|
zekken_number = map["zekken_number"].toString(),
|
||||||
|
event_code = map["event_code"].toString(),
|
||||||
|
team_name = map["team_name"].toString(),
|
||||||
|
auth_token = map["token"];
|
||||||
|
|
||||||
|
int? id;
|
||||||
|
String? email;
|
||||||
|
bool? is_rogaining;
|
||||||
|
String? group;
|
||||||
|
String? zekken_number;
|
||||||
|
String? event_code;
|
||||||
|
String? team_name;
|
||||||
|
String? auth_token;
|
||||||
|
}
|
||||||
@ -1,113 +1,130 @@
|
|||||||
|
|
||||||
|
|
||||||
class Destination {
|
class Destination {
|
||||||
String? name;
|
String? name;
|
||||||
String? address;
|
String? address;
|
||||||
String? phone;
|
String? phone;
|
||||||
String? email;
|
String? email;
|
||||||
String? webcontents;
|
String? webcontents;
|
||||||
String? videos;
|
String? videos;
|
||||||
String? category;
|
String? category;
|
||||||
int? series;
|
int? series;
|
||||||
double? lat;
|
double? lat;
|
||||||
double? lon;
|
double? lon;
|
||||||
String? sub_loc_id;
|
String? sub_loc_id;
|
||||||
int? location_id;
|
int? location_id;
|
||||||
int? list_order;
|
int? list_order;
|
||||||
String? photos;
|
String? photos;
|
||||||
double? checkin_radious;
|
double? checkin_radious;
|
||||||
int? auto_checkin;
|
int? auto_checkin;
|
||||||
bool? selected = false;
|
bool? selected = false;
|
||||||
bool? checkedin = false;
|
bool? checkedin = false;
|
||||||
double? cp;
|
double? cp;
|
||||||
double? checkin_point;
|
double? checkin_point;
|
||||||
double? buy_point;
|
double? buy_point;
|
||||||
int? hidden_location;
|
int? hidden_location;
|
||||||
|
String? checkin_image;
|
||||||
|
String? buypoint_image;
|
||||||
|
bool forced_checkin = false;
|
||||||
|
int recipt_times = 0;
|
||||||
|
String? tags;
|
||||||
|
|
||||||
Destination({
|
Destination(
|
||||||
this.name,
|
{this.name,
|
||||||
this.address,
|
this.address,
|
||||||
this.phone,
|
this.phone,
|
||||||
this.email,
|
this.email,
|
||||||
this.webcontents,
|
this.webcontents,
|
||||||
this.videos,
|
this.videos,
|
||||||
this.category,
|
this.category,
|
||||||
this.series,
|
this.series,
|
||||||
this.lat,
|
this.lat,
|
||||||
this.lon,
|
this.lon,
|
||||||
this.sub_loc_id,
|
this.sub_loc_id,
|
||||||
this.location_id,
|
this.location_id,
|
||||||
this.list_order,
|
this.list_order,
|
||||||
this.photos,
|
this.photos,
|
||||||
this.checkin_radious,
|
this.checkin_radious,
|
||||||
this.auto_checkin,
|
this.auto_checkin,
|
||||||
this.selected,
|
this.selected,
|
||||||
this.checkedin,
|
this.checkedin,
|
||||||
this.cp,
|
this.cp,
|
||||||
this.checkin_point,
|
this.checkin_point,
|
||||||
this.buy_point,
|
this.buy_point,
|
||||||
this.hidden_location
|
this.hidden_location,
|
||||||
});
|
this.checkin_image,
|
||||||
|
this.buypoint_image,
|
||||||
|
this.forced_checkin = false,
|
||||||
|
this.recipt_times = 0,
|
||||||
|
this.tags});
|
||||||
|
|
||||||
factory Destination.fromMap(Map<String, dynamic> json) {
|
factory Destination.fromMap(Map<String, dynamic> json) {
|
||||||
|
bool selec = json['selected'] == 0 ? false : true;
|
||||||
|
bool checkin = json['checkedin'] == 0 ? false : true;
|
||||||
|
bool forcedCheckin = json['forced_checkin'] == 0 ? false : true;
|
||||||
|
|
||||||
bool selec = json['selected'] == 0 ? false : true;
|
//print("-----tags model----- ${json}");
|
||||||
bool checkin = json['checkedin'] == 0 ? false : true;
|
|
||||||
|
|
||||||
return Destination(
|
return Destination(
|
||||||
name: json['name'],
|
name: json['name'],
|
||||||
address: json['address'],
|
address: json['address'],
|
||||||
phone: json['phone'],
|
phone: json['phone'],
|
||||||
email: json['email'],
|
email: json['email'],
|
||||||
webcontents: json['webcontents'],
|
webcontents: json['webcontents'],
|
||||||
videos: json['videos'],
|
videos: json['videos'],
|
||||||
category: json['category'],
|
category: json['category'],
|
||||||
series: json['series'],
|
series: json['series'],
|
||||||
lat: json['lat'],
|
lat: json['lat'],
|
||||||
lon: json['lon'],
|
lon: json['lon'],
|
||||||
sub_loc_id : json['sub_loc_id'],
|
sub_loc_id: json['sub_loc_id'],
|
||||||
location_id: json['location_id'],
|
location_id: json['location_id'],
|
||||||
list_order: json['list_order'],
|
list_order: json['list_order'],
|
||||||
photos: json['photos'],
|
photos: json['photos'],
|
||||||
checkin_radious: json['checkin_radious'],
|
checkin_radious: json['checkin_radious'],
|
||||||
auto_checkin:json['auto_checkin'],
|
auto_checkin: json['auto_checkin'],
|
||||||
selected: selec,
|
selected: selec,
|
||||||
checkedin: checkin,
|
checkedin: checkin,
|
||||||
cp: json['cp'],
|
cp: json['cp'],
|
||||||
checkin_point: json['checkin_point'],
|
checkin_point: json['checkin_point'],
|
||||||
buy_point: json['buy_point'],
|
buy_point: json['buy_point'],
|
||||||
hidden_location: json['hidden_location']
|
hidden_location: json['hidden_location'],
|
||||||
);
|
checkin_image: json['checkin_image'],
|
||||||
}
|
buypoint_image: json["buypoint_image"],
|
||||||
|
forced_checkin: forcedCheckin,
|
||||||
|
recipt_times: json["recipt_times"],
|
||||||
|
tags: json["tags"]);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toMap(){
|
Map<String, dynamic> toMap() {
|
||||||
int sel = selected == false ? 0 : 1;
|
int sel = selected == false ? 0 : 1;
|
||||||
int check = checkedin == false ? 0 : 1;
|
int check = checkedin == false ? 0 : 1;
|
||||||
return {
|
int forcedCheckin = forced_checkin == false ? 0 : 1;
|
||||||
'name':name,
|
return {
|
||||||
'address': address,
|
'name': name,
|
||||||
'phone': phone,
|
'address': address,
|
||||||
'email': email,
|
'phone': phone,
|
||||||
'webcontents': webcontents,
|
'email': email,
|
||||||
'videos': videos,
|
'webcontents': webcontents,
|
||||||
'category':category,
|
'videos': videos,
|
||||||
'series':series,
|
'category': category,
|
||||||
'lat':lat,
|
'series': series,
|
||||||
'lon':lon,
|
'lat': lat,
|
||||||
'sub_loc_id': sub_loc_id,
|
'lon': lon,
|
||||||
'location_id':location_id,
|
'sub_loc_id': sub_loc_id,
|
||||||
'list_order':list_order,
|
'location_id': location_id,
|
||||||
'photos':photos,
|
'list_order': list_order,
|
||||||
'checkin_radious': checkin_radious,
|
'photos': photos,
|
||||||
'auto_checkin': auto_checkin,
|
'checkin_radious': checkin_radious,
|
||||||
'selected': sel,
|
'auto_checkin': auto_checkin,
|
||||||
'checkedin': check,
|
'selected': sel,
|
||||||
'cp' : cp,
|
'checkedin': check,
|
||||||
'checkin_point' : checkin_point,
|
'cp': cp,
|
||||||
'buy_point' : buy_point,
|
'checkin_point': checkin_point,
|
||||||
'hidden_location' : hidden_location
|
'buy_point': buy_point,
|
||||||
};
|
'hidden_location': hidden_location,
|
||||||
}
|
'checkin_image': checkin_image,
|
||||||
|
'buypoint_image': buypoint_image,
|
||||||
|
'forced_checkin': forcedCheckin,
|
||||||
}
|
'recipt_times': recipt_times,
|
||||||
|
'tags': tags
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
8
lib/model/game_state_instance.dart
Normal file
8
lib/model/game_state_instance.dart
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
enum LocationState { noGps, notInCheckin, withinCheckin }
|
||||||
|
|
||||||
|
enum GameState { notStarted, startedNotCounted, startedCounted, nodeGoal }
|
||||||
|
|
||||||
|
class GameInsStatetance {
|
||||||
|
LocationState locationState = LocationState.noGps;
|
||||||
|
GameState gameState = GameState.notStarted;
|
||||||
|
}
|
||||||
47
lib/model/gps_data.dart
Normal file
47
lib/model/gps_data.dart
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
class GpsData {
|
||||||
|
int id;
|
||||||
|
String team_name;
|
||||||
|
String event_code;
|
||||||
|
double lat;
|
||||||
|
double lon;
|
||||||
|
int is_checkin;
|
||||||
|
int created_at;
|
||||||
|
int is_synced;
|
||||||
|
|
||||||
|
GpsData({
|
||||||
|
required this.id,
|
||||||
|
required this.team_name,
|
||||||
|
required this.event_code,
|
||||||
|
required this.lat,
|
||||||
|
required this.lon,
|
||||||
|
required this.created_at,
|
||||||
|
this.is_checkin = 0,
|
||||||
|
this.is_synced = 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory GpsData.fromMap(Map<String, dynamic> json) {
|
||||||
|
return GpsData(
|
||||||
|
id: json["id"],
|
||||||
|
team_name: json["team_name"],
|
||||||
|
event_code: json["event_code"],
|
||||||
|
lat: json["lat"],
|
||||||
|
lon: json["lon"],
|
||||||
|
is_checkin: json["is_checkin"],
|
||||||
|
created_at: json["created_at"],
|
||||||
|
is_synced: json["is_synced"] ?? 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'team_name': team_name,
|
||||||
|
'event_code': event_code,
|
||||||
|
'lat': lat,
|
||||||
|
'lon': lon,
|
||||||
|
'is_checkin': is_checkin,
|
||||||
|
'created_at': created_at,
|
||||||
|
'is_synced': is_synced,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,591 +0,0 @@
|
|||||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:unicode/unicode.dart';
|
|
||||||
|
|
||||||
class LocationResponse {
|
|
||||||
List<Feature>? features;
|
|
||||||
String? type;
|
|
||||||
|
|
||||||
LocationResponse({
|
|
||||||
this.features,
|
|
||||||
this.type,
|
|
||||||
});
|
|
||||||
|
|
||||||
LocationResponse copyWith({
|
|
||||||
List<Feature>? features,
|
|
||||||
String? type,
|
|
||||||
}) {
|
|
||||||
return LocationResponse(
|
|
||||||
features: features ?? this.features,
|
|
||||||
type: type ?? this.type,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return {
|
|
||||||
'features': features?.map((x) => x.toMap()).toList(),
|
|
||||||
'type': type,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
factory LocationResponse.fromMap(Map<String, dynamic> map) {
|
|
||||||
return LocationResponse(
|
|
||||||
features: List<Feature>.from(map['features']?.map((x) => Feature.fromMap(x)) ?? const []),
|
|
||||||
type: map['type'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
|
||||||
|
|
||||||
factory LocationResponse.fromJson(String source) =>
|
|
||||||
LocationResponse.fromMap(json.decode(source));
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'LocationResponse(features: $features, type: $type)';
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
|
|
||||||
return other is LocationResponse &&
|
|
||||||
listEquals(other.features, features) &&
|
|
||||||
other.type == type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => features.hashCode ^ type.hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Feature {
|
|
||||||
Geometry? geometry;
|
|
||||||
int? id;
|
|
||||||
Properties? properties;
|
|
||||||
String? type;
|
|
||||||
int? location_id;
|
|
||||||
double? latitude;
|
|
||||||
double? longitude;
|
|
||||||
|
|
||||||
Feature({
|
|
||||||
this.geometry,
|
|
||||||
this.id,
|
|
||||||
this.properties,
|
|
||||||
this.type,
|
|
||||||
this.location_id,
|
|
||||||
this.latitude,
|
|
||||||
this.longitude
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return <String, dynamic>{
|
|
||||||
'id': id,
|
|
||||||
'geometry': geometry?.toJson(),
|
|
||||||
'properties': properties?.toJson(),
|
|
||||||
'type': type,
|
|
||||||
// Use the first coordinate as latitude and longitude.
|
|
||||||
// You may need to adjust this based on your actual data structure.
|
|
||||||
'location_id': properties?.location_id,
|
|
||||||
'latitude': geometry?.coordinates?.first?.last,
|
|
||||||
'longitude': geometry?.coordinates?.first?.first,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// factory Feature.fromMap(Map<String, dynamic> map) {
|
|
||||||
// return Feature(
|
|
||||||
// geometry: Geometry.fromMap(map['geometry']),
|
|
||||||
// id: map['id'],
|
|
||||||
// properties: Properties.fromMap(map['properties']),
|
|
||||||
// type: map['type'],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
factory Feature.fromMap(Map<String, dynamic> map) {
|
|
||||||
Geometry? geometry = map['geometry'] != null
|
|
||||||
? Geometry.fromMap(map['geometry'])
|
|
||||||
: null;
|
|
||||||
double? latitude = geometry?.coordinates?.isNotEmpty ?? false ? geometry!.coordinates![0][0] : null;
|
|
||||||
double? longitude = geometry?.coordinates?.isNotEmpty ?? false ? geometry!.coordinates![0][1] : null;
|
|
||||||
|
|
||||||
return Feature(
|
|
||||||
id: map['id'] as int?,
|
|
||||||
geometry: Geometry.fromMap(map['geometry']),
|
|
||||||
properties: Properties.fromMap(map['properties']),
|
|
||||||
type: map['type'],
|
|
||||||
location_id: Properties.fromMap(map['properties']).location_id,
|
|
||||||
latitude: latitude,
|
|
||||||
longitude: longitude,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
|
||||||
|
|
||||||
factory Feature.fromJson(String source) =>
|
|
||||||
Feature.fromMap(json.decode(source));
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Feature(geometry: $geometry, id: $id, properties: $properties, type: $type)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(Object other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
|
|
||||||
return other is Feature &&
|
|
||||||
other.geometry == geometry &&
|
|
||||||
other.id == id &&
|
|
||||||
other.properties == properties &&
|
|
||||||
other.type == type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
return geometry.hashCode ^ id.hashCode ^ properties.hashCode ^ type.hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Geometry {
|
|
||||||
List<List<double>>? coordinates;
|
|
||||||
String? type;
|
|
||||||
|
|
||||||
Geometry({
|
|
||||||
this.coordinates,
|
|
||||||
this.type,
|
|
||||||
});
|
|
||||||
|
|
||||||
Geometry copyWith({
|
|
||||||
List<List<double>>? coordinates,
|
|
||||||
String? type,
|
|
||||||
}) {
|
|
||||||
return Geometry(
|
|
||||||
coordinates: coordinates ?? this.coordinates,
|
|
||||||
type: type ?? this.type,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return {
|
|
||||||
'coordinates': coordinates,
|
|
||||||
'type': type,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
factory Geometry.fromMap(Map<String, dynamic> map) {
|
|
||||||
return Geometry(
|
|
||||||
coordinates: map['coordinates'] != null
|
|
||||||
? List<List<double>>.from(
|
|
||||||
map['coordinates'].map((x) => List<double>.from(x.map((x) => x.toDouble()))))
|
|
||||||
: null,
|
|
||||||
type: map['type'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
|
||||||
|
|
||||||
factory Geometry.fromJson(String source) =>
|
|
||||||
Geometry.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'Geometry(coordinates: $coordinates, type: $type)';
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(covariant Geometry other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
|
|
||||||
return listEquals(other.coordinates, coordinates) && other.type == type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode => coordinates.hashCode ^ type.hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Properties {
|
|
||||||
final int location_id;
|
|
||||||
final String? sub_loc_id;
|
|
||||||
final double? cp;
|
|
||||||
final String? location_name;
|
|
||||||
final String? category;
|
|
||||||
final String? subcategory;
|
|
||||||
final String? zip;
|
|
||||||
final String? address;
|
|
||||||
final String? prefecture;
|
|
||||||
final String? area;
|
|
||||||
final String? city;
|
|
||||||
final double? latitude;
|
|
||||||
final double? longitude;
|
|
||||||
final String? photos;
|
|
||||||
final String? videos;
|
|
||||||
final String? webcontents;
|
|
||||||
final String? status;
|
|
||||||
final String? portal;
|
|
||||||
final String? group;
|
|
||||||
final String? phone;
|
|
||||||
final String? fax;
|
|
||||||
final String? email;
|
|
||||||
final String? facility;
|
|
||||||
final String? remark;
|
|
||||||
final String? tags;
|
|
||||||
final dynamic? event_name;
|
|
||||||
final bool? event_active;
|
|
||||||
final bool? hidden_location;
|
|
||||||
final bool? auto_checkin;
|
|
||||||
final double? checkin_radius;
|
|
||||||
final double? checkin_point;
|
|
||||||
final double? buy_point;
|
|
||||||
final String? evaluation_value;
|
|
||||||
final bool? shop_closed;
|
|
||||||
final bool? shop_shutdown;
|
|
||||||
final String? opening_hours_mon;
|
|
||||||
final String? opening_hours_tue;
|
|
||||||
final String? opening_hours_wed;
|
|
||||||
final String? opening_hours_thu;
|
|
||||||
final String? opening_hours_fri;
|
|
||||||
final String? opening_hours_sat;
|
|
||||||
final String? opening_hours_sun;
|
|
||||||
final String? parammeters;
|
|
||||||
Properties({
|
|
||||||
required this.location_id,
|
|
||||||
this.sub_loc_id,
|
|
||||||
this.cp,
|
|
||||||
this.location_name,
|
|
||||||
this.category,
|
|
||||||
this.subcategory,
|
|
||||||
this.zip,
|
|
||||||
this.address,
|
|
||||||
this.prefecture,
|
|
||||||
this.area,
|
|
||||||
this.city,
|
|
||||||
this.latitude,
|
|
||||||
this.longitude,
|
|
||||||
this.photos,
|
|
||||||
this.videos,
|
|
||||||
this.webcontents,
|
|
||||||
this.status,
|
|
||||||
this.portal,
|
|
||||||
this.group,
|
|
||||||
this.phone,
|
|
||||||
this.fax,
|
|
||||||
this.email,
|
|
||||||
this.facility,
|
|
||||||
this.remark,
|
|
||||||
this.tags,
|
|
||||||
this.event_name,
|
|
||||||
this.event_active,
|
|
||||||
this.hidden_location,
|
|
||||||
this.auto_checkin,
|
|
||||||
this.checkin_radius,
|
|
||||||
this.checkin_point,
|
|
||||||
this.buy_point,
|
|
||||||
this.evaluation_value,
|
|
||||||
this.shop_closed,
|
|
||||||
this.shop_shutdown,
|
|
||||||
this.opening_hours_mon,
|
|
||||||
this.opening_hours_tue,
|
|
||||||
this.opening_hours_wed,
|
|
||||||
this.opening_hours_thu,
|
|
||||||
this.opening_hours_fri,
|
|
||||||
this.opening_hours_sat,
|
|
||||||
this.opening_hours_sun,
|
|
||||||
this.parammeters,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
String toJson() => json.encode(toMap());
|
|
||||||
|
|
||||||
Properties copyWith({
|
|
||||||
int? location_id,
|
|
||||||
String? sub_loc_id,
|
|
||||||
double? cp,
|
|
||||||
String? location_name,
|
|
||||||
String? category,
|
|
||||||
String? subcategory,
|
|
||||||
String? zip,
|
|
||||||
String? address,
|
|
||||||
String? prefecture,
|
|
||||||
String? area,
|
|
||||||
String? city,
|
|
||||||
double? latitude,
|
|
||||||
double? longitude,
|
|
||||||
String? photos,
|
|
||||||
String? videos,
|
|
||||||
String? webcontents,
|
|
||||||
String? status,
|
|
||||||
String? portal,
|
|
||||||
String? group,
|
|
||||||
String? phone,
|
|
||||||
String? fax,
|
|
||||||
String? email,
|
|
||||||
String? facility,
|
|
||||||
String? remark,
|
|
||||||
String? tags,
|
|
||||||
dynamic? event_name,
|
|
||||||
bool? event_active,
|
|
||||||
bool? hidden_location,
|
|
||||||
bool? auto_checkin,
|
|
||||||
double? checkin_radius,
|
|
||||||
double? checkin_point,
|
|
||||||
double? buy_point,
|
|
||||||
String? evaluation_value,
|
|
||||||
bool? shop_closed,
|
|
||||||
bool? shop_shutdown,
|
|
||||||
String? opening_hours_mon,
|
|
||||||
String? opening_hours_tue,
|
|
||||||
String? opening_hours_wed,
|
|
||||||
String? opening_hours_thu,
|
|
||||||
String? opening_hours_fri,
|
|
||||||
String? opening_hours_sat,
|
|
||||||
String? opening_hours_sun,
|
|
||||||
String? parammeters,
|
|
||||||
}) {
|
|
||||||
return Properties(
|
|
||||||
location_id: location_id ?? this.location_id,
|
|
||||||
sub_loc_id: sub_loc_id ?? this.sub_loc_id,
|
|
||||||
cp: cp ?? this.cp,
|
|
||||||
location_name: location_name ?? this.location_name,
|
|
||||||
category: category ?? this.category,
|
|
||||||
subcategory: subcategory ?? this.subcategory,
|
|
||||||
zip: zip ?? this.zip,
|
|
||||||
address: address ?? this.address,
|
|
||||||
prefecture: prefecture ?? this.prefecture,
|
|
||||||
area: area ?? this.area,
|
|
||||||
city: city ?? this.city,
|
|
||||||
latitude: latitude ?? this.latitude,
|
|
||||||
longitude: longitude ?? this.longitude,
|
|
||||||
photos: photos ?? this.photos,
|
|
||||||
videos: videos ?? this.videos,
|
|
||||||
webcontents: webcontents ?? this.webcontents,
|
|
||||||
status: status ?? this.status,
|
|
||||||
portal: portal ?? this.portal,
|
|
||||||
group: group ?? this.group,
|
|
||||||
phone: phone ?? this.phone,
|
|
||||||
fax: fax ?? this.fax,
|
|
||||||
email: email ?? this.email,
|
|
||||||
facility: facility ?? this.facility,
|
|
||||||
remark: remark ?? this.remark,
|
|
||||||
tags: tags ?? this.tags,
|
|
||||||
event_name: event_name ?? this.event_name,
|
|
||||||
event_active: event_active ?? this.event_active,
|
|
||||||
hidden_location: hidden_location ?? this.hidden_location,
|
|
||||||
auto_checkin: auto_checkin ?? this.auto_checkin,
|
|
||||||
checkin_radius: checkin_radius ?? this.checkin_radius,
|
|
||||||
checkin_point: checkin_point ?? this.checkin_point,
|
|
||||||
buy_point: buy_point ?? this.buy_point,
|
|
||||||
evaluation_value: evaluation_value ?? this.evaluation_value,
|
|
||||||
shop_closed: shop_closed ?? this.shop_closed,
|
|
||||||
shop_shutdown: shop_shutdown ?? this.shop_shutdown,
|
|
||||||
opening_hours_mon: opening_hours_mon ?? this.opening_hours_mon,
|
|
||||||
opening_hours_tue: opening_hours_tue ?? this.opening_hours_tue,
|
|
||||||
opening_hours_wed: opening_hours_wed ?? this.opening_hours_wed,
|
|
||||||
opening_hours_thu: opening_hours_thu ?? this.opening_hours_thu,
|
|
||||||
opening_hours_fri: opening_hours_fri ?? this.opening_hours_fri,
|
|
||||||
opening_hours_sat: opening_hours_sat ?? this.opening_hours_sat,
|
|
||||||
opening_hours_sun: opening_hours_sun ?? this.opening_hours_sun,
|
|
||||||
parammeters: parammeters ?? this.parammeters,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return <String, dynamic>{
|
|
||||||
'location_id': location_id,
|
|
||||||
'sub_loc_id': sub_loc_id,
|
|
||||||
'cp': cp,
|
|
||||||
'location_name': location_name,
|
|
||||||
'category': category,
|
|
||||||
'subcategory': subcategory,
|
|
||||||
'zip': zip,
|
|
||||||
'address': address,
|
|
||||||
'prefecture': prefecture,
|
|
||||||
'area': area,
|
|
||||||
'city': city,
|
|
||||||
'latitude': latitude,
|
|
||||||
'longitude': longitude,
|
|
||||||
'photos': photos,
|
|
||||||
'videos': videos,
|
|
||||||
'webcontents': webcontents,
|
|
||||||
'status': status,
|
|
||||||
'portal': portal,
|
|
||||||
'group': group,
|
|
||||||
'phone': phone,
|
|
||||||
'fax': fax,
|
|
||||||
'email': email,
|
|
||||||
'facility': facility,
|
|
||||||
'remark': remark,
|
|
||||||
'tags': tags,
|
|
||||||
'event_name': event_name,
|
|
||||||
'event_active': event_active,
|
|
||||||
'hidden_location': hidden_location,
|
|
||||||
'auto_checkin': auto_checkin,
|
|
||||||
'checkin_radius': checkin_radius,
|
|
||||||
'checkin_point': checkin_point,
|
|
||||||
'buy_point': buy_point,
|
|
||||||
'evaluation_value': evaluation_value,
|
|
||||||
'shop_closed': shop_closed,
|
|
||||||
'shop_shutdown': shop_shutdown,
|
|
||||||
'opening_hours_mon': opening_hours_mon,
|
|
||||||
'opening_hours_tue': opening_hours_tue,
|
|
||||||
'opening_hours_wed': opening_hours_wed,
|
|
||||||
'opening_hours_thu': opening_hours_thu,
|
|
||||||
'opening_hours_fri': opening_hours_fri,
|
|
||||||
'opening_hours_sat': opening_hours_sat,
|
|
||||||
'opening_hours_sun': opening_hours_sun,
|
|
||||||
'parammeters': parammeters,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
factory Properties.fromMap(Map<String, dynamic> map) {
|
|
||||||
return Properties(
|
|
||||||
location_id: map['location_id'] as int,
|
|
||||||
sub_loc_id: map['sub_loc_id'] != null ? map['sub_loc_id'] as String : null,
|
|
||||||
cp: map['cp'] != null ? map['cp'] as double : null,
|
|
||||||
location_name: map['location_name'] != null ? map['location_name'] as String : null,
|
|
||||||
category: map['category'] != null ? map['category'] as String : null,
|
|
||||||
subcategory: map['subcategory'] != null ? map['subcategory'] as String : null,
|
|
||||||
zip: map['zip'] != null ? map['zip'] as String : null,
|
|
||||||
address: map['address'] != null ? map['address'] as String : null,
|
|
||||||
prefecture: map['prefecture'] != null ? map['prefecture'] as String : null,
|
|
||||||
area: map['area'] != null ? map['area'] as String : null,
|
|
||||||
city: map['city'] != null ? map['city'] as String : null,
|
|
||||||
latitude: map['latitude'] != null ? map['latitude'] as double : null,
|
|
||||||
longitude: map['longitude'] != null ? map['longitude'] as double : null,
|
|
||||||
photos: map['photos'] != null ? map['photos'] as String : null,
|
|
||||||
videos: map['videos'] != null ? map['videos'] as String : null,
|
|
||||||
webcontents: map['webcontents'] != null ? map['webcontents'] as String : null,
|
|
||||||
status: map['status'] != null ? map['status'] as String : null,
|
|
||||||
portal: map['portal'] != null ? map['portal'] as String : null,
|
|
||||||
group: map['group'] != null ? map['group'] as String : null,
|
|
||||||
phone: map['phone'] != null ? map['phone'] as String : null,
|
|
||||||
fax: map['fax'] != null ? map['fax'] as String : null,
|
|
||||||
email: map['email'] != null ? map['email'] as String : null,
|
|
||||||
facility: map['facility'] != null ? map['facility'] as String : null,
|
|
||||||
remark: map['remark'] != null ? map['remark'] as String : null,
|
|
||||||
tags: map['tags'] != null ? map['tags'] as String : null,
|
|
||||||
event_name: map['event_name'] != null ? map['event_name'] as dynamic : null,
|
|
||||||
event_active: map['event_active'] != null ? map['event_active'] as bool : null,
|
|
||||||
hidden_location: map['hidden_location'] != null ? map['hidden_location'] as bool : null,
|
|
||||||
auto_checkin: map['auto_checkin'] != null ? map['auto_checkin'] as bool : null,
|
|
||||||
checkin_radius: map['checkin_radius'] != null ? map['checkin_radius'] as double : null,
|
|
||||||
checkin_point: map['checkin_point'] != null ? map['checkin_point'] as double : null,
|
|
||||||
buy_point: map['buy_point'] != null ? map['buy_point'] as double : null,
|
|
||||||
evaluation_value: map['evaluation_value'] != null ? map['evaluation_value'] as String : null,
|
|
||||||
shop_closed: map['shop_closed'] != null ? map['shop_closed'] as bool : null,
|
|
||||||
shop_shutdown: map['shop_shutdown'] != null ? map['shop_shutdown'] as bool : null,
|
|
||||||
opening_hours_mon: map['opening_hours_mon'] != null ? map['opening_hours_mon'] as String : null,
|
|
||||||
opening_hours_tue: map['opening_hours_tue'] != null ? map['opening_hours_tue'] as String : null,
|
|
||||||
opening_hours_wed: map['opening_hours_wed'] != null ? map['opening_hours_wed'] as String : null,
|
|
||||||
opening_hours_thu: map['opening_hours_thu'] != null ? map['opening_hours_thu'] as String : null,
|
|
||||||
opening_hours_fri: map['opening_hours_fri'] != null ? map['opening_hours_fri'] as String : null,
|
|
||||||
opening_hours_sat: map['opening_hours_sat'] != null ? map['opening_hours_sat'] as String : null,
|
|
||||||
opening_hours_sun: map['opening_hours_sun'] != null ? map['opening_hours_sun'] as String : null,
|
|
||||||
parammeters: map['parammeters'] != null ? map['parammeters'] as String : null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
factory Properties.fromJson(String source) => Properties.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'Properties(location_id: $location_id, sub_loc_id: $sub_loc_id, cp: $cp, location_name: $location_name, category: $category, subcategory: $subcategory, zip: $zip, address: $address, prefecture: $prefecture, area: $area, city: $city, latitude: $latitude, longitude: $longitude, photos: $photos, videos: $videos, webcontents: $webcontents, status: $status, portal: $portal, group: $group, phone: $phone, fax: $fax, email: $email, facility: $facility, remark: $remark, tags: $tags, event_name: $event_name, event_active: $event_active, hidden_location: $hidden_location, auto_checkin: $auto_checkin, checkin_radius: $checkin_radius, checkin_point: $checkin_point, buy_point: $buy_point, evaluation_value: $evaluation_value, shop_closed: $shop_closed, shop_shutdown: $shop_shutdown, opening_hours_mon: $opening_hours_mon, opening_hours_tue: $opening_hours_tue, opening_hours_wed: $opening_hours_wed, opening_hours_thu: $opening_hours_thu, opening_hours_fri: $opening_hours_fri, opening_hours_sat: $opening_hours_sat, opening_hours_sun: $opening_hours_sun, parammeters: $parammeters)';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool operator ==(covariant Properties other) {
|
|
||||||
if (identical(this, other)) return true;
|
|
||||||
|
|
||||||
return
|
|
||||||
other.location_id == location_id &&
|
|
||||||
other.sub_loc_id == sub_loc_id &&
|
|
||||||
other.cp == cp &&
|
|
||||||
other.location_name == location_name &&
|
|
||||||
other.category == category &&
|
|
||||||
other.subcategory == subcategory &&
|
|
||||||
other.zip == zip &&
|
|
||||||
other.address == address &&
|
|
||||||
other.prefecture == prefecture &&
|
|
||||||
other.area == area &&
|
|
||||||
other.city == city &&
|
|
||||||
other.latitude == latitude &&
|
|
||||||
other.longitude == longitude &&
|
|
||||||
other.photos == photos &&
|
|
||||||
other.videos == videos &&
|
|
||||||
other.webcontents == webcontents &&
|
|
||||||
other.status == status &&
|
|
||||||
other.portal == portal &&
|
|
||||||
other.group == group &&
|
|
||||||
other.phone == phone &&
|
|
||||||
other.fax == fax &&
|
|
||||||
other.email == email &&
|
|
||||||
other.facility == facility &&
|
|
||||||
other.remark == remark &&
|
|
||||||
other.tags == tags &&
|
|
||||||
other.event_name == event_name &&
|
|
||||||
other.event_active == event_active &&
|
|
||||||
other.hidden_location == hidden_location &&
|
|
||||||
other.auto_checkin == auto_checkin &&
|
|
||||||
other.checkin_radius == checkin_radius &&
|
|
||||||
other.checkin_point == checkin_point &&
|
|
||||||
other.buy_point == buy_point &&
|
|
||||||
other.evaluation_value == evaluation_value &&
|
|
||||||
other.shop_closed == shop_closed &&
|
|
||||||
other.shop_shutdown == shop_shutdown &&
|
|
||||||
other.opening_hours_mon == opening_hours_mon &&
|
|
||||||
other.opening_hours_tue == opening_hours_tue &&
|
|
||||||
other.opening_hours_wed == opening_hours_wed &&
|
|
||||||
other.opening_hours_thu == opening_hours_thu &&
|
|
||||||
other.opening_hours_fri == opening_hours_fri &&
|
|
||||||
other.opening_hours_sat == opening_hours_sat &&
|
|
||||||
other.opening_hours_sun == opening_hours_sun &&
|
|
||||||
other.parammeters == parammeters;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
int get hashCode {
|
|
||||||
return location_id.hashCode ^
|
|
||||||
sub_loc_id.hashCode ^
|
|
||||||
cp.hashCode ^
|
|
||||||
location_name.hashCode ^
|
|
||||||
category.hashCode ^
|
|
||||||
subcategory.hashCode ^
|
|
||||||
zip.hashCode ^
|
|
||||||
address.hashCode ^
|
|
||||||
prefecture.hashCode ^
|
|
||||||
area.hashCode ^
|
|
||||||
city.hashCode ^
|
|
||||||
latitude.hashCode ^
|
|
||||||
longitude.hashCode ^
|
|
||||||
photos.hashCode ^
|
|
||||||
videos.hashCode ^
|
|
||||||
webcontents.hashCode ^
|
|
||||||
status.hashCode ^
|
|
||||||
portal.hashCode ^
|
|
||||||
group.hashCode ^
|
|
||||||
phone.hashCode ^
|
|
||||||
fax.hashCode ^
|
|
||||||
email.hashCode ^
|
|
||||||
facility.hashCode ^
|
|
||||||
remark.hashCode ^
|
|
||||||
tags.hashCode ^
|
|
||||||
event_name.hashCode ^
|
|
||||||
event_active.hashCode ^
|
|
||||||
hidden_location.hashCode ^
|
|
||||||
auto_checkin.hashCode ^
|
|
||||||
checkin_radius.hashCode ^
|
|
||||||
checkin_point.hashCode ^
|
|
||||||
buy_point.hashCode ^
|
|
||||||
evaluation_value.hashCode ^
|
|
||||||
shop_closed.hashCode ^
|
|
||||||
shop_shutdown.hashCode ^
|
|
||||||
opening_hours_mon.hashCode ^
|
|
||||||
opening_hours_tue.hashCode ^
|
|
||||||
opening_hours_wed.hashCode ^
|
|
||||||
opening_hours_thu.hashCode ^
|
|
||||||
opening_hours_fri.hashCode ^
|
|
||||||
opening_hours_sat.hashCode ^
|
|
||||||
opening_hours_sun.hashCode ^
|
|
||||||
parammeters.hashCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
6
lib/model/map_state_instance.dart
Normal file
6
lib/model/map_state_instance.dart
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
|
|
||||||
|
class MapStateInstance {
|
||||||
|
MapController? mapController;
|
||||||
|
LatLngBounds? currentBounds;
|
||||||
|
}
|
||||||
@ -1,45 +0,0 @@
|
|||||||
class AuthResponse {
|
|
||||||
final User user;
|
|
||||||
final String token;
|
|
||||||
|
|
||||||
AuthResponse({required this.user, required this.token});
|
|
||||||
|
|
||||||
factory AuthResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
return AuthResponse(
|
|
||||||
user: User.fromJson(json['user']),
|
|
||||||
token: json['token'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class User {
|
|
||||||
final int id;
|
|
||||||
final String email;
|
|
||||||
final bool isRogaining;
|
|
||||||
final String group;
|
|
||||||
final String zekkenNumber;
|
|
||||||
final String eventCode;
|
|
||||||
final String teamName;
|
|
||||||
|
|
||||||
User({
|
|
||||||
required this.id,
|
|
||||||
required this.email,
|
|
||||||
required this.isRogaining,
|
|
||||||
required this.group,
|
|
||||||
required this.zekkenNumber,
|
|
||||||
required this.eventCode,
|
|
||||||
required this.teamName,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory User.fromJson(Map<String, dynamic> json) {
|
|
||||||
return User(
|
|
||||||
id: json['id'],
|
|
||||||
email: json['email'],
|
|
||||||
isRogaining: json['is_rogaining'],
|
|
||||||
group: json['group'],
|
|
||||||
zekkenNumber: json['zekken_number'],
|
|
||||||
eventCode: json['event_code'],
|
|
||||||
teamName: json['team_name'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
229
lib/nrog/pages/auth_page.dart
Normal file
229
lib/nrog/pages/auth_page.dart
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
|
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
|
||||||
|
import 'package:rogapp/model/auth_user.dart';
|
||||||
|
import 'package:rogapp/nrog/pages/home_page.dart';
|
||||||
|
import 'package:rogapp/provider/auth_provider.dart';
|
||||||
|
import 'package:rogapp/services/auth_service.dart';
|
||||||
|
import 'package:rogapp/widgets/c_form_text_field.dart';
|
||||||
|
import 'package:rogapp/widgets/c_password_text_filed.dart';
|
||||||
|
|
||||||
|
class AuthPage extends ConsumerStatefulWidget {
|
||||||
|
const AuthPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<AuthPage> createState() => _AuthPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AuthPageState extends ConsumerState<AuthPage> {
|
||||||
|
final _formkey = GlobalKey<FormState>();
|
||||||
|
final FocusNode focusEmail = FocusNode();
|
||||||
|
final FocusNode focusPwd = FocusNode();
|
||||||
|
var _authMode = 'login';
|
||||||
|
bool _isLoginProgress = false;
|
||||||
|
|
||||||
|
final TextEditingController _emailTextEditingController =
|
||||||
|
TextEditingController();
|
||||||
|
final TextEditingController _passwordTextEditingController =
|
||||||
|
TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_emailTextEditingController.addListener(() => setState(() {}));
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
checkUser();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _submit() async {
|
||||||
|
setState(() {
|
||||||
|
_isLoginProgress = true;
|
||||||
|
});
|
||||||
|
if (_formkey.currentState!.validate()) {
|
||||||
|
AuthService authService = AuthService();
|
||||||
|
AuthUser? user = await authService.userLogin(
|
||||||
|
_emailTextEditingController.text,
|
||||||
|
_passwordTextEditingController.text);
|
||||||
|
if (user != null) {
|
||||||
|
setState(() {
|
||||||
|
ref.read(authUserStateProvider.notifier).addLogin(user);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
_isLoginProgress = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _submitToken(String token) async {
|
||||||
|
setState(() {
|
||||||
|
_isLoginProgress = true;
|
||||||
|
});
|
||||||
|
AuthService authService = AuthService();
|
||||||
|
AuthUser? user = await authService.userFromToken(token);
|
||||||
|
//////////////print("---user is ${user} ---");
|
||||||
|
if (user != null) {
|
||||||
|
setState(() {
|
||||||
|
_isLoginProgress = false;
|
||||||
|
ref.read(authUserStateProvider.notifier).addLogin(user);
|
||||||
|
});
|
||||||
|
} else {}
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkUser() async {
|
||||||
|
String? token =
|
||||||
|
await ref.read(authUserStateProvider.notifier).tokenFromDevice();
|
||||||
|
//////////////print("--- red token is ${token} ---");
|
||||||
|
if (token != null) {
|
||||||
|
await _submitToken(token);
|
||||||
|
final id = ref.read(authUserStateProvider).id;
|
||||||
|
if (id != null) {
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (ctx) => const HomePage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (ref.read(authUserStateProvider).id != null) {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (ctx) => const HomePage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
resizeToAvoidBottomInset: true,
|
||||||
|
body: KeyboardDismisser(
|
||||||
|
gestures: const [
|
||||||
|
GestureType.onTap,
|
||||||
|
//GestureType.onVerticalDragDown
|
||||||
|
],
|
||||||
|
child: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
child: Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
children: [
|
||||||
|
buildAuthCard(),
|
||||||
|
buildLogo(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Positioned buildLogo() {
|
||||||
|
return Positioned(
|
||||||
|
top: -170,
|
||||||
|
left: MediaQuery.of(context).size.width / 2 - 100,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('assets/images/appicon.png'),
|
||||||
|
fit: BoxFit.fill),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildAuthCard() {
|
||||||
|
return Card(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Form(
|
||||||
|
key: _formkey,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 40, bottom: 10, left: 12, right: 12),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: CFormTextField(
|
||||||
|
cFocus: focusEmail,
|
||||||
|
cController: _emailTextEditingController),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(10),
|
||||||
|
child: CPasswordTextField(
|
||||||
|
cController: _passwordTextEditingController,
|
||||||
|
cFocusNode: focusPwd,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
buildControlls(),
|
||||||
|
// SizedBox(height: MediaQuery.of(context).viewInsets.bottom,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget buildControlls() {
|
||||||
|
if (_isLoginProgress) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final usr = ref.read(authUserStateProvider);
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 12.0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: _submit,
|
||||||
|
child: Text(_authMode == "login" ? "Submit" : "Register",
|
||||||
|
style: GoogleFonts.lato(
|
||||||
|
color: Theme.of(context).colorScheme.secondary))),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
if (_authMode == 'login') {
|
||||||
|
_authMode = 'register';
|
||||||
|
} else {
|
||||||
|
_authMode = 'login';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_authMode == "login"
|
||||||
|
? "${usr.id} Dont have account, please Register"
|
||||||
|
: "Already Registered, Login",
|
||||||
|
style: GoogleFonts.lato(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
119
lib/nrog/pages/home_page.dart
Normal file
119
lib/nrog/pages/home_page.dart
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
|
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:latlong2/latlong.dart';
|
||||||
|
import 'package:rogapp/provider/map_state_provider.dart';
|
||||||
|
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||||
|
|
||||||
|
class HomePage extends ConsumerStatefulWidget {
|
||||||
|
const HomePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
ConsumerState<HomePage> createState() => _HomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomePageState extends ConsumerState<HomePage> {
|
||||||
|
StreamSubscription? subscription;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final mapStateInstance = ref.watch(mapStateNotifierProvider);
|
||||||
|
return Scaffold(
|
||||||
|
//drawer: DrawerPage(),
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text("Rogaining"),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//Get.toNamed(AppPages.HISTORY);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.history)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
// final tk = indexController.currentUser[0]["token"];
|
||||||
|
// if (tk != null) {
|
||||||
|
// destinationController.fixMapBound(tk);
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh)),
|
||||||
|
InkWell(
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//CatWidget(indexController: indexController,),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: Center(
|
||||||
|
child: FlutterMap(
|
||||||
|
mapController: mapStateInstance.mapController,
|
||||||
|
options: MapOptions(
|
||||||
|
maxZoom: 18.4,
|
||||||
|
onMapReady: () {
|
||||||
|
// indexController.is_mapController_loaded.value = true;
|
||||||
|
subscription = mapStateInstance.mapController?.mapEventStream
|
||||||
|
.listen((MapEvent mapEvent) {
|
||||||
|
if (mapEvent is MapEventMoveStart) {
|
||||||
|
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||||
|
// do something
|
||||||
|
}
|
||||||
|
// if (mapEvent is MapEventMoveEnd &&
|
||||||
|
// indexController.currentUser.isEmpty) {
|
||||||
|
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||||
|
// indexController.loadLocationsBound();
|
||||||
|
//indexController.rogMapController!.move(c.center, c.zoom);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
},
|
||||||
|
center: LatLng(37.15319600454702, 139.58765950528198),
|
||||||
|
//bounds:
|
||||||
|
zoom: 18,
|
||||||
|
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
|
|
||||||
|
onPositionChanged: (MapPosition pos, isvalue) {
|
||||||
|
//indexController.currentBound = [pos.bounds!];
|
||||||
|
},
|
||||||
|
// onTap: (_, __) => popupController
|
||||||
|
// .hideAllPopups(), // Hide popup when the map is tapped.
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const BaseLayer(),
|
||||||
|
CurrentLocationLayer(
|
||||||
|
followOnLocationUpdate: FollowOnLocationUpdate.once,
|
||||||
|
turnOnHeadingUpdate: TurnOnHeadingUpdate.never,
|
||||||
|
style: const LocationMarkerStyle(
|
||||||
|
marker: DefaultLocationMarker(
|
||||||
|
child: Icon(
|
||||||
|
Icons.navigation,
|
||||||
|
color: Colors.yellowAccent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
markerSize: Size(27, 27),
|
||||||
|
markerDirection: MarkerDirection.heading,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const MarkerLayer(markers: [])
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
126
lib/nrog/pages/permission_page.dart
Normal file
126
lib/nrog/pages/permission_page.dart
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:rogapp/nrog/pages/auth_page.dart';
|
||||||
|
|
||||||
|
class PermissionPage extends StatefulWidget {
|
||||||
|
const PermissionPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<PermissionPage> createState() => _PermissionPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PermissionPageState extends State<PermissionPage> {
|
||||||
|
bool hasNavigated = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_checkPermissionStatus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_checkPermissionStatus() async {
|
||||||
|
PermissionStatus status = await Permission.location.status;
|
||||||
|
|
||||||
|
if (status.isGranted == false) {
|
||||||
|
if (context.mounted) {
|
||||||
|
showAlert(context);
|
||||||
|
}
|
||||||
|
} else if (status.isPermanentlyDenied) {
|
||||||
|
await requestPermission();
|
||||||
|
} else {
|
||||||
|
if (mounted) {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (_) => const AuthPage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Text(""),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showAlert(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => AlertDialog(
|
||||||
|
title: const Text('ロケーション許可'),
|
||||||
|
content: const SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text('このアプリでは、位置情報の収集を行います。'),
|
||||||
|
Text(
|
||||||
|
'岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
requestPermission();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> requestPermission() async {
|
||||||
|
PermissionStatus permission = await Permission.location.status;
|
||||||
|
if (permission == PermissionStatus.permanentlyDenied) {
|
||||||
|
showPermanentAlert();
|
||||||
|
} else {
|
||||||
|
PermissionStatus newPermission = await Permission.location.request();
|
||||||
|
if (newPermission != PermissionStatus.granted) {
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
if (context.mounted) {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(MaterialPageRoute(builder: (_) => const AuthPage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showPermanentAlert() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => AlertDialog(
|
||||||
|
title: const Text('無効'),
|
||||||
|
content: const SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text('位置情報が無効になっています'),
|
||||||
|
Text(
|
||||||
|
'このアプリケーションへの位置情報アクセスが無効になっています。続行するには設定>プライバシーとセキュリティ>位置情報サービス>岐阜ナビ で有効にしてください。'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () async {
|
||||||
|
await openAppSettings().then(
|
||||||
|
(value) async {
|
||||||
|
if (value) {
|
||||||
|
if (await Permission
|
||||||
|
.location.status.isPermanentlyDenied ==
|
||||||
|
true &&
|
||||||
|
await Permission.location.status.isGranted ==
|
||||||
|
false) {
|
||||||
|
requestPermission(); /* opens app settings until permission is granted */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,124 +4,281 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/model/location_response.dart';
|
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/services/external_service.dart';
|
import 'package:rogapp/services/external_service.dart';
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
String getTagText(bool isRecept, String? tags) {
|
||||||
|
if (tags == null || tags.isEmpty) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> tts = tags.split(" ");
|
||||||
|
List<String> ttt = tags.split(" ");
|
||||||
|
if (isRecept) {
|
||||||
|
if (ttt.length > tts.length && ttt.length > 1) {
|
||||||
|
return ttt[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isRecept) {
|
||||||
|
if (ttt.length > tts.length && ttt.length > 1) {
|
||||||
|
return ttt[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isRecept) {
|
||||||
|
return tts[0];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
Image getDisplayImage(Destination destination) {
|
||||||
|
String serverUrl = ConstValues.currentServer();
|
||||||
|
|
||||||
|
Image img = Image.asset("assets/images/empty_image.png");
|
||||||
|
if (destination.phone == null) {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destination.photos!.contains('http')) {
|
||||||
|
return Image(
|
||||||
|
image: NetworkImage(
|
||||||
|
destination.phone!,
|
||||||
|
),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
|
return Image.asset("assets/images/empty_image.png");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Image(
|
||||||
|
image: NetworkImage(
|
||||||
|
'$serverUrl/media/compressed/${destination.photos}',
|
||||||
|
),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
|
return Image.asset("assets/images/empty_image.png");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageProvider getFinishImage() {
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
if (destinationController.photos.isNotEmpty) {
|
||||||
|
return FileImage(destinationController.photos[0]);
|
||||||
|
} else {
|
||||||
|
return const AssetImage('assets/images/empty_image.png');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageProvider getReceiptImage() {
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
if (destinationController.photos.isNotEmpty) {
|
||||||
|
return FileImage(destinationController.photos[0]);
|
||||||
|
} else {
|
||||||
|
return const AssetImage('assets/images/money.png');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class CameraPage extends StatelessWidget {
|
class CameraPage extends StatelessWidget {
|
||||||
Feature? destination;
|
bool? manulaCheckin = false;
|
||||||
CameraPage({Key? key, this.destination}) : super(key: key);
|
bool? buyPointPhoto = false;
|
||||||
DestinationController destinationController = Get.find<DestinationController>();
|
Destination destination;
|
||||||
|
Destination? dbDest;
|
||||||
|
String? initImage;
|
||||||
|
CameraPage(
|
||||||
|
{Key? key,
|
||||||
|
required this.destination,
|
||||||
|
this.dbDest,
|
||||||
|
this.manulaCheckin,
|
||||||
|
this.buyPointPhoto,
|
||||||
|
this.initImage})
|
||||||
|
: super(key: key);
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
IndexController indexController = Get.find<IndexController>();
|
IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
|
var settingGoal = false.obs;
|
||||||
|
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
|
|
||||||
ImageProvider getFinishImage(){
|
Widget getAction(BuildContext context) {
|
||||||
if(destinationController.photos.isNotEmpty){
|
//print("----cccheckin is --- ${dbDest?.checkedin} ----");
|
||||||
return FileImage(destinationController.photos[0]);
|
if (manulaCheckin == true) {
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
destinationController.openCamera(context, destination);
|
||||||
|
},
|
||||||
|
child: const Text("撮影")),
|
||||||
|
Obx(() => destinationController.photos.isNotEmpty
|
||||||
|
? ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||||
|
onPressed: () async {
|
||||||
|
await destinationController.makeCheckin(destination, true,
|
||||||
|
destinationController.photos[0].path);
|
||||||
|
Get.back();
|
||||||
|
destinationController.rogainingCounted.value = true;
|
||||||
|
destinationController.skipGps = false;
|
||||||
|
destinationController.isPhotoShoot.value = false;
|
||||||
|
Get.snackbar("チェックインしました。",
|
||||||
|
"${destination.sub_loc_id} : ${destination.name}");
|
||||||
|
},
|
||||||
|
child: const Text("チェックイン"))
|
||||||
|
: Container())
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
return AssetImage('assets/images/empty_image.png');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget getAction(BuildContext context){
|
if (destinationController.isAtGoal.value &&
|
||||||
if(destinationController.is_at_goal.value && destinationController.is_in_rog.value){
|
destinationController.isInRog.value &&
|
||||||
|
destination.cp == -1) {
|
||||||
|
//goal
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: () {
|
||||||
destinationController.openCamera(context);
|
if (settingGoal.value == false) {
|
||||||
},
|
destinationController.openCamera(context, destination);
|
||||||
child: Text("take_photo of the clock".tr)
|
}
|
||||||
),
|
},
|
||||||
Obx(() =>
|
child: Text("take_photo of the clock".tr)),
|
||||||
destinationController.photos.isNotEmpty ?
|
Obx(() => destinationController.photos.isNotEmpty
|
||||||
ElevatedButton(
|
? settingGoal.value == false
|
||||||
style: ElevatedButton.styleFrom(
|
? ElevatedButton(
|
||||||
primary: Colors.red
|
style:
|
||||||
),
|
ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||||
onPressed: (){
|
onPressed: () async {
|
||||||
int user_id = indexController.currentUser[0]["user"]["id"];
|
// print(
|
||||||
//print("--- Pressed -----");
|
// "----- user isss ${indexController.currentUser[0]} -----");
|
||||||
String _team = indexController.currentUser[0]["user"]['team_name'];
|
|
||||||
//print("--- _team : ${_team}-----");
|
settingGoal.value = true;
|
||||||
String _event_code = indexController.currentUser[0]["user"]["event_code"];
|
try {
|
||||||
//print("--- _event_code : ${_event_code}-----");
|
int userId =
|
||||||
String _token = indexController.currentUser[0]["token"];
|
indexController.currentUser[0]["user"]["id"];
|
||||||
//print("--- _token : ${_token}-----");
|
//print("--- Pressed -----");
|
||||||
DateTime now = DateTime.now();
|
String team = indexController.currentUser[0]["user"]
|
||||||
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
|
['team_name'];
|
||||||
|
//print("--- _team : ${_team}-----");
|
||||||
ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
String eventCode = indexController.currentUser[0]
|
||||||
print("---called ext api ${value['status']} ------");
|
["user"]["event_code"];
|
||||||
if(value['status'] == 'OK'){
|
//print("--- _event_code : ${_event_code}-----");
|
||||||
Get.back();
|
String token =
|
||||||
destinationController.skip_gps = false;
|
indexController.currentUser[0]["token"];
|
||||||
Get.snackbar("目標が保存されました", "目標が正常に追加されました");
|
//print("--- _token : ${_token}-----");
|
||||||
destinationController.resetRogaining();
|
DateTime now = DateTime.now();
|
||||||
}
|
String formattedDate =
|
||||||
else{
|
DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
|
||||||
print("---- status ${value['status']} ---- ");
|
|
||||||
Get.snackbar("目標が追加されていません", "please_try_again");
|
await ExternalService()
|
||||||
}
|
.makeGoal(
|
||||||
});
|
userId,
|
||||||
},
|
token,
|
||||||
child: Text("finish_goal".tr)
|
team,
|
||||||
):
|
destinationController.photos[0].path,
|
||||||
Container()
|
formattedDate,
|
||||||
)
|
eventCode)
|
||||||
],
|
.then((value) {
|
||||||
);
|
// print(
|
||||||
}
|
// "---called ext api ${value['status']} ------");
|
||||||
else{
|
if (value['status'] == 'OK') {
|
||||||
|
Get.back();
|
||||||
|
destinationController.skipGps = false;
|
||||||
|
Get.snackbar("目標が保存されました", "目標が正常に追加されました");
|
||||||
|
destinationController.resetRogaining(
|
||||||
|
isgoal: true);
|
||||||
|
} else {
|
||||||
|
//print("---- status ${value['status']} ---- ");
|
||||||
|
Get.snackbar("目標が追加されていません", "please_try_again");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} on Exception catch (_) {
|
||||||
|
settingGoal.value = false;
|
||||||
|
} finally {
|
||||||
|
settingGoal.value = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text("finish_goal".tr))
|
||||||
|
: const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: Container())
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else if (destinationController.isInRog.value &&
|
||||||
|
dbDest?.checkedin != null &&
|
||||||
|
destination.cp != -1 &&
|
||||||
|
dbDest?.checkedin == true) {
|
||||||
|
//make buypoint image
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Obx(() =>
|
Obx(() => ElevatedButton(
|
||||||
ElevatedButton(
|
onPressed: () {
|
||||||
onPressed: (){
|
destinationController.openCamera(context, destination);
|
||||||
destinationController.openCamera(context);
|
},
|
||||||
},
|
child: destinationController.photos.isNotEmpty
|
||||||
child: destinationController.photos.length > 0 ? Text("再撮影") : Text("撮影")
|
? const Text("再撮影")
|
||||||
)
|
: const Text("撮影"))),
|
||||||
),
|
Obx(() => destinationController.photos.isNotEmpty
|
||||||
Obx(() =>
|
? ElevatedButton(
|
||||||
destinationController.photos.isNotEmpty ?
|
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||||
ElevatedButton(
|
onPressed: () async {
|
||||||
style: ElevatedButton.styleFrom(
|
// print(
|
||||||
primary: Colors.red
|
// "##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||||
),
|
await destinationController.makeBuyPoint(
|
||||||
onPressed: (){
|
destination, destinationController.photos[0].path);
|
||||||
print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
Get.back();
|
||||||
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true, destinationController.photos[0].path);
|
destinationController.rogainingCounted.value = true;
|
||||||
Get.back();
|
destinationController.skipGps = false;
|
||||||
destinationController.rogaining_counted.value = true;
|
destinationController.isPhotoShoot.value = false;
|
||||||
destinationController.skip_gps = false;
|
Get.snackbar("お買い物加点を行いました。",
|
||||||
destinationController.is_photo_shoot.value = false;
|
"${destination.sub_loc_id} : ${destination.name}");
|
||||||
Get.snackbar("チェックインした", "正常にチェックインしました");
|
},
|
||||||
|
child: const Text("レシートの写真を撮る"))
|
||||||
// ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
: Container())
|
||||||
// print("---called ext api ${value['status']} ------");
|
],
|
||||||
// if(value['status'] == 'OK'){
|
);
|
||||||
// Get.back();
|
} else {
|
||||||
// destinationController.skip_gps = false;
|
return Row(
|
||||||
// Get.snackbar("Checked in", "Checked in successfuly");
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
// }
|
children: [
|
||||||
// else{
|
Obx(() => ElevatedButton(
|
||||||
// print("---- status ${value['status']} ---- ");
|
onPressed: () {
|
||||||
// Get.snackbar("Checkin not added", "please_try_again");
|
destinationController.openCamera(context, destination);
|
||||||
// }
|
},
|
||||||
// });
|
child: destinationController.photos.isNotEmpty
|
||||||
},
|
? const Text("再撮影")
|
||||||
child: Text("チェックイン")
|
: const Text("撮影"))),
|
||||||
):
|
Obx(() => destinationController.photos.isNotEmpty
|
||||||
Container()
|
? ElevatedButton(
|
||||||
)
|
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||||
],
|
onPressed: () async {
|
||||||
);
|
// print(
|
||||||
|
// "##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||||
|
await destinationController.makeCheckin(
|
||||||
|
indexController.currentDestinationFeature[0],
|
||||||
|
true,
|
||||||
|
destinationController.photos[0].path);
|
||||||
|
Get.back();
|
||||||
|
destinationController.rogainingCounted.value = true;
|
||||||
|
destinationController.skipGps = false;
|
||||||
|
destinationController.isPhotoShoot.value = false;
|
||||||
|
Get.snackbar(
|
||||||
|
"チェックインしました",
|
||||||
|
indexController.currentDestinationFeature[0].name ??
|
||||||
|
"");
|
||||||
|
},
|
||||||
|
child: const Text("チェックイン"))
|
||||||
|
: Container())
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,127 +288,230 @@ class CameraPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if(destinationController.is_in_rog.value){
|
//print("---- photos ${destination.photos} ----");
|
||||||
|
if (buyPointPhoto == true) {
|
||||||
|
//print("--- buy point camera ${destination.toString()}");
|
||||||
|
return BuyPointCamera(destination: destination);
|
||||||
|
} else if (destinationController.isInRog.value) {
|
||||||
|
//print("-----tags camera page----- ${destination.tags}");
|
||||||
|
//print("--- in normal camera ${destination.toString()}");
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar:
|
appBar: destinationController.isInRog.value &&
|
||||||
destinationController.is_in_rog.value && destinationController.rogaining_counted.value == true ?
|
destinationController.rogainingCounted.value == true
|
||||||
AppBar(
|
? AppBar(
|
||||||
title: destination!.properties!.cp == -1 ?
|
automaticallyImplyLeading: false,
|
||||||
Text("finishing_rogaining".tr)
|
title: destination.cp == -1
|
||||||
:
|
? Text("finishing_rogaining".tr)
|
||||||
Text("cp_pls_take_photo".tr)
|
: Text("${destination.sub_loc_id} : ${destination.name}"),
|
||||||
,
|
leading: IconButton(
|
||||||
leading: IconButton(
|
icon: Text("cancel".tr),
|
||||||
icon: Text("cancel".tr),
|
onPressed: () {
|
||||||
onPressed: (){
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
destinationController.skip_10s = true;
|
||||||
destinationController.skip_10s = true;
|
timer =
|
||||||
timer = Timer.periodic(Duration(seconds: 10), (Timer t){
|
Timer.periodic(const Duration(seconds: 10), (Timer t) {
|
||||||
destinationController.skip_10s = false;
|
destinationController.skip_10s = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
)
|
)
|
||||||
:
|
: AppBar(
|
||||||
AppBar(
|
automaticallyImplyLeading: false,
|
||||||
title: Text("チェックポイント"),
|
title: Text("${destination.sub_loc_id} : ${destination.name}"),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: SingleChildScrollView(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
child: Column(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
Padding(
|
children: [
|
||||||
padding: EdgeInsets.all(8.0),
|
Padding(
|
||||||
child: Center(
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Obx(() =>
|
child: Center(
|
||||||
Container(
|
child: Obx(
|
||||||
width: MediaQuery.of(context).size.width,
|
() => Container(
|
||||||
height: 370,
|
width: MediaQuery.of(context).size.width,
|
||||||
decoration: BoxDecoration(
|
height: 370,
|
||||||
image:
|
decoration: BoxDecoration(
|
||||||
DecorationImage(
|
image: DecorationImage(
|
||||||
image: getFinishImage(),
|
image: destinationController.photos.isEmpty
|
||||||
fit: BoxFit.cover
|
? getDisplayImage(destination).image
|
||||||
)
|
: getFinishImage(),
|
||||||
|
fit: BoxFit.cover)),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: Text(getTagText(
|
||||||
|
false,
|
||||||
|
destination.tags,
|
||||||
|
))
|
||||||
|
// child: Obx(() => destinationController.photos.isEmpty == true
|
||||||
|
// ? const Text("撮影してチェックインしてください。")
|
||||||
|
// : const Text("チェックインをタップしてください。")),
|
||||||
|
),
|
||||||
|
getAction(context),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
getAction(context),
|
),
|
||||||
],
|
);
|
||||||
),
|
} else {
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return StartRogaining();
|
return StartRogaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StartRogaining extends StatelessWidget {
|
class StartRogaining extends StatelessWidget {
|
||||||
StartRogaining({Key? key}) : super(key: key);
|
StartRogaining({Key? key}) : super(key: key);
|
||||||
|
|
||||||
DestinationController destinationController = Get.find<DestinationController>();
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Not started yet".tr,),
|
automaticallyImplyLeading: false,
|
||||||
|
title: Text(
|
||||||
|
"Not started yet".tr,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Center(
|
||||||
child: Center(
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)),
|
Text("You have not started rogaining yet.".tr,
|
||||||
SizedBox(height: 40.0,),
|
style: const TextStyle(fontSize: 24)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 40.0,
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
destinationController.skip_gps = false;
|
destinationController.skipGps = false;
|
||||||
},
|
},
|
||||||
child: Text("Back"),
|
child: const Text("Back"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotAtGoal extends StatelessWidget {
|
class BuyPointCamera extends StatelessWidget {
|
||||||
NotAtGoal({Key? key}) : super(key: key);
|
BuyPointCamera({Key? key, required this.destination}) : super(key: key);
|
||||||
|
|
||||||
DestinationController destinationController = Get.find<DestinationController>();
|
Destination destination;
|
||||||
|
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
//print("in camera purchase 1 ${destinationController.isInRog.value}");
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Not reached the goal yet".tr,),
|
automaticallyImplyLeading: false,
|
||||||
),
|
title: Text(
|
||||||
body: Container(
|
"${destination.sub_loc_id} : ${destination.name}",
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text("You have not reached the goal yet.".tr, style: TextStyle(fontSize: 24)),
|
|
||||||
SizedBox(height: 40.0,),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: (){
|
|
||||||
Get.back();
|
|
||||||
destinationController.skip_gps = false;
|
|
||||||
},
|
|
||||||
child: Text("Back"),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
body: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: Obx(
|
||||||
|
() => Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
height: 370,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: getReceiptImage(), fit: BoxFit.cover)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(getTagText(true, destination.tags)),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Obx(() => Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
// print(
|
||||||
|
// "in camera purchase 2 ${destinationController.isInRog.value}");
|
||||||
|
destinationController.openCamera(
|
||||||
|
context, destination);
|
||||||
|
},
|
||||||
|
child: destinationController.photos.isNotEmpty
|
||||||
|
? const Text("再撮影")
|
||||||
|
: const Text("撮影")),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await destinationController
|
||||||
|
.cancelBuyPoint(destination);
|
||||||
|
Navigator.of(Get.context!).pop();
|
||||||
|
//Get.back();
|
||||||
|
destinationController.rogainingCounted.value = true;
|
||||||
|
destinationController.skipGps = false;
|
||||||
|
destinationController.isPhotoShoot.value = false;
|
||||||
|
},
|
||||||
|
child: const Text("買い物なし"))
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Obx(() => destinationController.photos.isNotEmpty
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
// ElevatedButton(
|
||||||
|
// style: ElevatedButton.styleFrom(
|
||||||
|
// backgroundColor: Colors.red),
|
||||||
|
// onPressed: () async {},
|
||||||
|
// child: const Text("買物なし")),
|
||||||
|
// const SizedBox(
|
||||||
|
// width: 10,
|
||||||
|
// ),
|
||||||
|
ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: Colors.red),
|
||||||
|
onPressed: () async {
|
||||||
|
// print(
|
||||||
|
// "in camera purchase 3 ${destinationController.isInRog.value}");
|
||||||
|
await destinationController.makeBuyPoint(
|
||||||
|
destination,
|
||||||
|
destinationController.photos[0].path);
|
||||||
|
Get.back();
|
||||||
|
// print(
|
||||||
|
// "in camera purchase 4 ${destinationController.isInRog.value}");
|
||||||
|
destinationController.rogainingCounted.value =
|
||||||
|
true;
|
||||||
|
destinationController.skipGps = false;
|
||||||
|
destinationController.isPhotoShoot.value = false;
|
||||||
|
Get.snackbar("お買い物加点を行いました",
|
||||||
|
"${destination.sub_loc_id} : ${destination.name}");
|
||||||
|
},
|
||||||
|
child: const Text("完了"))
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container())
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
|
||||||
|
|
||||||
class ChangePasswordPage extends StatelessWidget {
|
class ChangePasswordPage extends StatelessWidget {
|
||||||
ChangePasswordPage({Key? key}) : super(key: key);
|
ChangePasswordPage({Key? key}) : super(key: key);
|
||||||
@ -14,150 +13,170 @@ class ChangePasswordPage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
leading:
|
leading: IconButton(
|
||||||
IconButton( onPressed: (){
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
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:
|
body: SizedBox(
|
||||||
Container(
|
width: double.infinity,
|
||||||
width: double.infinity,
|
child: Column(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Column(
|
||||||
Column(
|
children: [
|
||||||
children: [
|
Column(
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
child: Text("change_password".tr, style: TextStyle(fontSize: 24.0),),
|
|
||||||
),
|
|
||||||
SizedBox(height: 30,),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 40
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
makeInput(label: "old_password".tr, controller: oldPasswordController),
|
Text(
|
||||||
makeInput(label: "new_password".tr, controller: newPasswordController, obsureText: true),
|
"change_password".tr,
|
||||||
|
style: const TextStyle(fontSize: 24.0),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
child: Column(
|
||||||
child: Container(
|
children: [
|
||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
makeInput(
|
||||||
decoration: BoxDecoration(
|
label: "old_password".tr,
|
||||||
borderRadius: BorderRadius.circular(40),
|
controller: oldPasswordController),
|
||||||
),
|
makeInput(
|
||||||
child: Obx((() =>
|
label: "new_password".tr,
|
||||||
indexController.is_loading == true ? MaterialButton(
|
controller: newPasswordController,
|
||||||
minWidth: double.infinity,
|
obsureText: true),
|
||||||
height:60,
|
],
|
||||||
onPressed: (){
|
|
||||||
|
|
||||||
},
|
|
||||||
color: Colors.grey[400],
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
) :
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:60,
|
|
||||||
onPressed: (){
|
|
||||||
if(oldPasswordController.text.isEmpty || newPasswordController.text.isEmpty){
|
|
||||||
Get.snackbar(
|
|
||||||
"no_values".tr,
|
|
||||||
"values_required".tr,
|
|
||||||
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"))
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
indexController.is_loading.value = true;
|
|
||||||
indexController.changePassword(oldPasswordController.text, newPasswordController.text, context);
|
|
||||||
//indexController.login(oldPasswordController.text, newPasswordController.text, context);
|
|
||||||
},
|
|
||||||
color: Colors.indigoAccent[400],
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("ログイン",style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10.0,),
|
|
||||||
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
SizedBox(height: 20,),
|
child: Container(
|
||||||
Row(
|
padding: const EdgeInsets.only(top: 3, left: 3),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
decoration: BoxDecoration(
|
||||||
children: [
|
borderRadius: BorderRadius.circular(40),
|
||||||
|
),
|
||||||
],
|
child: Obx(
|
||||||
)
|
(() => indexController.isLoading.value == true
|
||||||
],
|
? MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
),
|
height: 60,
|
||||||
],
|
onPressed: () {},
|
||||||
),
|
color: Colors.grey[400],
|
||||||
)
|
shape: RoundedRectangleBorder(
|
||||||
);
|
borderRadius: BorderRadius.circular(40)),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
onPressed: () {
|
||||||
|
if (oldPasswordController
|
||||||
|
.text.isEmpty ||
|
||||||
|
newPasswordController
|
||||||
|
.text.isEmpty) {
|
||||||
|
Get.snackbar(
|
||||||
|
"no_values".tr,
|
||||||
|
"values_required".tr,
|
||||||
|
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"))
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
indexController.isLoading.value = true;
|
||||||
|
indexController.changePassword(
|
||||||
|
oldPasswordController.text,
|
||||||
|
newPasswordController.text,
|
||||||
|
context);
|
||||||
|
//indexController.login(oldPasswordController.text, newPasswordController.text, context);
|
||||||
|
},
|
||||||
|
color: Colors.indigoAccent[400],
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: const Text(
|
||||||
|
"ログイン",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
Widget makeInput(
|
||||||
return Column(
|
{label, required TextEditingController controller, obsureText = false}) {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
return Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Text(label,style:TextStyle(
|
children: [
|
||||||
fontSize: 15,
|
Text(
|
||||||
fontWeight: FontWeight.w400,
|
label,
|
||||||
color: Colors.black87
|
style: const TextStyle(
|
||||||
),),
|
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
|
||||||
SizedBox(height: 5,),
|
),
|
||||||
TextField(
|
const SizedBox(
|
||||||
controller: controller,
|
height: 5,
|
||||||
obscureText: obsureText,
|
),
|
||||||
decoration: InputDecoration(
|
TextField(
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
controller: controller,
|
||||||
enabledBorder: OutlineInputBorder(
|
obscureText: obsureText,
|
||||||
borderSide: BorderSide(
|
decoration: InputDecoration(
|
||||||
color: (Colors.grey[400])!,
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: (Colors.grey[400])!,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: (Colors.grey[400])!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
),
|
height: 30.0,
|
||||||
SizedBox(height: 30.0,)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,10 +1,11 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:rogapp/main.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
|
||||||
|
|
||||||
class DestinationBinding extends Bindings {
|
class DestinationBinding extends Bindings {
|
||||||
@override
|
@override
|
||||||
void dependencies() {
|
void dependencies() {
|
||||||
Get.put<DestinationController>(DestinationController());
|
Get.put<DestinationController>(DestinationController());
|
||||||
|
restoreGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,217 +1,252 @@
|
|||||||
import 'dart:developer';
|
// import 'package:flutter/material.dart';
|
||||||
import 'dart:io';
|
// import 'package:geolocator/geolocator.dart';
|
||||||
|
// import 'package:get/get.dart';
|
||||||
|
// import 'package:latlong2/latlong.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/widgets/destination_widget.dart';
|
||||||
|
|
||||||
import 'package:camera_camera/camera_camera.dart';
|
// class XDestnationPage extends StatelessWidget {
|
||||||
import 'package:flutter/material.dart';
|
// XDestnationPage({Key? key}) : super(key: key);
|
||||||
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 {
|
// final DestinationController destinationController =
|
||||||
DestnationPage({Key? key}) : super(key: key);
|
// Get.find<DestinationController>();
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
// final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
// final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||||
|
|
||||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
// Future<void> showCurrentPosition() async {
|
||||||
|
// LocationPermission permission = await Geolocator.checkPermission();
|
||||||
|
// if (permission != LocationPermission.whileInUse ||
|
||||||
|
// permission != LocationPermission.always) {
|
||||||
|
// permission = await Geolocator.requestPermission();
|
||||||
|
// }
|
||||||
|
// Position position = await Geolocator.getCurrentPosition(
|
||||||
|
// desiredAccuracy: LocationAccuracy.high,
|
||||||
|
// forceAndroidLocationManager: true);
|
||||||
|
// indexController.rogMapController
|
||||||
|
// .move(LatLng(position.latitude, position.longitude), 14);
|
||||||
|
// }
|
||||||
|
|
||||||
Future<void> showCurrentPosition() async {
|
// Image getImage(int index) {
|
||||||
LocationPermission permission = await Geolocator.checkPermission();
|
// if (destinationController.destinations[index].photos == null ||
|
||||||
if (permission != LocationPermission.whileInUse ||
|
// destinationController.destinations[index].photos == "") {
|
||||||
permission != LocationPermission.always) {
|
// return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
permission = await Geolocator.requestPermission();
|
// } else {
|
||||||
}
|
// return Image(
|
||||||
Position position = await Geolocator.getCurrentPosition(
|
// image:
|
||||||
desiredAccuracy: LocationAccuracy.high);
|
// NetworkImage(destinationController.destinations[index].photos!));
|
||||||
indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14);
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Image getImage(int index){
|
// Widget getRoutingImage(int route) {
|
||||||
if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){
|
// switch (route) {
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
// case 0:
|
||||||
}
|
// return const Image(
|
||||||
else{
|
// image: AssetImage('assets/images/p4_9_man.png'),
|
||||||
return Image(image: NetworkImage(destinationController.destinations[index].photos!));
|
// width: 35.0,
|
||||||
}
|
// );
|
||||||
}
|
// case 1:
|
||||||
|
// return const Image(
|
||||||
|
// image: AssetImage('assets/images/p4_8_car.png'),
|
||||||
|
// width: 35.0,
|
||||||
|
// );
|
||||||
|
// case 2:
|
||||||
|
// return const Image(
|
||||||
|
// image: AssetImage('assets/images/p4_10_train.png'),
|
||||||
|
// width: 35.0,
|
||||||
|
// );
|
||||||
|
// default:
|
||||||
|
// return const Image(
|
||||||
|
// image: AssetImage('assets/images/p4_9_man.png'),
|
||||||
|
// width: 35.0,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
Widget getRoutingImage(int route){
|
// @override
|
||||||
switch (route) {
|
// Widget build(BuildContext context) {
|
||||||
case 0:
|
// return WillPopScope(
|
||||||
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
// onWillPop: () async {
|
||||||
case 1:
|
// indexController.switchPage(AppPages.INITIAL);
|
||||||
return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,);
|
// return false;
|
||||||
case 2:
|
// },
|
||||||
return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,);
|
// child: Scaffold(
|
||||||
default:
|
// drawer: DrawerPage(),
|
||||||
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
// bottomNavigationBar: BottomAppBar(
|
||||||
}
|
// child: Row(
|
||||||
}
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: <Widget>[
|
||||||
@override
|
// Padding(
|
||||||
Widget build(BuildContext context) {
|
// padding: const EdgeInsets.only(left: 13.0),
|
||||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
// child: InkWell(
|
||||||
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
// child: Obx((() => getRoutingImage(
|
||||||
final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
// destinationController.travelMode.value))),
|
||||||
return WillPopScope(
|
// onTap: () {
|
||||||
onWillPop: () async {
|
// Get.bottomSheet(
|
||||||
indexController.switchPage(AppPages.INITIAL);
|
// Obx(
|
||||||
return false;
|
// () => ListView(
|
||||||
},
|
// children: [
|
||||||
child: Scaffold(
|
// Padding(
|
||||||
drawer: DrawerPage(),
|
// padding: const EdgeInsets.only(
|
||||||
bottomNavigationBar: BottomAppBar(
|
// top: 30.0, bottom: 30),
|
||||||
child: Row(
|
// child: Center(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// child: Text(
|
||||||
children: <Widget>[
|
// "select_travel_mode".tr,
|
||||||
Padding(
|
// style: const TextStyle(
|
||||||
padding: const EdgeInsets.only(left:13.0),
|
// fontSize: 22.0,
|
||||||
child: InkWell(
|
// color: Colors.red,
|
||||||
child: Obx((() => getRoutingImage(destinationController.travelMode.value))),
|
// fontWeight: FontWeight.bold),
|
||||||
onTap: (){
|
// ),
|
||||||
Get.bottomSheet(
|
// ),
|
||||||
Obx(() =>
|
// ),
|
||||||
ListView(
|
// ListTile(
|
||||||
children: [
|
// selected:
|
||||||
Padding(
|
// destinationController.travelMode.value ==
|
||||||
padding: const EdgeInsets.only(top:30.0, bottom: 30),
|
// 0
|
||||||
child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
|
// ? true
|
||||||
),
|
// : false,
|
||||||
ListTile(
|
// selectedTileColor: Colors.amber.shade200,
|
||||||
selected: destinationController.travelMode == 0 ? true : false,
|
// leading: const Image(
|
||||||
selectedTileColor: Colors.amber.shade200,
|
// image: AssetImage(
|
||||||
leading: Image(image: AssetImage('assets/images/p4_9_man.png'),),
|
// 'assets/images/p4_9_man.png'),
|
||||||
title: Text("walking".tr),
|
// ),
|
||||||
onTap:(){
|
// title: Text("walking".tr),
|
||||||
destinationController.travelMode.value = 0;
|
// onTap: () {
|
||||||
destinationController.PopulateDestinations();
|
// destinationController.travelMode.value = 0;
|
||||||
Get.back();
|
// destinationController
|
||||||
},
|
// .populateDestinations();
|
||||||
),
|
// Get.back();
|
||||||
ListTile(
|
// },
|
||||||
selected: destinationController.travelMode == 1 ? true : false,
|
// ),
|
||||||
selectedTileColor: Colors.amber.shade200,
|
// ListTile(
|
||||||
leading: Image(image: AssetImage('assets/images/p4_8_car.png'),),
|
// selected:
|
||||||
title: Text("driving".tr),
|
// destinationController.travelMode.value ==
|
||||||
onTap:(){
|
// 1
|
||||||
destinationController.travelMode.value = 1;
|
// ? true
|
||||||
destinationController.PopulateDestinations();
|
// : false,
|
||||||
Get.back();
|
// selectedTileColor: Colors.amber.shade200,
|
||||||
},
|
// leading: const Image(
|
||||||
),
|
// image: AssetImage(
|
||||||
// ListTile(
|
// 'assets/images/p4_8_car.png'),
|
||||||
// selected: destinationController.travelMode == 2 ? true : false,
|
// ),
|
||||||
// selectedTileColor: Colors.amber.shade200,
|
// title: Text("driving".tr),
|
||||||
// leading: Image(image: AssetImage('assets/images/p4_10_train.png'),),
|
// onTap: () {
|
||||||
// title: Text("transit".tr),
|
// destinationController.travelMode.value = 1;
|
||||||
// onTap:(){
|
// destinationController
|
||||||
// destinationController.travelMode.value = 2;
|
// .populateDestinations();
|
||||||
// destinationController.PopulateDestinations();
|
// Get.back();
|
||||||
// Get.back();
|
// },
|
||||||
// },
|
// ),
|
||||||
// ),
|
// // ListTile(
|
||||||
],
|
// // selected: destinationController.travelMode == 2 ? true : false,
|
||||||
|
// // selectedTileColor: Colors.amber.shade200,
|
||||||
),
|
// // leading: Image(image: AssetImage('assets/images/p4_10_train.png'),),
|
||||||
),
|
// // title: Text("transit".tr),
|
||||||
isScrollControlled:false,
|
// // onTap:(){
|
||||||
backgroundColor: Colors.white,
|
// // destinationController.travelMode.value = 2;
|
||||||
);
|
// // destinationController.PopulateDestinations();
|
||||||
//destinationController.PopulateDestinations();
|
// // Get.back();
|
||||||
}
|
// // },
|
||||||
),
|
// // ),
|
||||||
)
|
// ],
|
||||||
,
|
// ),
|
||||||
IconButton(
|
// ),
|
||||||
icon: const Icon(Icons.travel_explore, size: 35,),
|
// isScrollControlled: false,
|
||||||
onPressed: (){
|
// backgroundColor: Colors.white,
|
||||||
indexController.switchPage(AppPages.INITIAL);
|
// );
|
||||||
}
|
// //destinationController.PopulateDestinations();
|
||||||
),
|
// }),
|
||||||
],
|
// ),
|
||||||
),
|
// IconButton(
|
||||||
),
|
// icon: const Icon(
|
||||||
floatingActionButton: FloatingActionButton(
|
// Icons.travel_explore,
|
||||||
onPressed: (){
|
// size: 35,
|
||||||
//print("######");
|
// ),
|
||||||
indexController.toggleDestinationMode();
|
// onPressed: () {
|
||||||
},
|
// indexController.switchPage(AppPages.INITIAL);
|
||||||
tooltip: 'Increment',
|
// }),
|
||||||
child: Obx(() =>
|
// ],
|
||||||
indexController.desination_mode == 1 ?
|
// ),
|
||||||
Image(image: AssetImage('assets/images/list2.png'))
|
// ),
|
||||||
:
|
// floatingActionButton: FloatingActionButton(
|
||||||
Image(image: AssetImage('assets/images/map.png'))
|
// onPressed: () {
|
||||||
),
|
// //print("######");
|
||||||
elevation: 4.0,
|
// indexController.toggleDestinationMode();
|
||||||
),
|
// },
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
// tooltip: 'Increment',
|
||||||
appBar:AppBar(
|
// elevation: 4.0,
|
||||||
automaticallyImplyLeading: true,
|
// child: Obx(() => indexController.desinationMode.value == 1
|
||||||
title: Text("app_title".tr),
|
// ? const Image(image: AssetImage('assets/images/list2.png'))
|
||||||
actions: [
|
// : const Image(image: AssetImage('assets/images/map.png'))),
|
||||||
InkWell(
|
// ),
|
||||||
onTap: (){
|
// floatingActionButtonLocation:
|
||||||
Get.toNamed(AppPages.CAMERA_PAGE);
|
// FloatingActionButtonLocation.centerDocked,
|
||||||
},
|
// appBar: AppBar(
|
||||||
child: destinationController.is_in_rog == true ?
|
// automaticallyImplyLeading: true,
|
||||||
Image.asset("assets/images/basic-walking.gif",height: 10.0,)
|
// title: Text("app_title".tr),
|
||||||
:
|
// actions: [
|
||||||
destinationController.is_at_goal == true ?
|
// InkWell(
|
||||||
IconButton(
|
// onTap: () {
|
||||||
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
|
// Get.toNamed(AppPages.CAMERA_PAGE);
|
||||||
icon: Icon(Icons.assistant_photo),
|
// },
|
||||||
)
|
// child: destinationController.isInRog.value == true
|
||||||
:
|
// ? Image.asset(
|
||||||
IconButton(
|
// "assets/images/basic-walking.gif",
|
||||||
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
|
// height: 10.0,
|
||||||
icon: Icon(Icons.accessibility),
|
// )
|
||||||
),
|
// : destinationController.isAtGoal.value == true
|
||||||
),
|
// ? IconButton(
|
||||||
// Obx(() =>
|
// onPressed: () {
|
||||||
// Text(indexController.connectionStatusName.value)
|
// Get.toNamed(AppPages.CAMERA_PAGE);
|
||||||
// ),
|
// },
|
||||||
Obx(() =>
|
// icon: const Icon(Icons.assistant_photo),
|
||||||
ToggleButtons(
|
// )
|
||||||
disabledColor: Colors.grey.shade200,
|
// : IconButton(
|
||||||
selectedColor: Colors.red,
|
// onPressed: () {
|
||||||
children: <Widget>[
|
// Get.toNamed(AppPages.CAMERA_PAGE);
|
||||||
Icon(Icons.explore, size: 35.0,
|
// },
|
||||||
)],
|
// icon: const Icon(Icons.accessibility),
|
||||||
onPressed: (int index) {
|
// ),
|
||||||
destinationController.is_gps_selected.value = !destinationController.is_gps_selected.value;
|
// ),
|
||||||
if(destinationController.is_gps_selected.value){
|
// // Obx(() =>
|
||||||
destinationController.chekcs = 0;
|
// // Text(indexController.connectionStatusName.value)
|
||||||
destinationController.skip_gps = false;
|
// // ),
|
||||||
//destinationController.resetRogaining();
|
// Obx(
|
||||||
}
|
// () => ToggleButtons(
|
||||||
},
|
// disabledColor: Colors.grey.shade200,
|
||||||
isSelected: [destinationController.is_gps_selected.value],
|
// selectedColor: Colors.red,
|
||||||
),
|
// onPressed: (int index) {
|
||||||
),
|
// destinationController.isGpsSelected.value =
|
||||||
// IconButton(onPressed: (){
|
// !destinationController.isGpsSelected.value;
|
||||||
// showCurrentPosition();
|
// if (destinationController.isGpsSelected.value) {
|
||||||
// },
|
// destinationController.chekcs = 0;
|
||||||
// icon: Icon(Icons.location_on_outlined))
|
// destinationController.skipGps = false;
|
||||||
],
|
// //destinationController.resetRogaining();
|
||||||
),
|
// }
|
||||||
body: Obx(() =>
|
// },
|
||||||
indexController.desination_mode.value == 0 ?
|
// isSelected: [destinationController.isGpsSelected.value],
|
||||||
DestinationWidget():
|
// children: const <Widget>[
|
||||||
DestinationMapPage()
|
// Icon(
|
||||||
)
|
// Icons.explore,
|
||||||
),
|
// size: 35.0,
|
||||||
);
|
// )
|
||||||
|
// ],
|
||||||
}
|
// ),
|
||||||
}
|
// ),
|
||||||
|
// // IconButton(onPressed: (){
|
||||||
|
// // showCurrentPosition();
|
||||||
|
// // },
|
||||||
|
// // icon: Icon(Icons.location_on_outlined))
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// body: Obx(() => indexController.desinationMode.value == 0
|
||||||
|
// ? DestinationWidget()
|
||||||
|
// : DestinationMapPage())),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,437 +1,176 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.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_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:flutter_polyline_points/flutter_polyline_points.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
|
||||||
import 'package:geolocator/geolocator.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_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/utils/text_util.dart';
|
||||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.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 {
|
class DestinationMapPage extends StatelessWidget {
|
||||||
DestinationMapPage({Key? key}) : super(key: key);
|
DestinationMapPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
StreamSubscription? subscription;
|
StreamSubscription? subscription;
|
||||||
final PopupController _popupLayerController = PopupController();
|
final PopupController _popupLayerController = PopupController();
|
||||||
|
|
||||||
List<LatLng>? getPoints(){
|
List<LatLng>? getPoints() {
|
||||||
print("##### --- route point ${indexController.routePoints.length}");
|
//print("##### --- route point ${indexController.routePoints.length}");
|
||||||
List<LatLng> pts = [];
|
List<LatLng> pts = [];
|
||||||
for(PointLatLng p in indexController.routePoints){
|
for (PointLatLng p in indexController.routePoints) {
|
||||||
LatLng l = LatLng(p.latitude, p.longitude);
|
LatLng l = LatLng(p.latitude, p.longitude);
|
||||||
pts.add(l);
|
pts.add(l);
|
||||||
}
|
|
||||||
return pts;
|
|
||||||
}
|
}
|
||||||
|
return pts;
|
||||||
|
}
|
||||||
|
|
||||||
List<Marker>? getMarkers() {
|
List<Marker>? getMarkers() {
|
||||||
List<Marker> pts = [];
|
List<Marker> pts = [];
|
||||||
int index = -1;
|
int index = -1;
|
||||||
for (int i = 0; i < destinationController.destinations.length; i++) {
|
for (int i = 0; i < destinationController.destinations.length; i++) {
|
||||||
Destination d = destinationController.destinations[i];
|
Destination d = destinationController.destinations[i];
|
||||||
print("^^^^ ${d} ^^^^");
|
//print("^^^^ $d ^^^^");
|
||||||
Marker m = Marker(
|
Marker m = Marker(
|
||||||
point: LatLng(d.lat!, d.lon!),
|
point: LatLng(d.lat!, d.lon!),
|
||||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
alignment: Alignment.center,
|
||||||
builder:(cts){
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
//print("-- Destination is --- ${d.name} ------");
|
||||||
|
if (indexController.currentDestinationFeature.isNotEmpty) {
|
||||||
|
indexController.currentDestinationFeature.clear();
|
||||||
|
}
|
||||||
|
indexController.currentDestinationFeature.add(d);
|
||||||
|
//indexController.getAction();
|
||||||
|
|
||||||
return InkWell(
|
showModalBottomSheet(
|
||||||
onTap: (){
|
context: Get.context!,
|
||||||
print("-- Destination is --- ${d.name} ------");
|
isScrollControlled: true,
|
||||||
if(d != null){
|
constraints:
|
||||||
if(indexController.currentDestinationFeature.length > 0) {
|
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
|
||||||
indexController.currentDestinationFeature.clear();
|
builder: ((context) => BottomSheetNew(
|
||||||
}
|
destination: d,
|
||||||
indexController.currentDestinationFeature.add(d);
|
))).whenComplete(() {
|
||||||
//indexController.getAction();
|
//print("---- set skip gps to false -----");
|
||||||
|
destinationController.skipGps = false;
|
||||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
});
|
||||||
builder:((context) => BottomSheetNew())
|
},
|
||||||
).whenComplete((){
|
child: Row(
|
||||||
print("---- set skip gps to false -----");
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
destinationController.skip_gps = false;
|
children: [
|
||||||
});
|
Container(
|
||||||
}
|
width: 20,
|
||||||
},
|
height: 20,
|
||||||
child: Row(
|
decoration: BoxDecoration(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
color: Colors.red,
|
||||||
children: [
|
shape: BoxShape.circle,
|
||||||
Container(
|
border: Border.all(
|
||||||
width:20,
|
color: Colors.white,
|
||||||
height:20,
|
width: d.checkin_radious != null ? d.checkin_radious! : 1,
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.red,
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
border: new Border.all(
|
|
||||||
color: Colors.white,
|
|
||||||
width: d.checkin_radious != null ? d.checkin_radious! : 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: new Center(
|
|
||||||
child: new Text(
|
|
||||||
(i + 1).toString(),
|
|
||||||
style: TextStyle(color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
//Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
child: Center(
|
||||||
],
|
child: Text(
|
||||||
),
|
(i + 1).toString(),
|
||||||
);
|
style: const TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
});
|
),
|
||||||
|
),
|
||||||
pts.add(m);
|
Container(
|
||||||
}
|
color: Colors.yellow,
|
||||||
return pts;
|
child: Text(
|
||||||
|
TextUtils.getDisplayText(d),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
overflow: TextOverflow.visible),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
pts.add(m);
|
||||||
}
|
}
|
||||||
|
return pts;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx((() =>
|
return Obx((() => Stack(
|
||||||
Stack(
|
children: [
|
||||||
children: [
|
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
||||||
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
// Center(child: CircularProgressIndicator())
|
||||||
// Center(child: CircularProgressIndicator())
|
// :
|
||||||
// :
|
// Padding(
|
||||||
// Padding(
|
// padding: const EdgeInsets.only(left:8.0),
|
||||||
// padding: const EdgeInsets.only(left:8.0),
|
// child: BreadCrumbWidget(mapController:indexController.rogMapController),
|
||||||
// child: BreadCrumbWidget(mapController:indexController.rogMapController),
|
// ),
|
||||||
// ),
|
Padding(
|
||||||
Padding(
|
padding: const EdgeInsets.only(top: 0.0),
|
||||||
padding: const EdgeInsets.only(top:0.0),
|
//child: TravelMap(),
|
||||||
//child: TravelMap(),
|
child: travelMap(),
|
||||||
child:
|
),
|
||||||
TravelMap(),
|
],
|
||||||
),
|
)));
|
||||||
],
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FlutterMap TravelMap() {
|
FlutterMap travelMap() {
|
||||||
return FlutterMap(
|
return FlutterMap(
|
||||||
mapController: indexController.rogMapController,
|
mapController: indexController.rogMapController,
|
||||||
options: MapOptions(
|
options: MapOptions(
|
||||||
onMapReady: (){
|
onMapReady: () {
|
||||||
indexController.is_rog_mapcontroller_loaded.value = true;
|
indexController.isRogMapcontrollerLoaded.value = true;
|
||||||
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
subscription = indexController.rogMapController.mapEventStream
|
||||||
if (mapEvent is MapEventMoveStart) {
|
.listen((MapEvent mapEvent) {
|
||||||
}
|
if (mapEvent is MapEventMoveStart) {}
|
||||||
if (mapEvent is MapEventMoveEnd) {
|
if (mapEvent is MapEventMoveEnd) {
|
||||||
//destinationController.is_gps_selected.value = true;
|
//destinationController.is_gps_selected.value = true;
|
||||||
//indexController.mapController!.move(c.center, c.zoom);
|
//indexController.mapController!.move(c.center, c.zoom);
|
||||||
LatLngBounds bounds = indexController.rogMapController!.bounds!;
|
LatLngBounds bounds = indexController.rogMapController.bounds!;
|
||||||
indexController.currentBound.clear();
|
indexController.currentBound.clear();
|
||||||
indexController.currentBound.add(bounds);
|
indexController.currentBound.add(bounds);
|
||||||
if(indexController.currentUser.length <= 0){
|
if (indexController.currentUser.isEmpty) {
|
||||||
indexController.loadLocationsBound();
|
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
|
||||||
zoom: 1,
|
? indexController.currentBound[0]
|
||||||
maxZoom: 42,
|
: LatLngBounds.fromPoints([
|
||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
LatLng(35.03999881162295, 136.40587119778962),
|
||||||
),
|
LatLng(36.642756778706904, 137.95226720406063)
|
||||||
children: [
|
]),
|
||||||
BaseLayer(),
|
zoom: 1,
|
||||||
Obx(() =>
|
maxZoom: 42,
|
||||||
indexController.routePointLenght > 0 ?
|
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||||
PolylineLayer(
|
|
||||||
polylines: [
|
|
||||||
Polyline(
|
|
||||||
points: getPoints()!,
|
|
||||||
strokeWidth: 6.0,
|
|
||||||
color: Colors.indigo
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
:
|
|
||||||
Container(),
|
|
||||||
),
|
),
|
||||||
CurrentLocationLayer(),
|
children: [
|
||||||
MarkerLayer(
|
const BaseLayer(),
|
||||||
markers: getMarkers()!
|
Obx(
|
||||||
),
|
() => indexController.routePointLenght > 0
|
||||||
],
|
? PolylineLayer(
|
||||||
|
polylines: [
|
||||||
);
|
Polyline(
|
||||||
|
points: getPoints()!,
|
||||||
|
strokeWidth: 6.0,
|
||||||
|
color: Colors.indigo),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
),
|
||||||
|
CurrentLocationLayer(),
|
||||||
|
MarkerLayer(markers: getMarkers()!),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// class DestinationMapPage extends StatefulWidget {
|
|
||||||
// DestinationMapPage({ Key? key }) : super(key: key);
|
|
||||||
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// State<DestinationMapPage> createState() => _DestinationMapPageState();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//class _DestinationMapPageState extends State<DestinationMapPage> {
|
|
||||||
// final IndexController indexController = Get.find<IndexController>();
|
|
||||||
|
|
||||||
// final DestinationController destinationController = Get.find<DestinationController>();
|
|
||||||
// StreamSubscription? subscription;
|
|
||||||
// final PopupController _popupLayerController = PopupController();
|
|
||||||
|
|
||||||
// List<LatLng>? getPoints(List<PointLatLng> ptts){
|
|
||||||
// //print("##### --- route point ${indexController.routePoints.length}");
|
|
||||||
// List<LatLng> pts = [];
|
|
||||||
// for(PointLatLng p in ptts){
|
|
||||||
// LatLng l = LatLng(p.latitude, p.longitude);
|
|
||||||
// pts.add(l);
|
|
||||||
// }
|
|
||||||
// return pts;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// String getDisplaytext(Destination dp){
|
|
||||||
// String txt = "";
|
|
||||||
// if(dp.cp! > 0){
|
|
||||||
// txt = "${dp.cp}";
|
|
||||||
// if(dp.checkin_point != null && dp.checkin_point! > 0){
|
|
||||||
// txt = txt + "{${dp.checkin_point}}";
|
|
||||||
// }
|
|
||||||
// if(dp.buy_point != null && dp.buy_point! > 0){
|
|
||||||
// txt = txt + "[${dp.buy_point}]";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return txt;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// List<Marker>? getMarkers() {
|
|
||||||
// List<Marker> pts = [];
|
|
||||||
// int index = -1;
|
|
||||||
// for (int i = 0; i < destinationController.destinations.length; i++) {
|
|
||||||
// Destination d = destinationController.destinations[i];
|
|
||||||
// //for(Destination d in destinationController.destinations){
|
|
||||||
// //print("-----lat ${lat}, ----- lon ${lan}");
|
|
||||||
// Marker m = Marker(
|
|
||||||
// point: LatLng(d.lat!, d.lon!),
|
|
||||||
// anchorPos: AnchorPos.align(AnchorAlign.center),
|
|
||||||
// builder:(cts){
|
|
||||||
|
|
||||||
// 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: context, isScrollControlled: true,
|
|
||||||
// //builder:((context) => BottomSheetWidget())
|
|
||||||
// builder:((context) => BottomSheetNew())
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// children: [
|
|
||||||
// Container(
|
|
||||||
// width:20,
|
|
||||||
// height:20,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Colors.red,
|
|
||||||
// shape: BoxShape.circle,
|
|
||||||
// border: new Border.all(
|
|
||||||
// color: Colors.white,
|
|
||||||
// width: d.checkin_radious != null ? d.checkin_radious! : 1,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// child: new Center(
|
|
||||||
// child: new Text(
|
|
||||||
// (i + 1).toString(),
|
|
||||||
// style: TextStyle(color: Colors.white),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Container( color: Colors.yellow, child: Text(getDisplaytext(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //return Icon(Icons.pin_drop);
|
|
||||||
// // return IconButton(
|
|
||||||
// // onPressed: ()async {
|
|
||||||
// // Destination? fs = await destinationController.getDEstinationForLatLong(d.lat!, d.lon!);
|
|
||||||
// // print("-- Destination is --- ${fs!.name} ------");
|
|
||||||
// // if(fs != null){
|
|
||||||
// // if(indexController.currentDestinationFeature.length > 0) {
|
|
||||||
// // indexController.currentDestinationFeature.clear();
|
|
||||||
// // }
|
|
||||||
// // indexController.currentDestinationFeature.add(fs);
|
|
||||||
// // //indexController.getAction();
|
|
||||||
|
|
||||||
// // showModalBottomSheet(context: context, isScrollControlled: true,
|
|
||||||
// // //builder:((context) => BottomSheetWidget())
|
|
||||||
// // builder:((context) => BottomSheetNew())
|
|
||||||
// // );
|
|
||||||
// // }
|
|
||||||
// // },
|
|
||||||
// // icon: Container(
|
|
||||||
// // width: 60,
|
|
||||||
// // height: 60,
|
|
||||||
// // decoration: BoxDecoration(
|
|
||||||
// // borderRadius: BorderRadius.circular(d.checkin_radious ?? 0),
|
|
||||||
// // color: Colors.transparent,
|
|
||||||
// // border: BoxBorder()
|
|
||||||
// // ),
|
|
||||||
// // child: Icon(Icons.pin_drop)
|
|
||||||
// // )
|
|
||||||
// // );
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// pts.add(m);
|
|
||||||
// }
|
|
||||||
// return pts;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
|
|
||||||
// //indexController.routePoints.clear();
|
|
||||||
// DestinationService.getDestinationLine(destinationController.destinations)?.then((value){
|
|
||||||
// //print("---- loading destination points ------ ${value}");
|
|
||||||
// setState(() {
|
|
||||||
// indexController.routePoints = value;
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// super.initState();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void reload(){
|
|
||||||
// setState(() {
|
|
||||||
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return Obx((() =>
|
|
||||||
// Stack(
|
|
||||||
// children: [
|
|
||||||
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
|
||||||
// Center(child: CircularProgressIndicator())
|
|
||||||
// :
|
|
||||||
// BreadCrumbWidget(mapController:indexController.rogMapController),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(top:50.0),
|
|
||||||
// //child: TravelMap(),
|
|
||||||
// child:
|
|
||||||
// TravelMap(indexController.routePoints),
|
|
||||||
// ),
|
|
||||||
// // Positioned(
|
|
||||||
// // bottom: 200,
|
|
||||||
// // left: 10,
|
|
||||||
// // child: Container(
|
|
||||||
// // color: Colors.white,
|
|
||||||
// // child: Row(
|
|
||||||
// // children: [
|
|
||||||
// // Text(destinationController.gps[0]),
|
|
||||||
// // Text(destinationController.locationPermission[0])
|
|
||||||
// // ],
|
|
||||||
// // ),
|
|
||||||
// // )
|
|
||||||
// // ),
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// ));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// FlutterMap TravelMap(List<PointLatLng> ptts) {
|
|
||||||
// return FlutterMap(
|
|
||||||
// options: MapOptions(
|
|
||||||
// onMapCreated: (c){
|
|
||||||
// indexController.rogMapController = c;
|
|
||||||
// indexController.rogMapController!.onReady.then((_) {
|
|
||||||
// indexController.is_rog_mapcontroller_loaded.value = true;
|
|
||||||
// subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
|
||||||
// if (mapEvent is MapEventMoveStart) {
|
|
||||||
// //print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
|
||||||
// // do something
|
|
||||||
// }
|
|
||||||
// if (mapEvent is MapEventMoveEnd) {
|
|
||||||
// destinationController.isSelected.value = false;
|
|
||||||
// //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
|
||||||
// //indexController.loadLocationsBound();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// } ,
|
|
||||||
// bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
|
||||||
// zoom: 1,
|
|
||||||
// maxZoom: 42,
|
|
||||||
// interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
|
||||||
// //plugins: [LocationMarkerPlugin(),]
|
|
||||||
// ),
|
|
||||||
// children: [
|
|
||||||
// TileLayerWidget(
|
|
||||||
// options: TileLayerOptions(
|
|
||||||
// urlTemplate: 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png',
|
|
||||||
// subdomains: ['a', 'b', 'c'],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// //Obx(() =>
|
|
||||||
// indexController.routePoints.length > 0 ?
|
|
||||||
// PolylineLayerWidget(
|
|
||||||
// options: PolylineLayerOptions(
|
|
||||||
// polylines: [
|
|
||||||
// Polyline(
|
|
||||||
// points: getPoints(ptts)!,
|
|
||||||
// strokeWidth: 6.0,
|
|
||||||
// color: Colors.indigo
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
// :
|
|
||||||
// Container(),
|
|
||||||
// //),
|
|
||||||
// // PopupMarkerLayerWidget(
|
|
||||||
// // options: PopupMarkerLayerOptions(
|
|
||||||
// // popupController: _popupLayerController,
|
|
||||||
// // markers: _markers,
|
|
||||||
// // markerRotateAlignment:
|
|
||||||
// // PopupMarkerLayerOptions.rotationAlignmentFor(AnchorAlign.top),
|
|
||||||
// // popupBuilder: (BuildContext context, Marker marker) =>
|
|
||||||
|
|
||||||
// // examplePopup(marker),
|
|
||||||
// // ),
|
|
||||||
// // ),
|
|
||||||
// LocationMarkerLayerWidget(),
|
|
||||||
// MarkerLayerWidget(
|
|
||||||
// options: MarkerLayerOptions(
|
|
||||||
// markers: getMarkers()!
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
@ -8,12 +7,12 @@ import 'package:rogapp/services/auth_service.dart';
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class DrawerPage extends StatelessWidget {
|
class DrawerPage extends StatelessWidget {
|
||||||
DrawerPage({ Key? key }) : super(key: key);
|
DrawerPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
void _launchURL(url) async {
|
void _launchURL(url) async {
|
||||||
if (!await launch(url)) throw 'Could not launch $url';
|
if (!await launchUrl(url)) throw 'Could not launch $url';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -28,71 +27,125 @@ class DrawerPage extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
height: 100,
|
height: 100,
|
||||||
color: Colors.amber,
|
color: Colors.amber,
|
||||||
child: Obx(() =>
|
child: Obx(() => Center(
|
||||||
Center(
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.all(8.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
child: indexController.currentUser.isEmpty
|
||||||
child:
|
? Flexible(
|
||||||
indexController.currentUser.length == 0 ?
|
child: Text(
|
||||||
Flexible(child: Text("drawer_title".tr, style: TextStyle(color: Colors.black, fontSize: 20),))
|
"drawer_title".tr,
|
||||||
:
|
style: const TextStyle(
|
||||||
Text(indexController.currentUser[0]['user']['email'], style: TextStyle(color: Colors.black, fontSize: 20),),
|
color: Colors.black, fontSize: 20),
|
||||||
),
|
))
|
||||||
)
|
: Text(
|
||||||
),
|
indexController.currentUser[0]['user']['email'],
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.black, fontSize: 20),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() => indexController.currentUser.isEmpty
|
||||||
indexController.currentUser.length == 0 ?
|
? ListTile(
|
||||||
ListTile(
|
leading: const Icon(Icons.login),
|
||||||
leading: const Icon(Icons.login),
|
title: Text("login".tr),
|
||||||
title: Text("login".tr),
|
onTap: () {
|
||||||
onTap: (){
|
Get.toNamed(AppPages.LOGIN);
|
||||||
Get.toNamed(AppPages.LOGIN);
|
},
|
||||||
},
|
)
|
||||||
) :
|
: ListTile(
|
||||||
ListTile(
|
leading: const Icon(Icons.login),
|
||||||
leading: const Icon(Icons.login),
|
title: Text("logout".tr),
|
||||||
title: Text("logout".tr),
|
onTap: () {
|
||||||
onTap: (){
|
indexController.logout();
|
||||||
indexController.logout();
|
Get.toNamed(AppPages.LOGIN);
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
},
|
||||||
},
|
)),
|
||||||
)
|
indexController.currentUser.isNotEmpty
|
||||||
),
|
? ListTile(
|
||||||
indexController.currentUser.length > 0 ?
|
leading: const Icon(Icons.password),
|
||||||
ListTile(
|
title: Text("change_password".tr),
|
||||||
leading: const Icon(Icons.password),
|
onTap: () {
|
||||||
title: Text("change_password".tr),
|
Get.toNamed(AppPages.CHANGE_PASSWORD);
|
||||||
onTap: (){
|
},
|
||||||
Get.toNamed(AppPages.CHANGE_PASSWORD);
|
)
|
||||||
},
|
: const SizedBox(
|
||||||
) :
|
width: 0,
|
||||||
Container(width: 0, height: 0,),
|
height: 0,
|
||||||
indexController.currentUser.length == 0 ?
|
),
|
||||||
ListTile(
|
indexController.currentUser.isEmpty
|
||||||
leading: const Icon(Icons.person),
|
? ListTile(
|
||||||
title: Text("sign_up".tr),
|
leading: const Icon(Icons.person),
|
||||||
onTap: (){
|
title: Text("sign_up".tr),
|
||||||
Get.toNamed(AppPages.REGISTER);
|
onTap: () {
|
||||||
},
|
Get.toNamed(AppPages.REGISTER);
|
||||||
) :
|
},
|
||||||
Container(width: 0, height: 0,),
|
)
|
||||||
indexController.currentUser.length > 0 ?
|
: const SizedBox(
|
||||||
ListTile(
|
width: 0,
|
||||||
leading: const Icon(Icons.delete_forever),
|
height: 0,
|
||||||
title: Text("delete_account".tr),
|
),
|
||||||
onTap: (){
|
indexController.currentUser.isNotEmpty
|
||||||
String _token = indexController.currentUser[0]['token'];
|
? ListTile(
|
||||||
AuthService.deleteUser(_token).then((value){
|
leading: const Icon(Icons.password),
|
||||||
if(value.isNotEmpty){
|
title: const Text("リセット"),
|
||||||
indexController.logout();
|
onTap: () {
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
Get.defaultDialog(
|
||||||
Get.snackbar("accounted_deleted".tr, "account_deleted_message".tr);
|
title: "よろしいですか、リセットしますか?",
|
||||||
}
|
middleText: "これにより、すべてのゲーム データが削除され、すべての状態が削除されます",
|
||||||
});
|
textConfirm: "確認する",
|
||||||
},
|
textCancel: "キャンセルする",
|
||||||
) :
|
onCancel: () => Get.back(),
|
||||||
Container(width: 0, height: 0,),
|
onConfirm: () {
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
destinationController.resetRogaining();
|
||||||
|
destinationController.deleteDBDestinations();
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: 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) {
|
||||||
|
if (value.isNotEmpty) {
|
||||||
|
indexController.logout();
|
||||||
|
Get.toNamed(AppPages.TRAVEL);
|
||||||
|
Get.snackbar("accounted_deleted".tr,
|
||||||
|
"account_deleted_message".tr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const SizedBox(
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
),
|
||||||
|
indexController.currentUser.isNotEmpty
|
||||||
|
? ListTile(
|
||||||
|
leading: const Icon(Icons.delete_forever),
|
||||||
|
title: Text("ユーザーデータを削除する".tr),
|
||||||
|
onTap: () {
|
||||||
|
String token = indexController.currentUser[0]['token'];
|
||||||
|
AuthService.deleteUser(token).then((value) {
|
||||||
|
Get.snackbar("ユーザーデータを削除する",
|
||||||
|
"データを削除するためにユーザーの同意が設定されています アプリとサーバーでユーザーデータが削除されました");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: const SizedBox(
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
),
|
||||||
// ListTile(
|
// ListTile(
|
||||||
// leading: const Icon(Icons.person),
|
// leading: const Icon(Icons.person),
|
||||||
// title: Text("profile".tr),
|
// title: Text("profile".tr),
|
||||||
@ -108,19 +161,22 @@ class DrawerPage extends StatelessWidget {
|
|||||||
// title: Text("point_rank".tr),
|
// title: Text("point_rank".tr),
|
||||||
// onTap: (){},
|
// onTap: (){},
|
||||||
// ),
|
// ),
|
||||||
indexController.currentUser.length > 0 ?
|
indexController.currentUser.isNotEmpty
|
||||||
ListTile(
|
? ListTile(
|
||||||
leading: const Icon(Icons.featured_video),
|
leading: const Icon(Icons.featured_video),
|
||||||
title: Text("rog_web".tr),
|
title: Text("rog_web".tr),
|
||||||
onTap: (){
|
onTap: () {
|
||||||
_launchURL("https://www.gifuai.net/?page_id=17397");
|
_launchURL("https://www.gifuai.net/?page_id=17397");
|
||||||
},
|
},
|
||||||
) :
|
)
|
||||||
Container(width: 0, height: 0,),
|
: const SizedBox(
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.privacy_tip),
|
leading: const Icon(Icons.privacy_tip),
|
||||||
title: Text("privacy".tr),
|
title: Text("privacy".tr),
|
||||||
onTap: (){
|
onTap: () {
|
||||||
_launchURL("https://rogaining.sumasen.net/api/privacy/");
|
_launchURL("https://rogaining.sumasen.net/api/privacy/");
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -139,4 +195,4 @@ class DrawerPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
152
lib/pages/gps/gps_page.dart
Normal file
152
lib/pages/gps/gps_page.dart
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:latlong2/latlong.dart';
|
||||||
|
import 'package:rogapp/model/gps_data.dart';
|
||||||
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
import 'package:rogapp/utils/database_gps.dart';
|
||||||
|
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||||
|
|
||||||
|
class GpsPage extends StatefulWidget {
|
||||||
|
const GpsPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GpsPage> createState() => _GpsPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GpsPageState extends State<GpsPage> {
|
||||||
|
var gpsData = [].obs;
|
||||||
|
MapController? mapController;
|
||||||
|
StreamSubscription? subscription;
|
||||||
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
loadGpsData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadGpsData() async {
|
||||||
|
final team_name = indexController.currentUser[0]["user"]['team_name'];
|
||||||
|
final event_code = indexController.currentUser[0]["user"]["event_code"];
|
||||||
|
GpsDatabaseHelper db = GpsDatabaseHelper.instance;
|
||||||
|
var data = await db.getGPSData(team_name, event_code);
|
||||||
|
gpsData.value = data;
|
||||||
|
|
||||||
|
//print("--- gps data ${data} ----");
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getMarkerShape(GpsData i) {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
InkWell(
|
||||||
|
onTap: () {},
|
||||||
|
child: Container(
|
||||||
|
height: 22,
|
||||||
|
width: 22,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.transparent,
|
||||||
|
border: Border.all(
|
||||||
|
color:
|
||||||
|
i.is_checkin == 0 ? Colors.blueAccent : Colors.green,
|
||||||
|
width: i.is_checkin == 0 ? 0.4 : 2,
|
||||||
|
style: BorderStyle.solid)),
|
||||||
|
child: const Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.circle,
|
||||||
|
size: 6.0,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: i.is_checkin == 1
|
||||||
|
? Text(
|
||||||
|
DateTime.fromMicrosecondsSinceEpoch(i.created_at)
|
||||||
|
.hour
|
||||||
|
.toString() +
|
||||||
|
":" +
|
||||||
|
DateTime.fromMicrosecondsSinceEpoch(i.created_at)
|
||||||
|
.minute
|
||||||
|
.toString(),
|
||||||
|
// ":" +
|
||||||
|
// DateTime.fromMicrosecondsSinceEpoch(i.created_at)
|
||||||
|
// .second
|
||||||
|
// .toString(),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.black,
|
||||||
|
))
|
||||||
|
: Container()),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text("GPS way points"),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
child: Obx(
|
||||||
|
() => FlutterMap(
|
||||||
|
mapController: mapController,
|
||||||
|
options: MapOptions(
|
||||||
|
maxZoom: 18.4,
|
||||||
|
onMapReady: () {},
|
||||||
|
//center: LatLng(37.15319600454702, 139.58765950528198),
|
||||||
|
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,
|
||||||
|
onPositionChanged: (MapPosition pos, bool hasGesture) {
|
||||||
|
if (hasGesture) {
|
||||||
|
indexController.currentBound = [pos.bounds!];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onTap: (tapPos, cord) {}, // Hide popup when the map is tapped.
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const BaseLayer(),
|
||||||
|
MarkerLayer(
|
||||||
|
markers: gpsData.map((i) {
|
||||||
|
return Marker(
|
||||||
|
width: 30.0, // Fixed width
|
||||||
|
height: 30.0, // Fixed height
|
||||||
|
point: LatLng(i.lat, i.lon),
|
||||||
|
child: getMarkerShape(i),
|
||||||
|
alignment: Alignment.center);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
// MarkerLayer(
|
||||||
|
// markers: gpsData.map((i) {
|
||||||
|
// return Marker(
|
||||||
|
// alignment: Alignment.center,
|
||||||
|
// height: 32.0,
|
||||||
|
// width: 120.0,
|
||||||
|
// point: LatLng(i.lat, i.lon),
|
||||||
|
// child: getMarkerShape(i));
|
||||||
|
// }).toList(),
|
||||||
|
// )
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
150
lib/pages/history/history_page.dart
Normal file
150
lib/pages/history/history_page.dart
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
|
|
||||||
|
class HistoryPage extends StatefulWidget {
|
||||||
|
const HistoryPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<HistoryPage> createState() => _HistoryPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HistoryPageState extends State<HistoryPage> {
|
||||||
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text("通過履歴"),
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
FutureBuilder(
|
||||||
|
future: db.getDestinations(),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<List<Destination>> snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.hasError) {
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
'${snapshot.error} occurred',
|
||||||
|
style: const TextStyle(fontSize: 18),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (snapshot.hasData) {
|
||||||
|
final dests = snapshot.data;
|
||||||
|
if (dests!.isNotEmpty) {
|
||||||
|
//print("----- history -----");
|
||||||
|
return SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: dests.length,
|
||||||
|
itemBuilder: (ctx, index) {
|
||||||
|
//print("--- photo ${dests[index].checkin_image!} ----");
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: CustomWidget(
|
||||||
|
title: dests[index].name!,
|
||||||
|
subtitle:
|
||||||
|
"${dests[index].sub_loc_id} : ${dests[index].name}",
|
||||||
|
image1: dests[index].checkin_image != null
|
||||||
|
? Image.file(
|
||||||
|
File(dests[index].checkin_image!))
|
||||||
|
: null,
|
||||||
|
image2:
|
||||||
|
dests[index].buypoint_image != null
|
||||||
|
? Image.file(File(
|
||||||
|
dests[index].buypoint_image!))
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
return const Center(child: Text("No checkin yet"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (snapshot.connectionState ==
|
||||||
|
ConnectionState.waiting) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CustomWidget extends StatelessWidget {
|
||||||
|
final Image? image1;
|
||||||
|
final Image? image2;
|
||||||
|
final String title;
|
||||||
|
final String subtitle;
|
||||||
|
|
||||||
|
const CustomWidget({
|
||||||
|
super.key,
|
||||||
|
this.image1,
|
||||||
|
this.image2,
|
||||||
|
required this.title,
|
||||||
|
required this.subtitle,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width:
|
||||||
|
104, // 50 (width of each image) + 2 (space between images) + 2*1 (padding on both sides)
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
if (image1 != null)
|
||||||
|
SizedBox(
|
||||||
|
width: 50,
|
||||||
|
height: 100,
|
||||||
|
child: image1,
|
||||||
|
),
|
||||||
|
if (image1 != null && image2 != null) const SizedBox(width: 2),
|
||||||
|
if (image2 != null)
|
||||||
|
SizedBox(
|
||||||
|
width: 50,
|
||||||
|
height: 100,
|
||||||
|
child: image2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style:
|
||||||
|
const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
|
maxLines:
|
||||||
|
null, // Allows the text to wrap onto an unlimited number of lines
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
subtitle,
|
||||||
|
style: const TextStyle(fontSize: 16),
|
||||||
|
maxLines:
|
||||||
|
null, // Allows the text to wrap onto an unlimited number of lines
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,6 +3,8 @@ import 'package:get/get.dart';
|
|||||||
import 'package:rogapp/pages/search/search_page.dart';
|
import 'package:rogapp/pages/search/search_page.dart';
|
||||||
|
|
||||||
class HomePage extends GetView{
|
class HomePage extends GetView{
|
||||||
|
const HomePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
|
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
import 'package:rogapp/utils/location_controller.dart';
|
||||||
|
|
||||||
class IndexBinding extends Bindings {
|
class IndexBinding extends Bindings {
|
||||||
@override
|
@override
|
||||||
void dependencies() {
|
void dependencies() {
|
||||||
Get.put<IndexController>(IndexController());
|
Get.put<IndexController>(IndexController());
|
||||||
|
Get.put<LocationController>(LocationController());
|
||||||
|
Get.put<DestinationController>(DestinationController());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,26 +4,21 @@ import 'package:connectivity_plus/connectivity_plus.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
import 'package:flutter_map/plugin_api.dart';
|
|
||||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson_vi/geojson_vi.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:latlong2/latlong.dart';
|
import 'package:latlong2/latlong.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
import 'package:rogapp/services/action_service.dart';
|
|
||||||
import 'package:rogapp/services/auth_service.dart';
|
import 'package:rogapp/services/auth_service.dart';
|
||||||
import 'package:rogapp/services/cat_service.dart';
|
|
||||||
import 'package:rogapp/services/location_service.dart';
|
import 'package:rogapp/services/location_service.dart';
|
||||||
import 'package:rogapp/services/perfecture_service.dart';
|
|
||||||
import 'package:rogapp/utils/database_helper.dart';
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class IndexController extends GetxController {
|
class IndexController extends GetxController {
|
||||||
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
List<GeoJSONFeatureCollection> locations = <GeoJSONFeatureCollection>[].obs;
|
||||||
List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
|
List<GeoJSONFeature> currentFeature = <GeoJSONFeature>[].obs;
|
||||||
List<Destination> currentDestinationFeature = <Destination>[].obs;
|
List<Destination> currentDestinationFeature = <Destination>[].obs;
|
||||||
List<dynamic> perfectures = <dynamic>[].obs;
|
List<dynamic> perfectures = <dynamic>[].obs;
|
||||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
||||||
@ -39,646 +34,392 @@ class IndexController extends GetxController {
|
|||||||
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
||||||
var routePointLenght = 0.obs;
|
var routePointLenght = 0.obs;
|
||||||
|
|
||||||
var is_loading = false.obs;
|
double currentLat = 0.0, currentLon = 0.0;
|
||||||
|
|
||||||
var is_mapController_loaded = false.obs;
|
var isLoading = false.obs;
|
||||||
var is_rog_mapcontroller_loaded = false.obs;
|
|
||||||
|
|
||||||
var is_custom_area_selected = false.obs;
|
var isRogMapcontrollerLoaded = false.obs;
|
||||||
|
|
||||||
|
var isCustomAreaSelected = false.obs;
|
||||||
|
|
||||||
MapController mapController = MapController();
|
MapController mapController = MapController();
|
||||||
MapController rogMapController = MapController();
|
MapController rogMapController = MapController();
|
||||||
|
|
||||||
|
String? userToken;
|
||||||
|
|
||||||
|
// mode = 0 is map mode, mode = 1 list mode
|
||||||
var mode = 0.obs;
|
var mode = 0.obs;
|
||||||
|
|
||||||
// master mode, rog or selection
|
// master mode, rog or selection
|
||||||
var rog_mode = 1.obs;
|
var rogMode = 1.obs;
|
||||||
|
|
||||||
var desination_mode = 1.obs;
|
var desinationMode = 1.obs;
|
||||||
|
|
||||||
bool showPopup = true;
|
bool showPopup = true;
|
||||||
|
|
||||||
|
String dropdownValue = "9";
|
||||||
String dropdownValue = "9";
|
|
||||||
String subDropdownValue = "-1";
|
String subDropdownValue = "-1";
|
||||||
String areaDropdownValue = "-1";
|
String areaDropdownValue = "-1";
|
||||||
String cateogory = "-all-";
|
String cateogory = "-all-";
|
||||||
|
|
||||||
late Worker _ever;
|
|
||||||
|
|
||||||
ConnectivityResult connectionStatus = ConnectivityResult.none;
|
ConnectivityResult connectionStatus = ConnectivityResult.none;
|
||||||
var connectionStatusName = "".obs;
|
var connectionStatusName = "".obs;
|
||||||
final Connectivity _connectivity = Connectivity();
|
final Connectivity _connectivity = Connectivity();
|
||||||
late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
||||||
|
|
||||||
void toggleMode(){
|
void toggleMode() {
|
||||||
if(mode.value==0){
|
if (mode.value == 0) {
|
||||||
mode += 1;
|
mode += 1;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
mode -= 1;
|
mode -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleDestinationMode(){
|
void toggleDestinationMode() {
|
||||||
if(desination_mode.value==0){
|
if (desinationMode.value == 0) {
|
||||||
desination_mode.value += 1;
|
desinationMode.value += 1;
|
||||||
}
|
} else {
|
||||||
else{
|
desinationMode.value -= 1;
|
||||||
desination_mode.value -= 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchPage(String page){
|
void switchPage(String page) {
|
||||||
//print("######## ${currentUser[0]["user"]["id"]}");
|
////print("######## ${currentUser[0]["user"]["id"]}");
|
||||||
switch (page) {
|
switch (page) {
|
||||||
case AppPages.INITIAL :{
|
case AppPages.INDEX:
|
||||||
rog_mode.value = 0;
|
{
|
||||||
print("-- rog mode is ctrl is ${rog_mode.value}");
|
rogMode.value = 0;
|
||||||
Get.toNamed(page);
|
//print("-- rog mode is ctrl is ${rog_mode.value}");
|
||||||
}
|
Get.toNamed(page);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AppPages.TRAVEL : {
|
case AppPages.TRAVEL:
|
||||||
rog_mode.value = 1;
|
{
|
||||||
//Get.back();
|
rogMode.value = 1;
|
||||||
Get.off(DestnationPage(), binding: DestinationBinding());
|
//Get.back();
|
||||||
|
//Get.off(DestnationPage(), binding: DestinationBinding());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AppPages.LOGIN :{
|
case AppPages.LOGIN:
|
||||||
rog_mode.value = 2;
|
{
|
||||||
Get.toNamed(page);
|
rogMode.value = 2;
|
||||||
}
|
Get.toNamed(page);
|
||||||
break;
|
}
|
||||||
default:{
|
break;
|
||||||
rog_mode.value = 0;
|
default:
|
||||||
Get.toNamed(AppPages.INITIAL);
|
{
|
||||||
}
|
rogMode.value = 1;
|
||||||
|
Get.toNamed(AppPages.INDEX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
|
_connectivitySubscription =
|
||||||
|
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
||||||
if(perfectures.length == 0){
|
|
||||||
PerfectureService.loadPerfectures().then((value){
|
|
||||||
perfectures.add(value);
|
|
||||||
loadAreaFor("9");
|
|
||||||
|
|
||||||
//loadSubPerfFor("9");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
_connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
|
||||||
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
_connectivitySubscription.cancel();
|
_connectivitySubscription.cancel();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _updateConnectionStatus(ConnectivityResult result) async {
|
Future<void> _updateConnectionStatus(ConnectivityResult result) async {
|
||||||
connectionStatus = result;
|
connectionStatus = result;
|
||||||
connectionStatusName.value = result.name;
|
connectionStatusName.value = result.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initConnectivity() async {
|
Future<void> initConnectivity() async {
|
||||||
late ConnectivityResult result;
|
late ConnectivityResult result;
|
||||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||||
try {
|
try {
|
||||||
result = await _connectivity.checkConnectivity();
|
result = await _connectivity.checkConnectivity();
|
||||||
} on PlatformException catch (e) {
|
} on PlatformException catch (_) {
|
||||||
print('Couldn\'t check connectivity status --- $e');
|
//print('Couldn\'t check connectivity status --- $e');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _updateConnectionStatus(result);
|
return _updateConnectionStatus(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
LatLngBounds boundsFromLatLngList(List<LatLng> list) {
|
LatLngBounds boundsFromLatLngList(List<LatLng> list) {
|
||||||
double? x0, x1, y0, y1;
|
double? x0, x1, y0, y1;
|
||||||
for (LatLng latLng in list) {
|
for (LatLng latLng in list) {
|
||||||
if (x0 == null || x1 == null || y0 == null || y1 == null) {
|
if (x0 == null || x1 == null || y0 == null || y1 == null) {
|
||||||
x0 = x1 = latLng.latitude;
|
x0 = x1 = latLng.latitude;
|
||||||
y0 = y1 = latLng.longitude;
|
y0 = y1 = latLng.longitude;
|
||||||
} else {
|
} else {
|
||||||
if (latLng.latitude > x1) x1 = latLng.latitude;
|
if (latLng.latitude > x1) x1 = latLng.latitude;
|
||||||
if (latLng.latitude < x0) x0 = latLng.latitude;
|
if (latLng.latitude < x0) x0 = latLng.latitude;
|
||||||
if (latLng.longitude > y1) y1 = latLng.longitude;
|
if (latLng.longitude > y1) y1 = latLng.longitude;
|
||||||
if (latLng.longitude < y0) y0 = 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!));
|
void login(String email, String password, BuildContext context) {
|
||||||
}
|
AuthService.login(email, password).then((value) {
|
||||||
|
//print("------- logged in user details ######## $value ###### --------");
|
||||||
|
if (value.isNotEmpty) {
|
||||||
List<LatLng> getLocationsList(){
|
|
||||||
List<LatLng> 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);
|
|
||||||
}
|
|
||||||
return locs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(currentUser.length > 0){
|
|
||||||
rog_mode.value = 0 ;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
rog_mode.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rog_mode.value == 1){
|
|
||||||
switchPage(AppPages.TRAVEL);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
switchPage(AppPages.INITIAL);
|
|
||||||
}
|
|
||||||
//Get.toNamed(AppPages.INITIAL);
|
|
||||||
}else{
|
|
||||||
is_loading.value = false;
|
|
||||||
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"))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
Navigator.pop(context);
|
||||||
if(rog_mode.value == 1){
|
//print("--------- user details login ----- $value");
|
||||||
switchPage(AppPages.TRAVEL);
|
changeUser(value);
|
||||||
}
|
} else {
|
||||||
else{
|
isLoading.value = false;
|
||||||
switchPage(AppPages.INITIAL);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
'failed'.tr,
|
"ログイン失敗",
|
||||||
'password_change_failed_please_try_again'.tr,
|
"ログインIDかパスワードを確認して下さい。",
|
||||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||||
snackPosition: SnackPosition.TOP,
|
snackPosition: SnackPosition.TOP,
|
||||||
duration: Duration(milliseconds: 800),
|
duration: const Duration(seconds: 3),
|
||||||
backgroundColor: Colors.yellow,
|
backgroundColor: Colors.yellow,
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
}
|
||||||
is_loading.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void logout() async{
|
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) {
|
||||||
|
isLoading.value = false;
|
||||||
|
Navigator.pop(context);
|
||||||
|
if (rogMode.value == 1) {
|
||||||
|
switchPage(AppPages.TRAVEL);
|
||||||
|
} else {
|
||||||
|
switchPage(AppPages.INDEX);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Get.snackbar(
|
||||||
|
'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"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
isLoading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void logout() async {
|
||||||
locations.clear();
|
locations.clear();
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
db.deleteAllDestinations().then((value){
|
db.deleteAllDestinations().then((value) {
|
||||||
DestinationController destinationController = Get.find<DestinationController>();
|
DestinationController destinationController =
|
||||||
if(destinationController != null){
|
Get.find<DestinationController>();
|
||||||
destinationController.PopulateDestinations();
|
destinationController.populateDestinations();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
currentUser.clear();
|
currentUser.clear();
|
||||||
cats.clear();
|
cats.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void register(String email, String password, BuildContext context){
|
void register(String email, String password, BuildContext context) {
|
||||||
AuthService.register(email, password).then((value){
|
AuthService.register(email, password).then((value) {
|
||||||
if(value.isNotEmpty){
|
if (value.isNotEmpty) {
|
||||||
currentUser.clear();
|
currentUser.clear();
|
||||||
currentUser.add(value);
|
currentUser.add(value);
|
||||||
is_loading.value = false;
|
isLoading.value = false;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
loadUserDetails();
|
Get.toNamed(AppPages.INDEX);
|
||||||
Get.toNamed(AppPages.INITIAL);
|
} else {
|
||||||
}else{
|
isLoading.value = false;
|
||||||
is_loading.value = false;
|
Get.snackbar(
|
||||||
Get.snackbar(
|
'failed'.tr,
|
||||||
'failed'.tr,
|
'user_registration_failed_please_try_again'.tr,
|
||||||
'user_registration_failed_please_try_again'.tr,
|
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
snackPosition: SnackPosition.TOP,
|
||||||
snackPosition: SnackPosition.TOP,
|
duration: const Duration(milliseconds: 800),
|
||||||
duration: Duration(milliseconds: 800),
|
backgroundColor: Colors.yellow,
|
||||||
backgroundColor: Colors.yellow,
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
//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<String, dynamic> _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(){
|
void saveToDevice(String val) async {
|
||||||
dynamic initVal = {'category':getCatText()};
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
LatLngBounds bounds = mapController!.bounds!;
|
await prefs.setString("user_token", val);
|
||||||
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 loadCatForCity(String city){
|
void changeUser(Map<String, dynamic> value, {bool replace = true}) {
|
||||||
dynamic initVal = {'category':getCatText()};
|
//print("---- change user to $value -----");
|
||||||
LatLngBounds bounds = mapController!.bounds!;
|
currentUser.clear();
|
||||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
currentUser.add(value);
|
||||||
CatService.loadCatByCity(city).then((value) {
|
if (replace) {
|
||||||
cats.clear();
|
saveToDevice(currentUser[0]["token"]);
|
||||||
cats.add(initVal);
|
}
|
||||||
for(dynamic cat in value!){
|
isLoading.value = false;
|
||||||
if(cat['category'] != null){
|
|
||||||
cats.add(cat!);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void refreshLocationForCat(){
|
|
||||||
loadLocationsBound();
|
loadLocationsBound();
|
||||||
// if(subDropdownValue == "-1"){
|
if (currentUser.isNotEmpty) {
|
||||||
// LocationService.loadLocationsFor(dropdownValue, currentCat[0]).then((value){
|
rogMode.value = 0;
|
||||||
// locations.clear();
|
} else {
|
||||||
// locations.add(value!);
|
rogMode.value = 1;
|
||||||
// is_loading.value = false;
|
|
||||||
// });
|
|
||||||
// print("loading main------");
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// LocationService.loadLocationsSubFor(subDropdownValue, currentCat[0]).then((value){
|
|
||||||
// locations.clear();
|
|
||||||
// locations.add(value!);
|
|
||||||
// is_loading.value = false;
|
|
||||||
// });
|
|
||||||
// print("loading sub------");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadAreaFor(String perf){
|
|
||||||
areas.clear();
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
//print('--- c rog mode --- ${rogMode.value}');
|
||||||
|
Get.toNamed(AppPages.INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadUserDetailsForToken(String token) async {
|
||||||
void loadCustomAreas(){
|
AuthService.userForToken(token).then((value) {
|
||||||
customAreas.clear();
|
////print("----token val-- $value ------");
|
||||||
PerfectureService.loadCustomAreas().then((value){
|
if (value![0]["user"].isEmpty) {
|
||||||
print("--- loading custom areas ${value}");
|
Get.toNamed(AppPages.LOGIN);
|
||||||
customAreas.add(value);
|
return;
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void loadSubPerfFor(String perf){
|
|
||||||
subPerfs.clear();
|
|
||||||
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
|
||||||
PerfectureService.loadSubPerfectures(perf).then((value){
|
|
||||||
value!.add(initVal);
|
|
||||||
subPerfs.add(value);
|
|
||||||
subDropdownValue = getSubInitialVal();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
String getSubInitialVal(){
|
|
||||||
int min = 0;
|
|
||||||
if(subPerfs.length > 0){
|
|
||||||
min = int.parse(subPerfs[0][0]['id'].toString());
|
|
||||||
for(var sub in subPerfs[0]){
|
|
||||||
int x = int.parse(sub['id'].toString()); // as int;
|
|
||||||
if(x < min){
|
|
||||||
min = x;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
changeUser(value[0], replace: false);
|
||||||
return min.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadLocationforPerf(String perf, MapController mapController) async {
|
|
||||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
|
||||||
print(currentCat);
|
|
||||||
// LocationService.loadLocationsFor(perf, cat).then((value){
|
|
||||||
// locations.clear();
|
|
||||||
// locations.add(value!);
|
|
||||||
// mapController.fitBounds(currentBound[0]);
|
|
||||||
// });
|
|
||||||
locations.clear();
|
|
||||||
mapController.fitBounds(currentBound[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadLocationforSubPerf(String subperf, MapController mapController) async {
|
|
||||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
|
||||||
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
|
|
||||||
cat = "";
|
|
||||||
}
|
|
||||||
LocationService.loadLocationsSubFor(subperf, cat).then((value){
|
|
||||||
locations.clear();
|
|
||||||
locations.add(value!);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadCustomLocation(String customarea) async {
|
/*
|
||||||
String cat = currentCat.isNotEmpty == true ? currentCat[0] : "";
|
void loadLocationsBound() {
|
||||||
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
|
if (isCustomAreaSelected.value == true) {
|
||||||
cat = "";
|
|
||||||
}
|
|
||||||
print("----- ${customarea}");
|
|
||||||
LocationService.loadCustomLocations(customarea, cat).then((value){
|
|
||||||
locations.clear();
|
|
||||||
locations.add(value!);
|
|
||||||
List<LatLng> locs = getLocationsList();
|
|
||||||
LatLngBounds bounds = boundsFromLatLngList(locs);
|
|
||||||
mapController!.fitBounds(bounds);
|
|
||||||
setBound(bounds);
|
|
||||||
Future.delayed(Duration(microseconds: 400), () {
|
|
||||||
mapController!.fitBounds(bounds);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadLocationsBound(){
|
|
||||||
if(is_custom_area_selected.value == true){
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
locations.clear();
|
locations.clear();
|
||||||
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
||||||
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
|
if (currentCat.isNotEmpty && currentCat[0] == "-all-") {
|
||||||
cat = "";
|
cat = "";
|
||||||
}
|
}
|
||||||
LatLngBounds bounds = mapController!.bounds!;
|
LatLngBounds bounds = mapController.bounds!;
|
||||||
currentBound.clear();
|
currentBound.clear();
|
||||||
currentBound.add(bounds);
|
currentBound.add(bounds);
|
||||||
//print(currentCat);
|
////print(currentCat);
|
||||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
LocationService.loadLocationsBound(
|
||||||
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){
|
bounds.southWest.latitude,
|
||||||
//print("---value length ------ ${value!.collection.length}");
|
bounds.southWest.longitude,
|
||||||
if(value == null){
|
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) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(value != null && value.collection.isEmpty){
|
if (value.features.isEmpty) {
|
||||||
if(showPopup == false) {
|
if (showPopup == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
"Too many Points",
|
"Too many Points",
|
||||||
"please zoom in",
|
"please zoom in",
|
||||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
icon: const Icon(Icons.assistant_photo_outlined,
|
||||||
snackPosition: SnackPosition.TOP,
|
size: 40.0, color: Colors.blue),
|
||||||
duration: Duration(milliseconds: 800),
|
snackPosition: SnackPosition.TOP,
|
||||||
backgroundColor: Colors.yellow,
|
duration: const Duration(seconds: 2),
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
backgroundColor: Colors.yellow,
|
||||||
);
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
|
);
|
||||||
showPopup = false;
|
showPopup = false;
|
||||||
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
||||||
}
|
}
|
||||||
if(value != null && value.collection.isNotEmpty){
|
if (value.features.isNotEmpty) {
|
||||||
//print("---- added---");
|
////print("---- added---");
|
||||||
locations.add(value);
|
locations.add(value);
|
||||||
loadCatsv2();
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 2024-04-03 Akira .. Update the code . See ticket 2800.
|
||||||
|
//
|
||||||
|
void loadLocationsBound() {
|
||||||
|
if (isCustomAreaSelected.value == true) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
locations.clear();
|
||||||
|
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
||||||
|
if (currentCat.isNotEmpty && currentCat[0] == "-all-") {
|
||||||
|
cat = "";
|
||||||
|
}
|
||||||
|
LatLngBounds bounds = mapController.bounds!;
|
||||||
|
currentBound.clear();
|
||||||
|
currentBound.add(bounds);
|
||||||
|
|
||||||
|
isLoading.value = true; // ローディング状態をtrueに設定
|
||||||
|
|
||||||
|
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) {
|
||||||
|
isLoading.value = false; // ローディング状態をfalseに設定
|
||||||
|
|
||||||
|
if (value == null) {
|
||||||
|
// APIからのレスポンスがnullの場合は処理を中断
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value.features.isEmpty) {
|
||||||
|
if (showPopup == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Get.snackbar(
|
||||||
|
"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(seconds: 3),
|
||||||
|
backgroundColor: Colors.yellow,
|
||||||
|
);
|
||||||
|
showPopup = false;
|
||||||
|
}
|
||||||
|
if (value.features.isNotEmpty) {
|
||||||
|
locations.add(value);
|
||||||
|
}
|
||||||
|
}).catchError((error) {
|
||||||
|
isLoading.value = false; // ローディング状態をfalseに設定
|
||||||
|
|
||||||
|
// エラーハンドリング: APIリクエストが失敗した場合
|
||||||
|
Get.snackbar(
|
||||||
|
"Error",
|
||||||
|
"Failed to load locations. Please check your internet connection and try again.",
|
||||||
|
icon: const Icon(Icons.error, size: 40.0, color: Colors.red),
|
||||||
|
snackPosition: SnackPosition.TOP,
|
||||||
|
duration: const Duration(milliseconds: 800),
|
||||||
|
backgroundColor: Colors.yellow,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBound(LatLngBounds bounds){
|
void setBound(LatLngBounds bounds) {
|
||||||
currentBound.clear();
|
currentBound.clear();
|
||||||
currentBound.add(bounds);
|
currentBound.add(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zoomtoMainPerf(String id){
|
GeoJSONFeature? getFeatureForLatLong(double lat, double long) {
|
||||||
|
if (locations.isNotEmpty) {
|
||||||
PerfectureService.getMainPerfExt(id).then((value){
|
GeoJSONFeature? foundFeature;
|
||||||
LatLng lat1 = LatLng(value![1], value[0]);
|
|
||||||
LatLng lat2 = LatLng(value[3], value[2]);
|
|
||||||
LatLngBounds bound = LatLngBounds(lat1, lat2);
|
|
||||||
mapController!.fitBounds(bound);
|
|
||||||
setBound(bound);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void zoomtoSubPerf(String id){
|
locations[0].features.forEach((i) {
|
||||||
|
GeoJSONMultiPoint p = i!.geometry as GeoJSONMultiPoint;
|
||||||
print("zooooom");
|
if (p.coordinates[0][1] == lat && p.coordinates[0][0] == long) {
|
||||||
|
foundFeature = i;
|
||||||
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);
|
|
||||||
setBound(bound);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void populateForPerf(String perf, MapController mapController){
|
|
||||||
loadSubPerfFor(perf);
|
|
||||||
loadLocationforPerf(perf, mapController);
|
|
||||||
zoomtoMainPerf(perf);
|
|
||||||
is_loading.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void populateForSubPerf(String subperf, MapController mapController){
|
|
||||||
//subDropdownValue = subperf;
|
|
||||||
loadLocationforSubPerf(subperf, mapController);
|
|
||||||
zoomtoSubPerf(subperf);
|
|
||||||
is_loading.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
return foundFeature;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void getAction(){
|
|
||||||
//print(currentUser[0]["user"]["id"]);
|
|
||||||
//print(currentFeature[0].properties!["location_id"]);
|
|
||||||
if(currentUser.length == 0){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int user_id = 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){
|
|
||||||
currentAction.clear();
|
|
||||||
currentAction.add(value);
|
|
||||||
print("------${currentAction[0]}");
|
|
||||||
}else{
|
|
||||||
List<dynamic> initval = [{"user": user_id, "location": location_id, "wanttogo": false, "like": false, "checkin": false}];
|
|
||||||
currentAction.clear();
|
|
||||||
currentAction.add(initval);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void makeNext(GeoJsonFeature fs){
|
|
||||||
|
|
||||||
if(rog_mode == 1){
|
|
||||||
DestinationController destinationController = Get.find<DestinationController>();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<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){
|
|
||||||
currentFeature.clear();
|
|
||||||
}
|
|
||||||
if(i >= locations[0].collection.length - 1 ){
|
|
||||||
currentFeature.add(locations[0].collection[0] 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<DestinationController>();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<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){
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,178 +1,169 @@
|
|||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/model/gps_data.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
import 'package:rogapp/services/maxtrix_service.dart';
|
import 'package:rogapp/services/DatabaseService.dart';
|
||||||
|
import 'package:rogapp/utils/database_gps.dart';
|
||||||
import 'package:rogapp/utils/database_helper.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/list_widget.dart';
|
||||||
import 'package:rogapp/widgets/map_widget.dart';
|
import 'package:rogapp/widgets/map_widget.dart';
|
||||||
|
|
||||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
|
||||||
|
|
||||||
class IndexPage extends GetView<IndexController> {
|
class IndexPage extends GetView<IndexController> {
|
||||||
IndexPage({Key? key}) : super(key: key);
|
IndexPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async => false,
|
||||||
indexController.switchPage(AppPages.INITIAL);
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
//drawer: const DrawerPage(),
|
drawer: DrawerPage(),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
title: Text("add_location".tr),
|
||||||
icon: Icon(Icons.arrow_back_ios),
|
actions: [
|
||||||
onPressed: (){
|
// IconButton(
|
||||||
indexController.switchPage(AppPages.TRAVEL);
|
// onPressed: () {
|
||||||
|
// DatabaseService ds = DatabaseService();
|
||||||
|
// ds.updateDatabase();
|
||||||
|
// },
|
||||||
|
// icon: const Icon(Icons.ten_k_sharp)),
|
||||||
|
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
// GpsDatabaseHelper db = GpsDatabaseHelper.instance;
|
||||||
|
// List<GpsData> data = await db.getGPSData(
|
||||||
|
// indexController.currentUser[0]["user"]['team_name'],
|
||||||
|
// indexController.currentUser[0]["user"]["event_code"]);
|
||||||
|
// print("GPS data is ${data.length}");
|
||||||
|
Get.toNamed(AppPages.GPS);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.telegram)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed(AppPages.HISTORY);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.history)),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
final tk = indexController.currentUser[0]["token"];
|
||||||
|
if (tk != null) {
|
||||||
|
destinationController.fixMapBound(tk);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh)),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(AppPages.SEARCH);
|
||||||
},
|
},
|
||||||
),
|
child: Container(
|
||||||
//automaticallyImplyLeading: false,
|
height: 32,
|
||||||
title: Text("add_location".tr),
|
width: 75,
|
||||||
actions: [
|
decoration: BoxDecoration(
|
||||||
InkWell(
|
color: Colors.blue,
|
||||||
onTap: (){
|
borderRadius: BorderRadius.circular(25),
|
||||||
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),),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
//CatWidget(indexController: indexController,),
|
child: const Center(
|
||||||
],
|
child: Icon(Icons.search),
|
||||||
),
|
|
||||||
bottomNavigationBar: BottomAppBar(
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: <Widget>[
|
|
||||||
Padding(
|
|
||||||
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);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
//CatWidget(indexController: indexController,),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
// bottomNavigationBar: BottomAppBar(
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: <Widget>[
|
||||||
|
// Obx(
|
||||||
|
// () => destinationController.isInRog.value == true
|
||||||
|
// ? IconButton(
|
||||||
|
// onPressed: () {},
|
||||||
|
// icon: const Icon(
|
||||||
|
// Icons.run_circle,
|
||||||
|
// size: 44,
|
||||||
|
// color: Colors.green,
|
||||||
|
// ))
|
||||||
|
// : IconButton(
|
||||||
|
// onPressed: () {},
|
||||||
|
// icon: const Icon(
|
||||||
|
// Icons.run_circle,
|
||||||
|
// size: 44,
|
||||||
|
// color: Colors.black12,
|
||||||
|
// )),
|
||||||
|
// ),
|
||||||
|
// Padding(
|
||||||
|
// padding:
|
||||||
|
// const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||||
|
// child: InkWell(
|
||||||
|
// child: Obx(() => destinationController
|
||||||
|
// .isGpsSelected.value ==
|
||||||
|
// 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(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: (){
|
onPressed: () {
|
||||||
indexController.toggleMode();
|
indexController.toggleMode();
|
||||||
if(indexController.currentCat.isNotEmpty){
|
|
||||||
print(indexController.currentCat[0].toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
tooltip: 'Increment',
|
elevation: 1.0,
|
||||||
child: Obx(() =>
|
child: Obx(
|
||||||
indexController.mode == 0 ?
|
() => indexController.mode.value == 0
|
||||||
Image(image: AssetImage('assets/images/list2.png'))
|
? const Image(image: AssetImage('assets/images/list2.png'))
|
||||||
:
|
: const Image(image: AssetImage('assets/images/map.png')),
|
||||||
Image(image: AssetImage('assets/images/map.png')),
|
|
||||||
),
|
),
|
||||||
elevation: 4.0,
|
|
||||||
),
|
),
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Container(
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
||||||
// alignment: Alignment.centerLeft,
|
|
||||||
// height: 50.0,
|
|
||||||
// //child: SingleChildScrollView(
|
|
||||||
// // scrollDirection: Axis.horizontal,
|
|
||||||
// // child:Row(
|
|
||||||
// // mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
// // children: [
|
|
||||||
// // TextButton(child:Text("Main Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.MAINPERF);},),
|
|
||||||
// // TextButton(child:Text("Sub Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SUBPERF);},),
|
|
||||||
// // TextButton(child:Text("Cities >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CITY);},),
|
|
||||||
// // TextButton(child:Text("Categories", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CATEGORY);},),
|
|
||||||
// // ],
|
|
||||||
// // )
|
|
||||||
// // ),
|
|
||||||
// child: SingleChildScrollView(
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// child: Obx(() =>
|
|
||||||
// Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// children: [
|
|
||||||
// indexController.is_mapController_loaded.value == false ?
|
|
||||||
// Center(child: CircularProgressIndicator())
|
|
||||||
// :
|
|
||||||
// BreadCrumbWidget(mapController: indexController.mapController),
|
|
||||||
// Container(width: 24.0,),
|
|
||||||
// // Row(
|
|
||||||
// // children: [
|
|
||||||
// // indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
|
|
||||||
// // indexController.currentCat.isNotEmpty ?
|
|
||||||
// // IconButton(
|
|
||||||
// // onPressed: (){
|
|
||||||
// // indexController.currentCat.clear();
|
|
||||||
// // indexController.loadLocationsBound();
|
|
||||||
// // },
|
|
||||||
// // icon: Icon(Icons.cancel, color: Colors.red,)
|
|
||||||
// // ) :
|
|
||||||
// // Container(width: 0, height: 0,)
|
|
||||||
// // ],
|
|
||||||
// // )
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Obx(() =>
|
child: Obx(
|
||||||
indexController.mode == 0 ?
|
() => indexController.mode.value == 0
|
||||||
MapWidget() :
|
? MapWidget()
|
||||||
ListWidget(),
|
: const ListWidget(),
|
||||||
)
|
))
|
||||||
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -17,18 +17,18 @@ class _LandingPageState extends State<LandingPage> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
const Text(
|
||||||
"こんにちは!",
|
"こんにちは!",
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
||||||
),
|
),
|
||||||
SizedBox(height: 30,),
|
const SizedBox(height: 30,),
|
||||||
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -38,11 +38,11 @@ class _LandingPageState extends State<LandingPage> {
|
|||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: MediaQuery.of(context).size.height/3,
|
height: MediaQuery.of(context).size.height/3,
|
||||||
decoration: BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg'))
|
image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg'))
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20.0,),
|
const SizedBox(height: 20.0,),
|
||||||
MaterialButton(
|
MaterialButton(
|
||||||
minWidth: double.infinity,
|
minWidth: double.infinity,
|
||||||
height:60,
|
height:60,
|
||||||
@ -51,18 +51,18 @@ class _LandingPageState extends State<LandingPage> {
|
|||||||
},
|
},
|
||||||
color: Colors.indigoAccent[400],
|
color: Colors.indigoAccent[400],
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
side: BorderSide(
|
side: const BorderSide(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(40)
|
borderRadius: BorderRadius.circular(40)
|
||||||
),
|
),
|
||||||
child: Text("ログイン",style: TextStyle(
|
child: const Text("ログイン",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||||
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 15.0,),
|
const SizedBox(height: 15.0,),
|
||||||
|
|
||||||
MaterialButton(
|
MaterialButton(
|
||||||
minWidth: double.infinity,
|
minWidth: double.infinity,
|
||||||
@ -74,7 +74,7 @@ class _LandingPageState extends State<LandingPage> {
|
|||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(40)
|
borderRadius: BorderRadius.circular(40)
|
||||||
),
|
),
|
||||||
child: Text("サインアップ",style: TextStyle(
|
child: const Text("サインアップ",style: TextStyle(
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,
|
fontWeight: FontWeight.w600,fontSize: 16,
|
||||||
|
|
||||||
),),
|
),),
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class LoadingPage extends StatelessWidget {
|
class LoadingPage extends StatelessWidget {
|
||||||
const LoadingPage({ Key? key }) : super(key: key);
|
const LoadingPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.center,
|
||||||
margin: EdgeInsets.only(top: 20),
|
margin: const EdgeInsets.only(top: 20),
|
||||||
child: CircularProgressIndicator(
|
child: const CircularProgressIndicator(
|
||||||
value: 0.8,
|
value: 0.8,
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,222 +1,321 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
|
||||||
class LoginPage extends StatelessWidget {
|
class LoginPage extends StatelessWidget {
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
TextEditingController emailController = TextEditingController();
|
TextEditingController emailController = TextEditingController();
|
||||||
TextEditingController passwordController = TextEditingController();
|
TextEditingController passwordController = TextEditingController();
|
||||||
|
|
||||||
|
LoginPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
automaticallyImplyLeading: false,
|
||||||
elevation: 0,
|
),
|
||||||
backgroundColor: Colors.white,
|
/* 2024-04-03 Updated by Akira . See https://wiki.sumasen.net/issues/2796?issue_count=1&issue_position=1
|
||||||
leading:
|
appBar: AppBar(
|
||||||
IconButton( onPressed: (){
|
elevation: 0,
|
||||||
Navigator.pop(context);
|
backgroundColor: Colors.white,
|
||||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
leading: IconButton(
|
||||||
),
|
onPressed: () {
|
||||||
body:
|
Navigator.pop(context);
|
||||||
indexController.currentUser.length == 0 ?
|
},
|
||||||
Container(
|
icon: const Icon(
|
||||||
width: double.infinity,
|
Icons.arrow_back_ios,
|
||||||
child: Column(
|
size: 20,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
color: Colors.black,
|
||||||
children: [
|
)),
|
||||||
Column(
|
),
|
||||||
children: [
|
*/
|
||||||
Column(
|
body: indexController.currentUser.isEmpty
|
||||||
children: [
|
? SizedBox(
|
||||||
Container(
|
width: double.infinity,
|
||||||
height: MediaQuery.of(context).size.height/6,
|
child: Column(
|
||||||
decoration: BoxDecoration(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
|
children: [
|
||||||
),
|
Column(
|
||||||
),
|
|
||||||
SizedBox(height: 5,),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 40
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
makeInput(label: "email".tr, controller: emailController),
|
|
||||||
makeInput(label: "password".tr, controller: passwordController, obsureText: true),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(40),
|
|
||||||
),
|
|
||||||
child: Obx((() =>
|
|
||||||
indexController.is_loading == true ? MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:60,
|
|
||||||
onPressed: (){
|
|
||||||
|
|
||||||
},
|
|
||||||
color: Colors.grey[400],
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
) :
|
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
MaterialButton(
|
Container(
|
||||||
minWidth: double.infinity,
|
height: MediaQuery.of(context).size.height / 6,
|
||||||
height:40,
|
decoration: const BoxDecoration(
|
||||||
onPressed: (){
|
image: DecorationImage(
|
||||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
image: AssetImage(
|
||||||
Get.snackbar(
|
'assets/images/login_image.jpg'))),
|
||||||
"no_values".tr,
|
),
|
||||||
"email_and_password_required".tr,
|
const SizedBox(
|
||||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
height: 5,
|
||||||
snackPosition: SnackPosition.TOP,
|
),
|
||||||
duration: Duration(milliseconds: 800),
|
|
||||||
backgroundColor: Colors.yellow,
|
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
indexController.is_loading.value = true;
|
|
||||||
indexController.login(emailController.text, passwordController.text, context);
|
|
||||||
},
|
|
||||||
color: Colors.indigoAccent[400],
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("ログイン",style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 5.0,),
|
|
||||||
MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:40,
|
|
||||||
onPressed: (){
|
|
||||||
Get.toNamed(AppPages.REGISTER);
|
|
||||||
},
|
|
||||||
color: Colors.redAccent,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("sign_up".tr,style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 2.0,),
|
|
||||||
MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:40,
|
|
||||||
onPressed: (){
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
color: Colors.grey,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("cancel".tr,style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
),
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
makeInput(
|
||||||
|
label: "email".tr, controller: emailController),
|
||||||
|
makeInput(
|
||||||
|
label: "password".tr,
|
||||||
|
controller: passwordController,
|
||||||
|
obsureText: true),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(top: 3, left: 3),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(40),
|
||||||
|
),
|
||||||
|
child: Obx(
|
||||||
|
(() => indexController.isLoading.value == true
|
||||||
|
? MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
onPressed: () {},
|
||||||
|
color: Colors.grey[400],
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 40,
|
||||||
|
onPressed: () async {
|
||||||
|
if (emailController.text.isEmpty ||
|
||||||
|
passwordController
|
||||||
|
.text.isEmpty) {
|
||||||
|
Get.snackbar(
|
||||||
|
"no_values".tr,
|
||||||
|
"email_and_password_required"
|
||||||
|
.tr,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons
|
||||||
|
.assistant_photo_outlined,
|
||||||
|
size: 40.0,
|
||||||
|
color: Colors.blue),
|
||||||
|
snackPosition:
|
||||||
|
SnackPosition.TOP,
|
||||||
|
duration: const Duration(
|
||||||
|
seconds: 3),
|
||||||
|
backgroundColor: Colors.yellow,
|
||||||
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
indexController.isLoading.value =
|
||||||
|
true;
|
||||||
|
indexController.login(
|
||||||
|
emailController.text,
|
||||||
|
passwordController.text,
|
||||||
|
context);
|
||||||
|
/*
|
||||||
|
try {
|
||||||
|
bool isLoggedIn = await indexController.login(emailController.text, passwordController.text,context);
|
||||||
|
if (isLoggedIn) {
|
||||||
|
Get.offAllNamed(AppPages.INDEX);
|
||||||
|
} else {
|
||||||
|
Get.snackbar(
|
||||||
|
"Login Failed",
|
||||||
|
"Invalid email or password",
|
||||||
|
icon: const Icon(Icons.error, color: Colors.red),
|
||||||
|
snackPosition: SnackPosition.BOTTOM,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
Get.snackbar(
|
||||||
|
"Error",
|
||||||
|
"An error occurred during login",
|
||||||
|
icon: const Icon(Icons.error, color: Colors.red),
|
||||||
|
snackPosition: SnackPosition.BOTTOM,
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
indexController.isLoading.value = false;
|
||||||
|
}
|
||||||
|
*/ // ここまで
|
||||||
|
},
|
||||||
|
color: Colors.indigoAccent[400],
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: const Text(
|
||||||
|
"ログイン",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
/*
|
||||||
|
child: Obx(
|
||||||
|
() => indexController.isLoading.value
|
||||||
|
? const CircularProgressIndicator(color: Colors.white)
|
||||||
|
: const Text(
|
||||||
|
"ログイン",
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 16, color: Colors.white70),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
*/ // ここまで
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 5.0,
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 40,
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed(AppPages.REGISTER);
|
||||||
|
},
|
||||||
|
color: Colors.redAccent,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: Text(
|
||||||
|
"sign_up".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 2.0,
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 40,
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
color: Colors.grey,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: Text(
|
||||||
|
"cancel".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
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: const TextStyle(
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
"app_developed_by_gifu_dx".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
fontSize: 10.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
"※第8回と第9回は、岐阜県からの「清流の国ぎふ」SDGs推進ネットワーク連携促進補助金を受けています",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize:
|
||||||
|
12, // Consider adjusting the font size if the text is too small.
|
||||||
|
// Removed overflow: TextOverflow.ellipsis to allow text wrapping.
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
)
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 5,),
|
)
|
||||||
Row(
|
: TextButton(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
onPressed: () {
|
||||||
children: [
|
indexController.currentUser.clear();
|
||||||
Flexible(
|
},
|
||||||
child: Padding(
|
child: const Text("Already Logged in, Click to logout"),
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle(
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text("app_developed_by_gifu_dx".tr, style: TextStyle(
|
|
||||||
overflow: TextOverflow.ellipsis, fontSize: 10.0
|
|
||||||
),),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
|
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
):
|
|
||||||
Container(
|
|
||||||
child: TextButton(
|
|
||||||
onPressed: (){
|
|
||||||
indexController.currentUser.clear();
|
|
||||||
},
|
|
||||||
child: Text("Already Logged in, Click to logout"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
Widget makeInput(
|
||||||
|
{label, required TextEditingController controller, obsureText = false}) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(label,style:TextStyle(
|
Text(
|
||||||
fontSize: 15,
|
label,
|
||||||
fontWeight: FontWeight.w400,
|
style: const TextStyle(
|
||||||
color: Colors.black87
|
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
|
||||||
),),
|
),
|
||||||
SizedBox(height: 5,),
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
obscureText: obsureText,
|
obscureText: obsureText,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: (Colors.grey[400])!,
|
color: (Colors.grey[400])!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
borderSide: BorderSide(color: (Colors.grey[400])!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
SizedBox(height: 30.0,)
|
height: 30.0,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,195 +15,232 @@ class LoginPopupPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
leading: IconButton(
|
||||||
elevation: 0,
|
onPressed: () {
|
||||||
backgroundColor: Colors.white,
|
Navigator.pop(context);
|
||||||
leading:
|
},
|
||||||
IconButton( onPressed: (){
|
icon: const Icon(
|
||||||
Navigator.pop(context);
|
Icons.arrow_back_ios,
|
||||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
size: 20,
|
||||||
),
|
color: Colors.black,
|
||||||
body:
|
)),
|
||||||
indexController.currentUser.length == 0 ?
|
),
|
||||||
Container(
|
body: indexController.currentUser.isEmpty
|
||||||
width: double.infinity,
|
? SizedBox(
|
||||||
child: Column(
|
width: double.infinity,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
Column(
|
children: [
|
||||||
children: [
|
Column(
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height/5,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 5,),
|
|
||||||
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
horizontal: 40
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
makeInput(label: "email".tr, controller: emailController),
|
|
||||||
makeInput(label: "password".tr, controller: passwordController, obsureText: true),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(40),
|
|
||||||
),
|
|
||||||
child: Obx((() =>
|
|
||||||
indexController.is_loading == true ? MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:60,
|
|
||||||
onPressed: (){
|
|
||||||
|
|
||||||
},
|
|
||||||
color: Colors.grey[400],
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
) :
|
|
||||||
Column(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
MaterialButton(
|
Container(
|
||||||
minWidth: double.infinity,
|
height: MediaQuery.of(context).size.height / 5,
|
||||||
height:60,
|
decoration: const BoxDecoration(
|
||||||
onPressed: (){
|
image: DecorationImage(
|
||||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
image: AssetImage(
|
||||||
Get.snackbar(
|
'assets/images/login_image.jpg'))),
|
||||||
"no_values".tr,
|
),
|
||||||
"email_and_password_required".tr,
|
const SizedBox(
|
||||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
height: 5,
|
||||||
snackPosition: SnackPosition.TOP,
|
),
|
||||||
duration: Duration(milliseconds: 800),
|
|
||||||
backgroundColor: Colors.yellow,
|
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
indexController.is_loading.value = true;
|
|
||||||
indexController.login(emailController.text, passwordController.text, context);
|
|
||||||
},
|
|
||||||
color: Colors.indigoAccent[400],
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("ログイン",style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 19.0,),
|
|
||||||
MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:50,
|
|
||||||
onPressed: (){
|
|
||||||
Get.toNamed(AppPages.REGISTER);
|
|
||||||
},
|
|
||||||
color: Colors.redAccent,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("sign_up".tr,style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 19.0,),
|
|
||||||
MaterialButton(
|
|
||||||
minWidth: double.infinity,
|
|
||||||
height:50,
|
|
||||||
onPressed: (){
|
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
|
||||||
},
|
|
||||||
color: Colors.grey,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(40)
|
|
||||||
),
|
|
||||||
child: Text("cancel".tr,style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
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(
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),),
|
|
||||||
),
|
),
|
||||||
),
|
Padding(
|
||||||
],
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
)
|
child: Column(
|
||||||
],
|
children: [
|
||||||
|
makeInput(
|
||||||
|
label: "email".tr, controller: emailController),
|
||||||
|
makeInput(
|
||||||
|
label: "password".tr,
|
||||||
|
controller: passwordController,
|
||||||
|
obsureText: true),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(top: 3, left: 3),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(40),
|
||||||
|
),
|
||||||
|
child: Obx(
|
||||||
|
(() => indexController.isLoading.value == true
|
||||||
|
? MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
onPressed: () {},
|
||||||
|
color: Colors.grey[400],
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: const CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 60,
|
||||||
|
onPressed: () {
|
||||||
|
if (emailController.text.isEmpty ||
|
||||||
|
passwordController
|
||||||
|
.text.isEmpty) {
|
||||||
|
Get.snackbar(
|
||||||
|
"no_values".tr,
|
||||||
|
"email_and_password_required"
|
||||||
|
.tr,
|
||||||
|
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"))
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
indexController.isLoading.value =
|
||||||
|
true;
|
||||||
|
indexController.login(
|
||||||
|
emailController.text,
|
||||||
|
passwordController.text,
|
||||||
|
context);
|
||||||
|
},
|
||||||
|
color: Colors.indigoAccent[400],
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: const Text(
|
||||||
|
"ログイン",
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 19.0,
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed(AppPages.REGISTER);
|
||||||
|
},
|
||||||
|
color: Colors.redAccent,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: Text(
|
||||||
|
"sign_up".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 19.0,
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
minWidth: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
onPressed: () {
|
||||||
|
Get.toNamed(AppPages.TRAVEL);
|
||||||
|
},
|
||||||
|
color: Colors.grey,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(40)),
|
||||||
|
child: Text(
|
||||||
|
"cancel".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.white70),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
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: const TextStyle(
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
indexController.currentUser.clear();
|
||||||
|
},
|
||||||
|
child: const Text("Already Logged in, Click to logout"),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
):
|
|
||||||
Container(
|
|
||||||
child: TextButton(
|
|
||||||
onPressed: (){
|
|
||||||
indexController.currentUser.clear();
|
|
||||||
},
|
|
||||||
child: Text("Already Logged in, Click to logout"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
Widget makeInput(
|
||||||
|
{label, required TextEditingController controller, obsureText = false}) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(label,style:TextStyle(
|
Text(
|
||||||
fontSize: 15,
|
label,
|
||||||
fontWeight: FontWeight.w400,
|
style: const TextStyle(
|
||||||
color: Colors.black87
|
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
|
||||||
),),
|
),
|
||||||
SizedBox(height: 5,),
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
obscureText: obsureText,
|
obscureText: obsureText,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: (Colors.grey[400])!,
|
color: (Colors.grey[400])!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
borderSide: BorderSide(color: (Colors.grey[400])!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
SizedBox(height: 30.0,)
|
height: 30.0,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,31 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
// import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
|
||||||
class MainPerfPage extends StatelessWidget {
|
// class MainPerfPage extends StatelessWidget {
|
||||||
MainPerfPage({Key? key}) : super(key: key);
|
// MainPerfPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
IndexController indexController = Get.find<IndexController>();
|
// IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
Widget build(BuildContext context) {
|
// Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
// return Scaffold(
|
||||||
appBar: AppBar(
|
// appBar: AppBar(
|
||||||
title: Text("Select Main Perfecture"),
|
// title: const Text("Select Main Perfecture"),
|
||||||
),
|
// ),
|
||||||
body: ListView.builder(
|
// body: ListView.builder(
|
||||||
itemCount: indexController.perfectures.length,
|
// itemCount: indexController.perfectures.length,
|
||||||
itemBuilder: (context, index){
|
// itemBuilder: (context, index){
|
||||||
return ListTile(
|
// return ListTile(
|
||||||
onTap: (){
|
// onTap: (){
|
||||||
indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
|
// indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
|
||||||
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!);
|
// indexController.populateForPerf(indexController.dropdownValue, indexController.mapController);
|
||||||
Get.back();
|
// Get.back();
|
||||||
},
|
// },
|
||||||
title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),
|
// title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
@ -1,233 +1,132 @@
|
|||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
class PermissionHandlerScreen extends StatefulWidget {
|
class PermissionHandlerScreen extends StatefulWidget {
|
||||||
const PermissionHandlerScreen({super.key});
|
const PermissionHandlerScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
State<PermissionHandlerScreen> createState() =>
|
||||||
|
_PermissionHandlerScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState(){
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_checkPermissions();
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_checkPermissionStatus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkPermissions() async {
|
_checkPermissionStatus() async {
|
||||||
// You can ask for multiple permissions at once.
|
PermissionStatus status = await Permission.location.status;
|
||||||
Map<Permission, PermissionStatus> statuses = await [
|
|
||||||
Permission.location,
|
|
||||||
Permission.camera,
|
|
||||||
].request();
|
|
||||||
|
|
||||||
bool isCameraGranted = statuses[Permission.camera]!.isGranted;
|
if (status.isGranted == false) {
|
||||||
bool isLocationGranted = statuses[Permission.location]!.isGranted;
|
if (context.mounted) {
|
||||||
|
showAlert(context);
|
||||||
if (!isCameraGranted || !isLocationGranted) {
|
}
|
||||||
bool isCameraPermanentlyDenied = statuses[Permission.camera]!.isPermanentlyDenied;
|
} else if (status.isPermanentlyDenied) {
|
||||||
bool isLocationPermanentlyDenied = statuses[Permission.location]!.isPermanentlyDenied;
|
await requestPermission();
|
||||||
|
|
||||||
if (isCameraPermanentlyDenied || isLocationPermanentlyDenied) {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text('Permissions not granted'),
|
|
||||||
content: const Text(
|
|
||||||
'This app needs camera and location permissions to function. Please open settings and grant permissions.'),
|
|
||||||
actions: <Widget>[
|
|
||||||
ElevatedButton(
|
|
||||||
child: const Text('Open settings'),
|
|
||||||
onPressed: () {
|
|
||||||
openAppSettings();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// ask permissions again
|
if (mounted) {
|
||||||
_checkPermissions();
|
Get.toNamed(AppPages.LOGIN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Get.toNamed(AppPages.INITIAL);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void showAlert(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => AlertDialog(
|
||||||
|
title: const Text('ロケーション許可'),
|
||||||
|
content: const SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text('ぎふナビ "アプリへようこそ!\n'),
|
||||||
|
Text('収集データ:\n'),
|
||||||
|
Text(
|
||||||
|
'岐阜ナビアプリをより快適にご利用いただくために、チェックポイントでの自動チェックインのための位置情報を収集しています。また、撮影した画像やチェックインした時間を収集し、チャレンジの勝者を決定します。\n'),
|
||||||
|
Text('お客様のデータの使用方法:\n'),
|
||||||
|
Text(
|
||||||
|
'お客様のデータは、アプリを改善し、競争力のある魅力的な体験を提供するのに役立ちます。お客様の位置情報と画像は、個人を特定できない統計データとして処理され、いかなる個人情報にもリンクされないようにしています\n'),
|
||||||
|
Text('お客様の管理:\n'),
|
||||||
|
Text(
|
||||||
|
'お客様はご自身のデータを完全に管理することができます。アプリの設定でいつでも同意を撤回することができます。位置情報の収集に同意しなくても、ぎふナビを楽しむことはできますが、自動チェックインや競技への参加など、一部の機能が制限されることを覚えておいてください。位置情報、画像、時刻情報の利用に同意する場合は「許可」を選択してください。許可しない場合は、「許可しない」を選択してください。あなたの選択は、アプリの他の機能を使用することに影響しません。\n'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
requestPermission();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> requestPermission() async {
|
||||||
|
PermissionStatus permission = await Permission.location.status;
|
||||||
|
if (permission == PermissionStatus.permanentlyDenied) {
|
||||||
|
showPermanentAlert();
|
||||||
|
} else {
|
||||||
|
PermissionStatus newPermission = await Permission.location.request();
|
||||||
|
if (newPermission != PermissionStatus.granted) {
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
if (context.mounted) {
|
||||||
|
Get.toNamed(AppPages.LOGIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return const Scaffold(
|
||||||
body: Center(
|
body: Text(""),
|
||||||
child: Text('Checking permissions...'),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showPermanentAlert() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => AlertDialog(
|
||||||
|
title: const Text('無効'),
|
||||||
|
content: const SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text('位置情報が無効になっています'),
|
||||||
|
Text(
|
||||||
|
'このアプリケーションへの位置情報アクセスが無効になっています。続行するには設定>プライバシーとセキュリティ>位置情報サービス>岐阜ナビ で有効にしてください。'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () async {
|
||||||
|
await openAppSettings().then(
|
||||||
|
(value) async {
|
||||||
|
if (value) {
|
||||||
|
if (await Permission
|
||||||
|
.location.status.isPermanentlyDenied ==
|
||||||
|
true &&
|
||||||
|
await Permission.location.status.isGranted ==
|
||||||
|
false) {
|
||||||
|
requestPermission(); /* opens app settings until permission is granted */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
// import 'package:get/get.dart';
|
|
||||||
// import 'package:permission_handler/permission_handler.dart';
|
|
||||||
// import 'package:rogapp/routes/app_pages.dart';
|
|
||||||
|
|
||||||
// class PermissionHandlerScreen extends StatefulWidget {
|
|
||||||
// PermissionHandlerScreen({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|
||||||
|
|
||||||
|
|
||||||
// Future<void> _showMyDialog() async {
|
|
||||||
// return showDialog<void>(
|
|
||||||
// context: context,
|
|
||||||
// barrierDismissible: false, // user must tap button!
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return AlertDialog(
|
|
||||||
// title: const Text('ロケーション許可'),
|
|
||||||
// content: SingleChildScrollView(
|
|
||||||
// child: ListBody(
|
|
||||||
// children: const <Widget>[
|
|
||||||
// Text( 'このアプリでは、位置情報の収集を行います。'),
|
|
||||||
// Text( 'このアプリでは、開始時点で位置情報を収集します。'),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// actions: <Widget>[
|
|
||||||
// TextButton(
|
|
||||||
// child: const Text('わかった'),
|
|
||||||
// onPressed: () {
|
|
||||||
// //Navigator.of(context).pop();
|
|
||||||
// Get.toNamed(AppPages.TRAVEL);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// void initState() {
|
|
||||||
// // TODO: implement initState
|
|
||||||
// super.initState();
|
|
||||||
|
|
||||||
// //permissionServiceCall();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Future<PermissionStatus> checkLocationPermission() async {
|
|
||||||
// return await Permission.location.status;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// permissionServiceCall() async {
|
|
||||||
// await permissionServices().then(
|
|
||||||
// (value) {
|
|
||||||
// if (value != null) {
|
|
||||||
// if (value[Permission.location]!.isGranted ) {
|
|
||||||
// /* ========= New Screen Added ============= */
|
|
||||||
|
|
||||||
// Get.toNamed(AppPages.TRAVEL);
|
|
||||||
|
|
||||||
// // Navigator.pushReplacement(
|
|
||||||
// // context,
|
|
||||||
// // MaterialPageRoute(builder: (context) => SplashScreen()),
|
|
||||||
// // );
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// _showMyDialog();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// /*Permission services*/
|
|
||||||
// Future<Map<Permission, PermissionStatus>> permissionServices() async {
|
|
||||||
// // You can request multiple permissions at once.
|
|
||||||
// Map<Permission, PermissionStatus> statuses = await [
|
|
||||||
// Permission.location,
|
|
||||||
|
|
||||||
// //add more permission to request here.
|
|
||||||
// ].request();
|
|
||||||
|
|
||||||
// if (statuses[Permission.location]!.isPermanentlyDenied) {
|
|
||||||
// await openAppSettings().then(
|
|
||||||
// (value) async {
|
|
||||||
// if (value) {
|
|
||||||
// if (await Permission.location.status.isPermanentlyDenied == true &&
|
|
||||||
// await Permission.location.status.isGranted == false) {
|
|
||||||
// // openAppSettings();
|
|
||||||
// permissionServiceCall(); /* opens app settings until permission is granted */
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// if (statuses[Permission.location]!.isDenied) {
|
|
||||||
// permissionServiceCall();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
|
|
||||||
// return statuses;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// var status = Permission.location.status.then((value){
|
|
||||||
// if(value.isGranted == false){
|
|
||||||
// Future.delayed(Duration.zero, () => showAlert(context));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// Get.toNamed(AppPages.TRAVEL);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// return Scaffold(
|
|
||||||
// body: Container(
|
|
||||||
// child: Text(""),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void showAlert(BuildContext context) {
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (_) => AlertDialog(
|
|
||||||
// title: const Text('ロケーション許可'),
|
|
||||||
// content: SingleChildScrollView(
|
|
||||||
// child: ListBody(
|
|
||||||
// children: const <Widget>[
|
|
||||||
// Text( 'このアプリでは、位置情報の収集を行います。'),
|
|
||||||
// Text('岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// actions: <Widget>[
|
|
||||||
// TextButton(
|
|
||||||
// child: const Text('わかった'),
|
|
||||||
// onPressed: () {
|
|
||||||
// permissionServiceCall();
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
@ -1,7 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
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 {
|
class ProgressPage extends StatelessWidget {
|
||||||
const ProgressPage({Key? key}) : super(key: key);
|
const ProgressPage({Key? key}) : super(key: key);
|
||||||
@ -10,7 +7,7 @@ class ProgressPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Center(
|
child: const Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
import 'package:rogapp/routes/app_pages.dart';
|
||||||
|
|
||||||
class RegisterPage extends StatelessWidget {
|
class RegisterPage extends StatelessWidget {
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
TextEditingController emailController = TextEditingController();
|
TextEditingController emailController = TextEditingController();
|
||||||
TextEditingController passwordController = TextEditingController();
|
TextEditingController passwordController = TextEditingController();
|
||||||
TextEditingController confirmPasswordController = TextEditingController();
|
TextEditingController confirmPasswordController = TextEditingController();
|
||||||
|
|
||||||
|
RegisterPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -21,14 +20,19 @@ class RegisterPage extends StatelessWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
leading:
|
leading: IconButton(
|
||||||
IconButton( onPressed: (){
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
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(
|
body: SafeArea(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -39,102 +43,123 @@ class RegisterPage extends StatelessWidget {
|
|||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
Text ("サインアップ", style: TextStyle(
|
const Text(
|
||||||
fontSize: 30,
|
"サインアップ",
|
||||||
fontWeight: FontWeight.bold,
|
style: TextStyle(
|
||||||
),),
|
fontSize: 30,
|
||||||
SizedBox(height: 20,),
|
fontWeight: FontWeight.bold,
|
||||||
Text("アカウントを作成し、無料です",style: TextStyle(
|
),
|
||||||
fontSize: 15,
|
),
|
||||||
color: Colors.grey[700],
|
const SizedBox(
|
||||||
),),
|
height: 20,
|
||||||
SizedBox(height: 30,)
|
),
|
||||||
|
Text(
|
||||||
|
"アカウントを作成し、無料です",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 30,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
horizontal: 40
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
makeInput(label: "Eメール", controller: emailController),
|
makeInput(label: "Eメール", controller: emailController),
|
||||||
makeInput(label: "パスワード", controller: passwordController,obsureText: true),
|
makeInput(
|
||||||
makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
|
label: "パスワード",
|
||||||
|
controller: passwordController,
|
||||||
|
obsureText: true),
|
||||||
|
makeInput(
|
||||||
|
label: "パスワードを認証する",
|
||||||
|
controller: confirmPasswordController,
|
||||||
|
obsureText: true)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(top: 3,left: 3),
|
padding: const EdgeInsets.only(top: 3, left: 3),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(40),
|
borderRadius: BorderRadius.circular(40),
|
||||||
border: Border(
|
border: const Border(
|
||||||
bottom: BorderSide(color: Colors.black),
|
bottom: BorderSide(color: Colors.black),
|
||||||
top: BorderSide(color: Colors.black),
|
top: BorderSide(color: Colors.black),
|
||||||
right: BorderSide(color: Colors.black),
|
right: BorderSide(color: Colors.black),
|
||||||
left: BorderSide(color: Colors.black)
|
left: BorderSide(color: Colors.black))),
|
||||||
)
|
|
||||||
),
|
|
||||||
child: MaterialButton(
|
child: MaterialButton(
|
||||||
minWidth: double.infinity,
|
minWidth: double.infinity,
|
||||||
height:60,
|
height: 60,
|
||||||
onPressed: (){
|
onPressed: () {
|
||||||
if(passwordController.text != confirmPasswordController.text){
|
if (passwordController.text !=
|
||||||
|
confirmPasswordController.text) {
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
"No match",
|
"No match",
|
||||||
"Passwords does not 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,
|
snackPosition: SnackPosition.TOP,
|
||||||
duration: Duration(milliseconds: 800),
|
duration: const Duration(milliseconds: 800),
|
||||||
backgroundColor: Colors.yellow,
|
backgroundColor: Colors.yellow,
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if(emailController.text.isEmpty || passwordController.text.isEmpty){
|
if (emailController.text.isEmpty ||
|
||||||
|
passwordController.text.isEmpty) {
|
||||||
Get.snackbar(
|
Get.snackbar(
|
||||||
"no_values".tr,
|
"no_values".tr,
|
||||||
"email_and_password_required".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,
|
snackPosition: SnackPosition.TOP,
|
||||||
duration: Duration(milliseconds: 800),
|
duration: const Duration(milliseconds: 800),
|
||||||
backgroundColor: Colors.yellow,
|
backgroundColor: Colors.yellow,
|
||||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
indexController.is_loading.value = true;
|
indexController.isLoading.value = true;
|
||||||
indexController.register(emailController.text, passwordController.text, context);
|
indexController.register(emailController.text,
|
||||||
|
passwordController.text, context);
|
||||||
},
|
},
|
||||||
color: Colors.redAccent,
|
color: Colors.redAccent,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(40)
|
borderRadius: BorderRadius.circular(40)),
|
||||||
|
child: Text(
|
||||||
|
"sign_up".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text("sign_up".tr,style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w600,fontSize: 16,
|
|
||||||
|
|
||||||
),),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20,),
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
const Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: (){
|
onPressed: () {
|
||||||
Get.toNamed(AppPages.LOGIN);
|
Get.toNamed(AppPages.LOGIN);
|
||||||
},
|
},
|
||||||
child: Text("ログイン",style: TextStyle(
|
child: const Text(
|
||||||
fontWeight: FontWeight.w600,
|
"ログイン",
|
||||||
fontSize: 18
|
style: TextStyle(
|
||||||
),),
|
fontWeight: FontWeight.w600, fontSize: 18),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -145,34 +170,38 @@ class RegisterPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
Widget makeInput(
|
||||||
|
{label, required TextEditingController controller, obsureText = false}) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(label,style:TextStyle(
|
Text(
|
||||||
fontSize: 15,
|
label,
|
||||||
fontWeight: FontWeight.w400,
|
style: const TextStyle(
|
||||||
color: Colors.black87
|
fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black87),
|
||||||
),),
|
),
|
||||||
SizedBox(height: 5,),
|
const SizedBox(
|
||||||
|
height: 5,
|
||||||
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
obscureText: obsureText,
|
obscureText: obsureText,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: (Colors.grey[400])!,
|
color: (Colors.grey[400])!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
borderSide: BorderSide(color: (Colors.grey[400])!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
SizedBox(height: 30,)
|
height: 30,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,21 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:geojson_vi/geojson_vi.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
|
||||||
import 'package:get/get.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';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
|
|
||||||
class SearchBarController extends GetxController {
|
class SearchBarController extends GetxController {
|
||||||
|
List<GeoJSONFeature> searchResults = <GeoJSONFeature>[].obs;
|
||||||
|
|
||||||
List<GeoJsonFeature> searchResults = <GeoJsonFeature>[].obs;
|
@override
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
void onInit() {
|
||||||
IndexController indexController = Get.find<IndexController>();
|
IndexController indexController = Get.find<IndexController>();
|
||||||
if(indexController.locations.isNotEmpty){
|
if (indexController.locations.isNotEmpty) {
|
||||||
for(int i=0; i<= indexController.locations[0].collection.length - 1; i++){
|
for (int i = 0;
|
||||||
GeoJsonFeature p = indexController.locations[0].collection[i];
|
i <= indexController.locations[0].features.length - 1;
|
||||||
|
i++) {
|
||||||
|
GeoJSONFeature p = indexController.locations[0].features[i]!;
|
||||||
searchResults.add(p);
|
searchResults.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,29 +1,32 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
import 'package:geojson_vi/geojson_vi.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.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/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/pages/search/search_controller.dart';
|
import 'package:rogapp/pages/search/search_controller.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
|
|
||||||
class SearchPage extends StatelessWidget {
|
class SearchPage extends StatelessWidget {
|
||||||
SearchPage({Key? key}) : super(key: key);
|
SearchPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
SearchBarController searchController = Get.find<SearchBarController>();
|
SearchBarController searchController = Get.find<SearchBarController>();
|
||||||
IndexController indexController = Get.find<IndexController>();
|
IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
Image getImage(int index){
|
Image getImage(int index) {
|
||||||
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
if (searchController.searchResults[index].properties!["photos"] == null ||
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
searchController.searchResults[index].properties!["photos"] == "") {
|
||||||
}
|
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
else{
|
} else {
|
||||||
return Image(
|
return Image(
|
||||||
image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
image: NetworkImage(
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
searchController.searchResults[index].properties!["photos"]),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
return Image.asset("assets/images/empty_image.png");
|
return Image.asset("assets/images/empty_image.png");
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,42 +37,76 @@ class SearchPage extends StatelessWidget {
|
|||||||
elevation: 0,
|
elevation: 0,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed:(){
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Get.back();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
|
icon: const Icon(
|
||||||
title: TypeAheadField(
|
Icons.arrow_back_ios_new,
|
||||||
textFieldConfiguration: TextFieldConfiguration(
|
color: Colors.black,
|
||||||
autofocus: true,
|
)),
|
||||||
),
|
centerTitle: true,
|
||||||
suggestionsCallback: (pattern) async{
|
//title: const CupertinoSearchTextField(),
|
||||||
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
),
|
||||||
//return await
|
body: SingleChildScrollView(
|
||||||
|
child: TypeAheadField<GeoJSONFeature>(
|
||||||
|
// textFieldConfiguration: TextFieldConfiguration(
|
||||||
|
// autofocus: true,
|
||||||
|
// style: DefaultTextStyle.of(context).style.copyWith(
|
||||||
|
// fontStyle: FontStyle.normal,
|
||||||
|
// fontSize: 15.0,
|
||||||
|
// ),
|
||||||
|
// decoration: InputDecoration(
|
||||||
|
// border: const OutlineInputBorder(),
|
||||||
|
// hintText: "検索",
|
||||||
|
// prefixIcon: const Icon(Icons.search),
|
||||||
|
// suffixIcon: IconButton(
|
||||||
|
// icon: const Icon(Icons.clear),
|
||||||
|
// onPressed: () {
|
||||||
|
// // clear the text field
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
onSelected: (GeoJSONFeature suggestion) {
|
||||||
|
indexController.currentFeature.clear();
|
||||||
|
indexController.currentFeature.add(suggestion);
|
||||||
|
DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
|
Destination des =
|
||||||
|
destinationController.festuretoDestination(suggestion);
|
||||||
|
Get.back();
|
||||||
|
showModalBottomSheet(
|
||||||
|
constraints:
|
||||||
|
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||||
|
isScrollControlled: true,
|
||||||
|
context: context,
|
||||||
|
//builder: (context) => BottomSheetWidget(),
|
||||||
|
builder: ((context) => BottomSheetNew(
|
||||||
|
destination: des,
|
||||||
|
)));
|
||||||
},
|
},
|
||||||
itemBuilder: (context, GeoJsonFeature suggestion){
|
|
||||||
|
suggestionsCallback: (pattern) async {
|
||||||
|
return searchController.searchResults
|
||||||
|
.where((GeoJSONFeature element) => element
|
||||||
|
.properties!["location_name"]
|
||||||
|
.toString()
|
||||||
|
.contains(pattern))
|
||||||
|
.toList();
|
||||||
|
//return await
|
||||||
|
},
|
||||||
|
itemBuilder: (context, GeoJSONFeature suggestion) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(suggestion.properties!["location_name"]),
|
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),
|
//leading: getImage(index),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onSuggestionSelected: (GeoJsonFeature suggestion){
|
|
||||||
indexController.currentFeature.clear();
|
|
||||||
indexController.currentFeature.add(suggestion);
|
|
||||||
Get.back();
|
|
||||||
showModalBottomSheet(
|
|
||||||
isScrollControlled: true,
|
|
||||||
context: context,
|
|
||||||
//builder: (context) => BottomSheetWidget(),
|
|
||||||
builder:((context) => BottomSheetNew())
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
//title: const CupertinoSearchTextField(),
|
|
||||||
|
|
||||||
),
|
),
|
||||||
//body:
|
// Obx(() =>
|
||||||
// Obx(() =>
|
|
||||||
// ListView.builder(
|
// ListView.builder(
|
||||||
// itemCount: searchController.searchResults.length,
|
// itemCount: searchController.searchResults.length,
|
||||||
// itemBuilder: (context, index){
|
// itemBuilder: (context, index){
|
||||||
@ -94,4 +131,4 @@ class SearchPage extends StatelessWidget {
|
|||||||
// )
|
// )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class SubPerfPage extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("Select Sub Perfecture"),
|
title: const Text("Select Sub Perfecture"),
|
||||||
),
|
),
|
||||||
body: ListView.builder(
|
body: ListView.builder(
|
||||||
itemCount: indexController.subPerfs.length,
|
itemCount: indexController.subPerfs.length,
|
||||||
|
|||||||
31
lib/provider/auth_provider.dart
Normal file
31
lib/provider/auth_provider.dart
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:rogapp/model/auth_user.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
final authUserStateProvider =
|
||||||
|
StateNotifierProvider<AuthUserState, AuthUser>((ref) {
|
||||||
|
return AuthUserState();
|
||||||
|
});
|
||||||
|
|
||||||
|
class AuthUserState extends StateNotifier<AuthUser> {
|
||||||
|
AuthUserState() : super(AuthUser());
|
||||||
|
|
||||||
|
Future<void> saveToDevice(String val) async {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setString("user_token", val);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String?> tokenFromDevice() async {
|
||||||
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
return prefs.getString("user_token");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> addLogin(AuthUser user) async {
|
||||||
|
state = user;
|
||||||
|
await saveToDevice(user.auth_token!);
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeLogin() {
|
||||||
|
state = AuthUser();
|
||||||
|
}
|
||||||
|
}
|
||||||
22
lib/provider/game_state_provider.dart
Normal file
22
lib/provider/game_state_provider.dart
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:rogapp/model/game_state_instance.dart';
|
||||||
|
|
||||||
|
final gameStateNotifierProvider =
|
||||||
|
StateNotifierProvider<GameStaticState, GameInsStatetance>((ref) {
|
||||||
|
return GameStaticState();
|
||||||
|
});
|
||||||
|
|
||||||
|
class GameStaticState extends StateNotifier<GameInsStatetance> {
|
||||||
|
GameStaticState() : super(GameInsStatetance());
|
||||||
|
|
||||||
|
@override
|
||||||
|
GameInsStatetance get state => super.state;
|
||||||
|
|
||||||
|
void startGame(GameInsStatetance gi) {
|
||||||
|
state = gi;
|
||||||
|
}
|
||||||
|
|
||||||
|
void doCheckin() {}
|
||||||
|
|
||||||
|
void makeGoal() {}
|
||||||
|
}
|
||||||
18
lib/provider/map_state_provider.dart
Normal file
18
lib/provider/map_state_provider.dart
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:rogapp/model/map_state_instance.dart';
|
||||||
|
|
||||||
|
final mapStateNotifierProvider =
|
||||||
|
StateNotifierProvider<MapState, MapStateInstance>((ref) {
|
||||||
|
return MapState();
|
||||||
|
});
|
||||||
|
|
||||||
|
class MapState extends StateNotifier<MapStateInstance> {
|
||||||
|
MapState() : super(MapStateInstance());
|
||||||
|
|
||||||
|
@override
|
||||||
|
MapStateInstance get state => super.state;
|
||||||
|
|
||||||
|
void startGame(MapStateInstance mi) {
|
||||||
|
state = mi;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,12 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_navigation/src/routes/get_route.dart';
|
import 'package:get/get_navigation/src/routes/get_route.dart';
|
||||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
|
||||||
import 'package:rogapp/pages/category/category_page.dart';
|
import 'package:rogapp/pages/category/category_page.dart';
|
||||||
import 'package:rogapp/pages/changepassword/change_password_page.dart';
|
import 'package:rogapp/pages/changepassword/change_password_page.dart';
|
||||||
import 'package:rogapp/pages/city/city_page.dart';
|
import 'package:rogapp/pages/city/city_page.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
import 'package:rogapp/pages/gps/gps_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';
|
import 'package:rogapp/pages/home/home_page.dart';
|
||||||
|
|
||||||
import 'package:rogapp/pages/index/index_page.dart';
|
import 'package:rogapp/pages/index/index_page.dart';
|
||||||
@ -19,25 +20,14 @@ import 'package:rogapp/pages/register/register_page.dart';
|
|||||||
import 'package:rogapp/pages/search/search_binding.dart';
|
import 'package:rogapp/pages/search/search_binding.dart';
|
||||||
import 'package:rogapp/pages/search/search_page.dart';
|
import 'package:rogapp/pages/search/search_page.dart';
|
||||||
import 'package:rogapp/pages/subperf/subperf_page.dart';
|
import 'package:rogapp/pages/subperf/subperf_page.dart';
|
||||||
import 'package:rogapp/screens/auth/views/login/login_screen.dart';
|
|
||||||
import 'package:rogapp/screens/auth/views/register/register_screen.dart';
|
|
||||||
import 'package:rogapp/screens/home/home_screen.dart';
|
|
||||||
import 'package:rogapp/spa/spa_binding.dart';
|
import 'package:rogapp/spa/spa_binding.dart';
|
||||||
import 'package:rogapp/spa/spa_page.dart';
|
import 'package:rogapp/spa/spa_page.dart';
|
||||||
|
|
||||||
import '../screens/home/home_binding.dart';
|
|
||||||
|
|
||||||
|
|
||||||
part 'app_routes.dart';
|
part 'app_routes.dart';
|
||||||
|
|
||||||
class AppPages {
|
class AppPages {
|
||||||
|
|
||||||
static const S_HOME = Routes.S_HOME;
|
|
||||||
static const S_LOGIN = Routes.S_LOGIN;
|
|
||||||
static const S_REGISTER= Routes.S_REGISTER;
|
|
||||||
|
|
||||||
// ignore: constant_identifier_names
|
// ignore: constant_identifier_names
|
||||||
static const INITIAL = Routes.INDEX;
|
static const INDEX = Routes.INDEX;
|
||||||
// ignore: constant_identifier_names
|
// ignore: constant_identifier_names
|
||||||
static const SPA = Routes.SPA;
|
static const SPA = Routes.SPA;
|
||||||
static const LANDING = Routes.LANDING;
|
static const LANDING = Routes.LANDING;
|
||||||
@ -56,45 +46,18 @@ class AppPages {
|
|||||||
static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD;
|
static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD;
|
||||||
static const CAMERA_PAGE = Routes.CAMERA_PAGE;
|
static const CAMERA_PAGE = Routes.CAMERA_PAGE;
|
||||||
static const PROGRESS = Routes.PROGRESS;
|
static const PROGRESS = Routes.PROGRESS;
|
||||||
|
static const HISTORY = Routes.HISTORY;
|
||||||
|
static const GPS = Routes.GPS;
|
||||||
|
|
||||||
static final routes = [
|
static final routes = [
|
||||||
// GetPage(
|
|
||||||
// name: Routes.HOME,
|
|
||||||
// page: () => HomePage(),
|
|
||||||
// binding: HomeBinding(),
|
|
||||||
// ),
|
|
||||||
// GetPage(
|
|
||||||
// name: Routes.MAP,
|
|
||||||
// page: () => MapPage(),
|
|
||||||
// binding: MapBinding(),
|
|
||||||
// )
|
|
||||||
GetPage(
|
|
||||||
name: Routes.S_HOME,
|
|
||||||
page: () => HomeScreen(),
|
|
||||||
binding: HomeBinding()
|
|
||||||
),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.S_LOGIN,
|
|
||||||
page: () => LoginScreen(),
|
|
||||||
//binding: IndexBinding(),
|
|
||||||
),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.S_REGISTER,
|
|
||||||
page: () => RegisterScreen(),
|
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.INDEX,
|
name: Routes.INDEX,
|
||||||
page: () => IndexPage(),
|
page: () => IndexPage(),
|
||||||
//binding: IndexBinding(),
|
//binding: IndexBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
|
||||||
name: Routes.SPA,
|
|
||||||
page: () => const SpaPage(),
|
|
||||||
binding: SpaBinding(),
|
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.LANDING,
|
name: Routes.LANDING,
|
||||||
page: () => LandingPage(),
|
page: () => const LandingPage(),
|
||||||
//binding: SpaBinding(),
|
//binding: SpaBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
@ -107,62 +70,44 @@ class AppPages {
|
|||||||
page: () => RegisterPage(),
|
page: () => RegisterPage(),
|
||||||
//binding: SpaBinding(),
|
//binding: SpaBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
|
||||||
name: Routes.TRAVEL,
|
|
||||||
page: () => DestnationPage(),
|
|
||||||
binding: DestinationBinding(),
|
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.LOADING,
|
name: Routes.LOADING,
|
||||||
page: () => LoadingPage(),
|
page: () => const LoadingPage(),
|
||||||
//binding: DestinationBinding(),
|
|
||||||
),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.DESTINATION_MAP,
|
|
||||||
page: () => DestnationPage(),
|
|
||||||
//binding: DestinationBinding(),
|
//binding: DestinationBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.HOME,
|
name: Routes.HOME,
|
||||||
page: () => HomePage(),
|
page: () => const HomePage(),
|
||||||
binding: HomeBinding(),
|
binding: HomeBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.PERMISSION,
|
name: Routes.PERMISSION,
|
||||||
page: () => PermissionHandlerScreen(),
|
page: () => const PermissionHandlerScreen(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.SEARCH,
|
name: Routes.SEARCH,
|
||||||
page: () => SearchPage(),
|
page: () => SearchPage(),
|
||||||
binding: SearchBinding(),
|
binding: SearchBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
|
||||||
name: Routes.MAINPERF,
|
|
||||||
page: () => MainPerfPage(),
|
|
||||||
),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.SUBPERF,
|
|
||||||
page: () => SubPerfPage(),
|
|
||||||
),
|
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.CITY,
|
name: Routes.CITY,
|
||||||
page: () => CityPage(),
|
page: () => const CityPage(),
|
||||||
),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.CATEOGORY,
|
|
||||||
page: () => CategoryPage(),
|
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.CHANGE_PASSWORD,
|
name: Routes.CHANGE_PASSWORD,
|
||||||
page: () => ChangePasswordPage(),
|
page: () => ChangePasswordPage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.CAMERA_PAGE,
|
name: Routes.PROGRESS,
|
||||||
page: () => CameraPage(),
|
page: () => const ProgressPage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routes.PROGRESS,
|
name: Routes.HISTORY,
|
||||||
page: () => ProgressPage(),
|
page: () => const HistoryPage(),
|
||||||
|
),
|
||||||
|
GetPage(
|
||||||
|
name: Routes.GPS,
|
||||||
|
page: () => const GpsPage(),
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
part of 'app_pages.dart';
|
part of 'app_pages.dart';
|
||||||
|
|
||||||
abstract class Routes {
|
abstract class Routes {
|
||||||
static const S_HOME = '/s_home';
|
|
||||||
static const S_LOGIN = '/s_login';
|
|
||||||
static const S_REGISTER = '/s_register';
|
|
||||||
// Main Menu Route
|
// Main Menu Route
|
||||||
// static const HOME = '/';
|
// static const HOME = '/';
|
||||||
// static const MAP = '/map';
|
// static const MAP = '/map';
|
||||||
@ -27,4 +24,6 @@ abstract class Routes {
|
|||||||
static const CHANGE_PASSWORD = '/change_password';
|
static const CHANGE_PASSWORD = '/change_password';
|
||||||
static const CAMERA_PAGE = '/camera_page';
|
static const CAMERA_PAGE = '/camera_page';
|
||||||
static const PROGRESS = '/progress';
|
static const PROGRESS = '/progress';
|
||||||
|
static const HISTORY = '/history';
|
||||||
|
static const GPS = '/gp';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rogapp/theme/pallete.dart';
|
|
||||||
|
|
||||||
class AuthTextField extends StatelessWidget {
|
|
||||||
final TextEditingController controller;
|
|
||||||
final String hinttext;
|
|
||||||
final bool isObsque;
|
|
||||||
const AuthTextField({super.key, required this.controller, required this.hinttext, this.isObsque = false});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return TextFormField(
|
|
||||||
controller: controller,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
color: Pallete.BLUE_COLOR,
|
|
||||||
width: 2
|
|
||||||
)
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
color: Pallete.BROWN_COLOR,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.all(22),
|
|
||||||
hintText: hinttext,
|
|
||||||
hintStyle: const TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
|
|
||||||
import 'package:rogapp/theme/theme.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class RoundedSmallButton extends StatelessWidget {
|
|
||||||
final VoidCallback onTap;
|
|
||||||
final String label;
|
|
||||||
final Color backgroundColor;
|
|
||||||
final Color textColor;
|
|
||||||
|
|
||||||
const RoundedSmallButton({
|
|
||||||
super.key,
|
|
||||||
required this.onTap,
|
|
||||||
required this.label,
|
|
||||||
this.backgroundColor = Pallete.WHITE_COLOR,
|
|
||||||
this.textColor = Pallete.BACKGROUND_COLOR,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Chip(
|
|
||||||
label: Text(label, style: TextStyle(color: textColor, fontSize: 16),),
|
|
||||||
backgroundColor: backgroundColor,
|
|
||||||
labelPadding:const EdgeInsets.symmetric(horizontal: 10, vertical: 3),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
import 'dart:convert' as convert;
|
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:rogapp/model/user.dart';
|
|
||||||
import 'package:rogapp/utils/const.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
|
|
||||||
class AuthController extends GetxController{
|
|
||||||
var isLoading = false.obs;
|
|
||||||
var authList = List<AuthResponse>.empty(growable: true).obs;
|
|
||||||
|
|
||||||
void signinUser(String email, String password) async {
|
|
||||||
try{
|
|
||||||
isLoading(true);
|
|
||||||
String serverUrl = ConstValues.currentServer();
|
|
||||||
String url = '$serverUrl/api/login/';
|
|
||||||
final http.Response response = await http.post(
|
|
||||||
Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
body: convert.jsonEncode(<String, String>{
|
|
||||||
'email': email,
|
|
||||||
'password': password
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
print(response.body);
|
|
||||||
AuthResponse authResponse = AuthResponse.fromJson(convert.jsonDecode(convert.utf8.decode(response.body.codeUnits)));
|
|
||||||
print(authResponse.user.eventCode.toString());
|
|
||||||
authList.assign(authResponse);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
throw("Unable to Login, please check your creadentials");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(e){
|
|
||||||
Get.snackbar("Error", e.toString(), snackPosition: SnackPosition.BOTTOM);
|
|
||||||
}
|
|
||||||
finally{
|
|
||||||
isLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
class LoginController extends GetxController{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:rogapp/common/ui/widgets/uis.dart';
|
|
||||||
import 'package:rogapp/routes/app_pages.dart';
|
|
||||||
import 'package:rogapp/screens/auth/common/uis/auth_text_field.dart';
|
|
||||||
import 'package:rogapp/screens/auth/common/uis/rounded_small_button.dart';
|
|
||||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
|
||||||
import 'package:rogapp/theme/theme.dart';
|
|
||||||
|
|
||||||
class LoginScreen extends StatelessWidget {
|
|
||||||
final emailController = TextEditingController();
|
|
||||||
final passwordController = TextEditingController();
|
|
||||||
LoginScreen({super.key});
|
|
||||||
|
|
||||||
final AuthController authController = Get.find<AuthController>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: UIs.appBar(),
|
|
||||||
body: Obx((){
|
|
||||||
if(authController.isLoading.value) {
|
|
||||||
return const Center(child: CircularProgressIndicator(),);
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
height: MediaQuery.of(context).size.height/6,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 5,),
|
|
||||||
AuthTextField(controller: emailController, hinttext: 'Email',),
|
|
||||||
const SizedBox(height: 25,),
|
|
||||||
AuthTextField(controller: passwordController, hinttext: 'Password',),
|
|
||||||
const SizedBox(height: 40,),
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.topRight,
|
|
||||||
child: RoundedSmallButton(onTap: (){
|
|
||||||
authController.signinUser(emailController.text, passwordController.text);
|
|
||||||
},
|
|
||||||
label: 'Done',),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 40,),
|
|
||||||
RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
text: "Don't have an account?",
|
|
||||||
style: const TextStyle(fontSize: 16, color: Pallete.BROWN_COLOR),
|
|
||||||
children: [
|
|
||||||
TextSpan(
|
|
||||||
text: " Signup",
|
|
||||||
style: const TextStyle(color: Pallete.BLUE_COLOR, fontSize: 16),
|
|
||||||
recognizer: TapGestureRecognizer()..onTap = (){
|
|
||||||
Get.toNamed(AppPages.S_REGISTER);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class RegisterScreen extends StatelessWidget {
|
|
||||||
const RegisterScreen({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:rogapp/screens/home/home_controller.dart';
|
|
||||||
import 'package:rogapp/screens/home/location_controller.dart';
|
|
||||||
|
|
||||||
class HomeBinding extends Bindings{
|
|
||||||
@override
|
|
||||||
void dependencies() {
|
|
||||||
Get.put(HomeController());
|
|
||||||
Get.put(LocationController());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,124 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:latlong2/latlong.dart';
|
|
||||||
import 'package:rogapp/model/location_response.dart';
|
|
||||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
|
||||||
import 'package:rogapp/screens/home/location_controller.dart';
|
|
||||||
import 'package:rogapp/utils/const.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
import 'dart:convert' as convert;
|
|
||||||
|
|
||||||
import 'package:rogapp/utils/db_helper.dart';
|
|
||||||
|
|
||||||
class HomeController extends GetxController{
|
|
||||||
var isLoading = false.obs;
|
|
||||||
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
|
||||||
List<Feature> currentFeaturesforBound = <Feature>[].obs;
|
|
||||||
List<Feature> currentFeature = <Feature>[].obs;
|
|
||||||
MapController mapController = MapController();
|
|
||||||
|
|
||||||
late StreamSubscription<ConnectivityResult> _connectivitySubscription;
|
|
||||||
ConnectivityResult connectionStatus = ConnectivityResult.none;
|
|
||||||
var connectionStatusName = "".obs;
|
|
||||||
final Connectivity _connectivity = Connectivity();
|
|
||||||
|
|
||||||
AuthController authController = Get.find<AuthController>();
|
|
||||||
DatabaseHelper dbaseHelper = DatabaseHelper.instance;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
_connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
|
||||||
dbaseHelper.deleteAll().then((value){
|
|
||||||
fetchBoundForuser(authController.authList[0].token);
|
|
||||||
loadLocationsForBound().then((_){
|
|
||||||
fetchLocalLocationForBound(mapController.bounds!);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _updateConnectionStatus(ConnectivityResult result) async {
|
|
||||||
connectionStatus = result;
|
|
||||||
connectionStatusName.value = result.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void fetchLocalLocationForBound(LatLngBounds bound) async {
|
|
||||||
final locations = await dbaseHelper.getFeaturesWithinBounds(bound);
|
|
||||||
currentFeaturesforBound.assignAll(locations);
|
|
||||||
print("loading locations ${currentFeaturesforBound.length} ------");
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> loadLocationsForBound() async {
|
|
||||||
LatLngBounds bounds = mapController.bounds!;
|
|
||||||
String serverUrl = ConstValues.currentServer();
|
|
||||||
try{
|
|
||||||
isLoading(true);
|
|
||||||
if(bounds.southWest != null && bounds.northEast != null){
|
|
||||||
bool _rog = authController.authList[0].user.isRogaining;
|
|
||||||
String r = _rog == true ? 'True': 'False';
|
|
||||||
var grp = authController.authList[0].user.eventCode;
|
|
||||||
final url = '$serverUrl/api/inbound?rog=${r}&grp=$grp&ln1=${bounds.southWest!.longitude}&la1=${bounds.southWest!.latitude}&ln2=${bounds.northWest.longitude}&la2=${bounds.northWest.latitude}&ln3=${bounds.northEast!.longitude}&la3=${bounds.northEast!.latitude}&ln4=${bounds.southEast.longitude}&la4=${bounds.southEast.latitude}';
|
|
||||||
final response = await http.get(Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
// Parse JSON response
|
|
||||||
LocationResponse locationResponse = LocationResponse.fromMap(convert.jsonDecode(convert.utf8.decode(response.body.codeUnits)));
|
|
||||||
|
|
||||||
// For each feature in the location response
|
|
||||||
for (var feature in locationResponse.features!) {
|
|
||||||
await dbaseHelper.insertFeature(feature.toMap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
throw("Unable to load locations, please try again ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(e, st){
|
|
||||||
Get.snackbar("Error", e.toString(), snackPosition: SnackPosition.BOTTOM);
|
|
||||||
}
|
|
||||||
finally{
|
|
||||||
isLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void fetchBoundForuser(String usertoken) async {
|
|
||||||
try{
|
|
||||||
isLoading(true);
|
|
||||||
String serverUrl = ConstValues.currentServer();
|
|
||||||
String url = '$serverUrl/api/locsext/';
|
|
||||||
final http.Response response = await http.post(
|
|
||||||
Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
'Authorization': 'Token $usertoken'
|
|
||||||
},
|
|
||||||
body: convert.jsonEncode(<String, String>{
|
|
||||||
'token': usertoken,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
final ext = convert.json.decode(convert.utf8.decode(response.body.codeUnits));
|
|
||||||
LatLngBounds bnds = LatLngBounds(LatLng(ext[1], ext[0]), LatLng(ext[3], ext[2]));
|
|
||||||
currentBound.assign(bnds);
|
|
||||||
mapController.fitBounds(bnds);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
throw("Unable to query current bound, please try again ...");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(e){
|
|
||||||
Get.snackbar("Error", e.toString(), snackPosition: SnackPosition.BOTTOM);
|
|
||||||
}
|
|
||||||
finally{
|
|
||||||
isLoading(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,183 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
|
||||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:latlong2/latlong.dart';
|
|
||||||
import 'package:rogapp/common/ui/widgets/uis.dart';
|
|
||||||
import 'package:rogapp/model/location_response.dart';
|
|
||||||
import 'package:rogapp/screens/home/home_controller.dart';
|
|
||||||
import 'package:rogapp/screens/home/location_controller.dart';
|
|
||||||
import 'package:rogapp/theme/theme.dart';
|
|
||||||
import 'package:rogapp/utils/db_helper.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:sqflite/sqflite.dart';
|
|
||||||
|
|
||||||
class HomeScreen extends StatelessWidget {
|
|
||||||
HomeScreen({super.key});
|
|
||||||
StreamSubscription? subscription;
|
|
||||||
final HomeController homeController = Get.find<HomeController>();
|
|
||||||
final LocationController locationController = Get.find<LocationController>();
|
|
||||||
|
|
||||||
final double zoomThreshold = 0.08;
|
|
||||||
final double boundsThreshold = 0.0005;
|
|
||||||
|
|
||||||
LatLngBounds? lastBounds;
|
|
||||||
double? lastZoom;
|
|
||||||
|
|
||||||
|
|
||||||
Widget getMarkerShape(Feature i, BuildContext context){
|
|
||||||
|
|
||||||
//print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
|
||||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
homeController.currentFeature.assign(i);
|
|
||||||
if(homeController.currentFeature != null) {
|
|
||||||
showModalBottomSheet(
|
|
||||||
context: context,
|
|
||||||
isScrollControlled: true,
|
|
||||||
isDismissible: true,
|
|
||||||
builder:((context) => BottomSheetNew())
|
|
||||||
//builder:((context) => BottomSheetWidget())
|
|
||||||
).whenComplete((){
|
|
||||||
locationController.skip_gps = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
height: 32,
|
|
||||||
width: 32,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.transparent,
|
|
||||||
border: Border.all(
|
|
||||||
color: i.properties!.buy_point! > 0 ? Colors.blue : Colors.red,
|
|
||||||
width: 3,
|
|
||||||
style: BorderStyle.solid
|
|
||||||
)
|
|
||||||
),
|
|
||||||
child: Stack(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
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,)):
|
|
||||||
Container(color: Colors.transparent,),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextForFeature(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
actions: [
|
|
||||||
TextButton(onPressed: () async {
|
|
||||||
DatabaseHelper dbaseHelper = DatabaseHelper.instance;
|
|
||||||
final res = await dbaseHelper.getFeatureByLatLon(35.807369, 137.240684);
|
|
||||||
print(res[0].toString());
|
|
||||||
},
|
|
||||||
child: const Text("Click", style: TextStyle(color: Colors.white),))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
body: Obx(() =>
|
|
||||||
FlutterMap(
|
|
||||||
mapController: homeController.mapController,
|
|
||||||
options: MapOptions(
|
|
||||||
onMapReady: (){
|
|
||||||
homeController.mapController!.mapEventStream.listen((MapEvent mapEvent) {
|
|
||||||
if (mapEvent is MapEventMoveStart) {
|
|
||||||
}
|
|
||||||
if (mapEvent is MapEventMoveEnd) {
|
|
||||||
LatLngBounds bounds = homeController.mapController!.bounds!;
|
|
||||||
homeController.currentBound.assign(bounds);
|
|
||||||
final _cz = homeController.mapController.zoom;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} ,
|
|
||||||
onPositionChanged: (position, hasGesture){
|
|
||||||
if (hasGesture) {
|
|
||||||
LatLngBounds currentBounds = position.bounds!;
|
|
||||||
|
|
||||||
if (lastBounds != null && lastZoom != null) {
|
|
||||||
// Compute difference between last bounds and current bounds
|
|
||||||
double boundsDifference = lastBounds!.north - currentBounds.north +
|
|
||||||
lastBounds!.south - currentBounds.south +
|
|
||||||
lastBounds!.east - currentBounds.east +
|
|
||||||
lastBounds!.west - currentBounds.west;
|
|
||||||
|
|
||||||
// Compute difference between last zoom and current zoom
|
|
||||||
double zoomDifference = lastZoom! - position.zoom!;
|
|
||||||
|
|
||||||
if (boundsDifference.abs() > boundsThreshold || zoomDifference.abs() > zoomThreshold) {
|
|
||||||
LatLngBounds bounds = homeController.mapController!.bounds!;
|
|
||||||
homeController.currentBound.assign(bounds);
|
|
||||||
print('----threshold reached ---');
|
|
||||||
homeController.fetchLocalLocationForBound(bounds);
|
|
||||||
//loadData(position.bounds); // Load new data when either threshold is exceeded
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LatLngBounds bounds = homeController.mapController!.bounds!;
|
|
||||||
homeController.currentBound.assign(bounds);
|
|
||||||
homeController.fetchLocalLocationForBound(bounds);
|
|
||||||
//loadData(position.bounds); // Load new data if this is the first time
|
|
||||||
}
|
|
||||||
|
|
||||||
lastBounds = currentBounds; // Update the last bounds
|
|
||||||
lastZoom = position.zoom; // Update the last zoom
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bounds: homeController.currentBound.isNotEmpty ? homeController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
|
||||||
zoom: 14,
|
|
||||||
maxZoom:18.4,
|
|
||||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
const BaseLayer(),
|
|
||||||
CurrentLocationLayer(),
|
|
||||||
homeController.currentFeaturesforBound.isNotEmpty ?
|
|
||||||
MarkerLayer(
|
|
||||||
markers:homeController.currentFeaturesforBound.map((i) {
|
|
||||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
||||||
return Marker(
|
|
||||||
anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
|
|
||||||
height: 32.0,
|
|
||||||
width: 120.0,
|
|
||||||
point: LatLng(i.latitude!, i.longitude!),
|
|
||||||
builder: (ctx){
|
|
||||||
return getMarkerShape(i, context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
)
|
|
||||||
:
|
|
||||||
Center(child: CircularProgressIndicator()),
|
|
||||||
],
|
|
||||||
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,318 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:geolocator/geolocator.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:latlong2/latlong.dart';
|
|
||||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
|
||||||
import 'package:rogapp/model/location_response.dart';
|
|
||||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
|
||||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
|
||||||
import 'package:rogapp/screens/home/home_controller.dart';
|
|
||||||
import 'package:rogapp/utils/checkin_db_helper.dart';
|
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
|
||||||
|
|
||||||
class LocationController extends GetxController{
|
|
||||||
|
|
||||||
HomeController homeController = Get.find<HomeController>();
|
|
||||||
AuthController authController = Get.find<AuthController>();
|
|
||||||
CheckinDBHelper checkinDBHelper = CheckinDBHelper.instance;
|
|
||||||
|
|
||||||
|
|
||||||
late LocationSettings locationSettings;
|
|
||||||
List<String> locationPermission = <String>[" -- starting -- "].obs;
|
|
||||||
double current_lat = 0.0;
|
|
||||||
double current_lon = 0.0;
|
|
||||||
var is_gps_selected = true.obs;
|
|
||||||
var is_checkingIn = false.obs;
|
|
||||||
var moveMapwithGPS = false.obs;
|
|
||||||
bool skip_gps = false;
|
|
||||||
var is_photo_shoot = false.obs;
|
|
||||||
final photos = <File>[].obs;
|
|
||||||
Timer? _timer;
|
|
||||||
int _start = 0;
|
|
||||||
int chekcs = 0;
|
|
||||||
var rogaining_counted = false.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;
|
|
||||||
DateTime last_goal_at = DateTime.now().subtract(Duration(days:1));
|
|
||||||
bool skip_10s = false;
|
|
||||||
|
|
||||||
bool checking_in = false;
|
|
||||||
BuildContext? context;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
initGPS();
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkPermission() async {
|
|
||||||
LocationPermission permission = await Geolocator.checkPermission();
|
|
||||||
if (permission != LocationPermission.whileInUse ||
|
|
||||||
permission != LocationPermission.always) {
|
|
||||||
locationPermission.clear();
|
|
||||||
locationPermission.add(permission.name);
|
|
||||||
permission = await Geolocator.requestPermission();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void initGPS(){
|
|
||||||
checkPermission();
|
|
||||||
|
|
||||||
//print("------ in iniit");
|
|
||||||
|
|
||||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
|
||||||
locationSettings = AndroidSettings(
|
|
||||||
accuracy: LocationAccuracy.bestForNavigation,
|
|
||||||
distanceFilter: 0,
|
|
||||||
forceLocationManager: true,
|
|
||||||
intervalDuration: const Duration(seconds: 1),
|
|
||||||
foregroundNotificationConfig: const ForegroundNotificationConfig(
|
|
||||||
notificationText:
|
|
||||||
"Thi 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) {
|
|
||||||
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
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
locationSettings = const LocationSettings(
|
|
||||||
accuracy: LocationAccuracy.high,
|
|
||||||
distanceFilter: 0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
|
||||||
|
|
||||||
(Position? position) {
|
|
||||||
current_lat = position != null ? position.latitude : 0;
|
|
||||||
current_lon = position != null ? position.longitude : 0;
|
|
||||||
|
|
||||||
print('current GPS point is - $current_lat, $current_lon');
|
|
||||||
|
|
||||||
if(is_gps_selected.value){
|
|
||||||
double czoom = homeController.mapController.zoom;
|
|
||||||
if(moveMapwithGPS.value){
|
|
||||||
homeController.mapController.move(LatLng(position!.latitude, position!.longitude), czoom);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//gps.clear();
|
|
||||||
//gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --");
|
|
||||||
if(is_checkingIn.value ==false || skip_gps == false){
|
|
||||||
print("--- calling checkFoCheckin ---");
|
|
||||||
checkFoCheckin();
|
|
||||||
}
|
|
||||||
//checkForCheckin(position!.latitude, position.longitude);
|
|
||||||
|
|
||||||
}
|
|
||||||
//print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
|
||||||
});
|
|
||||||
} catch (err){
|
|
||||||
locationPermission.clear();
|
|
||||||
locationPermission.add(err.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
//ever(indexController.connectionStatusName, connectionChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkFoCheckin(){
|
|
||||||
|
|
||||||
for(final f in homeController.currentFeaturesforBound){
|
|
||||||
|
|
||||||
if(skip_gps) return;
|
|
||||||
|
|
||||||
var distance = Distance();
|
|
||||||
var dist = distance.as(LengthUnit.Meter, LatLng(f.latitude!, f.longitude!), LatLng(current_lat, current_lon));
|
|
||||||
|
|
||||||
if(dist <= 250 && is_checkingIn.value == false){
|
|
||||||
startTimer(f, dist);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void startTimer(Feature d, double distance) async {
|
|
||||||
skip_gps = true;
|
|
||||||
print("---- in startTimer ----");
|
|
||||||
double checkin_radious = d.properties!.checkin_radius ?? double.infinity;
|
|
||||||
bool auto_checkin = d.properties!.auto_checkin == 0 ? false : true;
|
|
||||||
bool location_already_checked_in = await checkinDBHelper.exists(d.location_id!);
|
|
||||||
bool isUser_logged_in = authController.authList.length > 0 ? true : false;
|
|
||||||
//make current destination
|
|
||||||
print("---- locationid : ${d.location_id} checkin radius ---- ${checkin_radious} --- distance : ${distance} ----");
|
|
||||||
print("---- distance ${distance} ----");
|
|
||||||
if(checkin_radious >= distance){
|
|
||||||
//currentSelectedDestinations.add(d);
|
|
||||||
homeController.currentFeature.assign(d);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
skip_gps = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<Feature> ds = homeController.currentFeature;
|
|
||||||
if(ds.isNotEmpty){
|
|
||||||
if(d.properties!.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)
|
|
||||||
{
|
|
||||||
print("----- in location popup checkin cp - ${d.properties!.cp}----");
|
|
||||||
chekcs = 2;
|
|
||||||
is_in_checkin.value = true;
|
|
||||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
|
||||||
builder:((context) => BottomSheetNew())
|
|
||||||
).whenComplete((){
|
|
||||||
skip_gps = false;
|
|
||||||
chekcs =0;
|
|
||||||
is_in_checkin.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print("---- location checkin radious ${d.properties!.checkin_radius} ----");
|
|
||||||
print("---- already checked in ${location_already_checked_in} ----");
|
|
||||||
if(checkin_radious >= distance && location_already_checked_in == false){
|
|
||||||
if(auto_checkin){
|
|
||||||
if(!checking_in){
|
|
||||||
makeCheckin(d, true,"");
|
|
||||||
if(d.properties!.cp != -1){
|
|
||||||
rogaining_counted.value =true;
|
|
||||||
}
|
|
||||||
skip_gps = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
print("--- hidden loc ${d.properties!.hidden_location} ----");
|
|
||||||
// ask for checkin
|
|
||||||
if(d.properties!.hidden_location != null && d.properties!.hidden_location == 0 && d.properties!.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 if(is_in_rog.value == true && d.properties!.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;
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(isUser_logged_in && d.properties!.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 && 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 makeCheckin(Feature destination, bool action, String imageurl) async {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void addToRogaining(double lat, double lon, int destination_id) async {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void destinationMatrixFromCurrentPoint(List<Feature> ls){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
55
lib/services/DatabaseService.dart
Normal file
55
lib/services/DatabaseService.dart
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:rogapp/model/destination.dart';
|
||||||
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
|
|
||||||
|
class DatabaseService {
|
||||||
|
// Private constructor
|
||||||
|
DatabaseService._privateConstructor();
|
||||||
|
|
||||||
|
// Static instance
|
||||||
|
static final DatabaseService _instance =
|
||||||
|
DatabaseService._privateConstructor();
|
||||||
|
|
||||||
|
// Factory constructor to return the instance
|
||||||
|
factory DatabaseService() {
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// StreamController for updates
|
||||||
|
final StreamController<List<Destination>> _dbUpdateController =
|
||||||
|
StreamController<List<Destination>>.broadcast();
|
||||||
|
|
||||||
|
// Getter for the stream
|
||||||
|
Stream<List<Destination>> get destinationUpdatesStream =>
|
||||||
|
_dbUpdateController.stream;
|
||||||
|
|
||||||
|
// Method to fetch destinations
|
||||||
|
Future<List<Destination>> fetchDestinations() async {
|
||||||
|
// Your database fetch logic here
|
||||||
|
List<Destination> destinations = await _fetchFromDb();
|
||||||
|
_dbUpdateController.add(destinations);
|
||||||
|
return destinations;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method to update the database and emit an update through the stream
|
||||||
|
Future<void> updateDatabase() async {
|
||||||
|
// Your update logic here
|
||||||
|
|
||||||
|
// After updating, fetch the updated list and add it to the stream
|
||||||
|
fetchDestinations();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method to fetch data from the database (placeholder)
|
||||||
|
Future<List<Destination>> _fetchFromDb() async {
|
||||||
|
// Simulate fetching data with a delay
|
||||||
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
List<Destination> destinations = await db.getDestinations();
|
||||||
|
return destinations; // Replace with your actual fetch operation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dispose method to close the stream controller
|
||||||
|
void dispose() {
|
||||||
|
_dbUpdateController.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,22 +2,21 @@ import 'dart:convert';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/utils/const.dart';
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
class ActionService {
|
||||||
class ActionService{
|
static Future<Map<String, dynamic>> makeAction(int userId, int locationId,
|
||||||
|
bool wanttogo, bool like, bool checkin) async {
|
||||||
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
|
//print("----- action is ---- $like-- $wanttogo-- $checkin");
|
||||||
print("----- action is ---- ${like}-- ${wanttogo}-- ${checkin}");
|
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
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}";
|
//String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||||
print('@@@@@@+++ action_service MAKEACTION - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final http.Response response = await http.get(
|
//print("url is ------ $url");
|
||||||
Uri.parse(url),
|
final http.Response response =
|
||||||
headers: <String, String>{
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
@ -25,27 +24,23 @@ class ActionService{
|
|||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> userAction(int userId, int locationId) async {
|
||||||
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
|
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
String url =
|
||||||
print('@@@@@@+++ action_service USERACTION - GET, @@@@@@ ${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}';
|
//String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,74 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/model/auth_user.dart';
|
||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
|
class AuthService {
|
||||||
|
Future<AuthUser?> userLogin(String email, String password) async {
|
||||||
|
final serverUrl = ConstValues.currentServer();
|
||||||
|
final url = '$serverUrl/api/login/';
|
||||||
|
|
||||||
class AuthService{
|
try {
|
||||||
|
final http.Response response = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body:
|
||||||
|
jsonEncode(<String, String>{'email': email, 'password': password}),
|
||||||
|
);
|
||||||
|
switch (response.statusCode) {
|
||||||
|
case 200:
|
||||||
|
final data = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
AuthUser user = AuthUser.fromMap(data["user"]);
|
||||||
|
final String token = data["token"];
|
||||||
|
user.auth_token = token;
|
||||||
|
return user;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
//throw Exception(response.reasonPhrase);
|
||||||
|
}
|
||||||
|
} on Exception catch (_) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async {
|
Future<AuthUser?> userFromToken(String token) async {
|
||||||
|
final serverUrl = ConstValues.currentServer();
|
||||||
|
final url = '$serverUrl/api/user/';
|
||||||
|
try {
|
||||||
|
final http.Response response =
|
||||||
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': 'Token $token'
|
||||||
|
});
|
||||||
|
switch (response.statusCode) {
|
||||||
|
case 200:
|
||||||
|
final data = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
AuthUser user = AuthUser.fromMap(data);
|
||||||
|
user.auth_token = token;
|
||||||
|
return user;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
//throw Exception(response.reasonPhrase);
|
||||||
|
}
|
||||||
|
} on Exception catch (_) {
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> changePassword(
|
||||||
|
String oldpassword, String newpassword, String token) async {
|
||||||
Map<String, dynamic> changePassword = {};
|
Map<String, dynamic> changePassword = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/change-password/';
|
String url = '$serverUrl/api/change-password/';
|
||||||
print('@@@@@@+++ auth_service CHANGE PASSWORD - PUT with old_password : ${oldpassword} new_password : ${newpassword}, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final http.Response response = await http.put(
|
final http.Response response = await http.put(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': 'Token ${token}'
|
'Authorization': 'Token $token'
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{
|
||||||
'old_password': oldpassword,
|
'old_password': oldpassword,
|
||||||
@ -24,28 +77,25 @@ class AuthService{
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
changePassword = json.decode(utf8.decode(response.bodyBytes));
|
changePassword = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return changePassword;
|
return changePassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> login(
|
||||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
String email, String password) async {
|
||||||
//print("------- in logged email ${email} pwd ${password} ###### --------");
|
//print("------- in logged email $email pwd $password ###### --------");
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/login/';
|
String url = '$serverUrl/api/login/';
|
||||||
print('@@@@@@+++ auth_service LOGIN - POST with email : ${email} password : ${password}, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
//String url = 'http://localhost:8100/api/login/';
|
//String url = 'http://localhost:8100/api/login/';
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{'email': email, 'password': password}),
|
||||||
'email': email,
|
|
||||||
'password': password
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
@ -54,41 +104,36 @@ class AuthService{
|
|||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> register(
|
||||||
static Future<Map<String, dynamic>> register(String email, String password) async {
|
String email, String password) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/register/';
|
String url = '$serverUrl/api/register/';
|
||||||
print('@@@@@@+++ auth_service REGISTER - POST with email : ${email} password : ${password}, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{'email': email, 'password': password}),
|
||||||
'email': email,
|
|
||||||
'password': password
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
//print(response.body);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> deleteUser(String token) async {
|
static Future<Map<String, dynamic>> deleteUser(String token) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/delete-account/';
|
String url = '$serverUrl/api/delete-account/';
|
||||||
print('@@@@@@+++ auth_service DELETE USER - GET with Authorization : Token ${token}, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final http.Response response = await http.get(
|
final http.Response response =
|
||||||
Uri.parse(url),
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
headers: <String, String>{
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Authorization': 'Token $token'
|
||||||
'Authorization': 'Token ${token}'
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
@ -96,29 +141,45 @@ class AuthService{
|
|||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> userDetails(int userid) async {
|
||||||
static Future<List<dynamic>?> UserDetails(int userid) async {
|
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/userdetials?user_id=${userid}';
|
String url = '$serverUrl/api/userdetials?user_id=$userid';
|
||||||
print('@@@@@@+++ auth_service USER DETAILS - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
//print("---- UserDetails url is $url");
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> userForToken(String token) async {
|
||||||
|
Map<String, dynamic> cats = {};
|
||||||
|
String serverUrl = ConstValues.currentServer();
|
||||||
|
String url = '$serverUrl/api/user/';
|
||||||
|
//print('++++++++$url');
|
||||||
|
//print("---- UserDetails url is $url");
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization': 'Token $token'
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
//print("--- eeeeee $cats ----");
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{"user": cats, "token": token}
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,53 +1,44 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
|
class CatService {
|
||||||
class CatService{
|
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2,
|
||||||
|
double lon2, double lat3, double lon3, double lat4, double lon4) async {
|
||||||
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
|
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
String url =
|
||||||
print('@@@@@@+++ cat_service LOADCATS - GET, @@@@@@ ${url}');
|
'$serverUrl/api/cats/?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||||
final response = await http.get(Uri.parse(url),
|
//print('++++++++$url');
|
||||||
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<List<dynamic>?> loadCatByCity(String cityname) async {
|
||||||
static Future<List<dynamic>?> loadCatByCity(String cityname)async {
|
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/catbycity/?${cityname}';
|
String url = '$serverUrl/api/catbycity/?$cityname';
|
||||||
print('@@@@@@+++ cat_service CHANGE PASSWORD - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,20 +8,16 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
|||||||
|
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
|
class DestinationService {
|
||||||
class DestinationService{
|
static Future<List<dynamic>> getDestinations(int userId) async {
|
||||||
|
|
||||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
|
||||||
List<dynamic> cats = [];
|
List<dynamic> cats = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/destinations/?user_id=${user_id}";
|
String url = "$serverUrl/api/destinations/?user_id=$userId";
|
||||||
print('@@@@@@+++ destination_service GETDESTINATIONS - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final http.Response response = await http.get(
|
final http.Response response =
|
||||||
Uri.parse(url),
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
headers: <String, String>{
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
@ -29,36 +25,33 @@ class DestinationService{
|
|||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
static Future<Map<String, dynamic>> deleteDestination(int destId) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
|
String url = "$serverUrl/api/delete_destination/?dest_id=$destId";
|
||||||
print('@@@@@@+++ destination_service DELETEDESTINATION - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final http.Response response = await http.get(
|
final http.Response response =
|
||||||
Uri.parse(url),
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
headers: <String, String>{
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
print("####### ---- ${cats}");
|
//print("####### ---- $cats");
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
static Future<int> updateOrder(int actionId, int order, String dir) async {
|
||||||
int cats = 0;
|
int cats = 0;
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
String url =
|
||||||
print('@@@@@@+++ destination_service UPDATEORDER - GET, @@@@@@ ${url}');
|
"$serverUrl/api/updateorder/?user_action_id=$actionId&order=$order&dir=$dir";
|
||||||
final http.Response response = await http.get(
|
//print('++++++++$url');
|
||||||
Uri.parse(url),
|
final http.Response response =
|
||||||
headers: <String, String>{
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
@ -66,23 +59,25 @@ class DestinationService{
|
|||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations, Map<String, dynamic> mtx) async{
|
static Future<List<PointLatLng>>? getDestinationLine(
|
||||||
|
List<Destination> destinations, Map<String, dynamic> mtx) async {
|
||||||
PolylinePoints polylinePoints = PolylinePoints();
|
PolylinePoints polylinePoints = PolylinePoints();
|
||||||
|
|
||||||
if(destinations.length <= 0){
|
if (destinations.isEmpty) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
//print("##### @@@@@ ${destinations[0].lat}");
|
//print("##### @@@@@ ${destinations[0].lat}");
|
||||||
PointLatLng origin = PointLatLng(destinations[0].lat!, destinations[0].lon!);
|
PointLatLng origin =
|
||||||
PointLatLng dest = PointLatLng(destinations[destinations.length -1].lat!, destinations[destinations.length -1].lon!);
|
PointLatLng(destinations[0].lat!, destinations[0].lon!);
|
||||||
|
PointLatLng dest = PointLatLng(destinations[destinations.length - 1].lat!,
|
||||||
|
destinations[destinations.length - 1].lon!);
|
||||||
|
|
||||||
List<PolylineWayPoint> wayPoints = [];
|
List<PolylineWayPoint> wayPoints = [];
|
||||||
int i=0;
|
int i = 0;
|
||||||
for(dynamic d in destinations){
|
for (dynamic d in destinations) {
|
||||||
if(i == 0 || i == (destinations.length -1)){
|
if (i == 0 || i == (destinations.length - 1)) {
|
||||||
i+=1;
|
i += 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double la = d.lat;
|
double la = d.lat;
|
||||||
@ -90,39 +85,36 @@ class DestinationService{
|
|||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: false);
|
PolylineWayPoint pwp =
|
||||||
|
PolylineWayPoint(location: "$la,$ln", stopOver: false);
|
||||||
|
|
||||||
//print("----- UUUUUU ${pwp}");
|
//print("----- UUUUUU ${pwp}");
|
||||||
//PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
|
//PointLatLng wp = PointLatLng(d["Location"]["geometry"][0][1], d["Location"]["geometry"][0][0]);
|
||||||
wayPoints.add(pwp);
|
wayPoints.add(pwp);
|
||||||
i+=1;
|
i += 1;
|
||||||
j += 4;
|
j += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController =
|
||||||
int trav_mode = destinationController.travelMode.value;
|
Get.find<DestinationController>();
|
||||||
String _mode = "WALKING";
|
// int travMode = destinationController.travelMode.value;
|
||||||
if(trav_mode == 1){
|
// String mode = "WALKING";
|
||||||
//_mode = TravelMode.driving;
|
// if (travMode == 1) {
|
||||||
_mode = "DRIVING";
|
// //_mode = TravelMode.driving;
|
||||||
}
|
// mode = "DRIVING";
|
||||||
else if(trav_mode == 2) {
|
// } else if (travMode == 2) {
|
||||||
//_mode = TravelMode.transit;
|
// //_mode = TravelMode.transit;
|
||||||
_mode = "TRANSIT";
|
// mode = "TRANSIT";
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
|
//PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", PointLatLng(35.389282, 136.498027), PointLatLng(36.285848, 137.575186));
|
||||||
Map<String, dynamic> pl = destinationController.matrix["routes"][0]["overview_polyline"];
|
Map<String, dynamic> pl =
|
||||||
|
destinationController.matrix["routes"][0]["overview_polyline"];
|
||||||
List<PointLatLng> result = polylinePoints.decodePolyline(pl["points"]);
|
List<PointLatLng> result = polylinePoints.decodePolyline(pl["points"]);
|
||||||
//List<PointLatLng> result = polylinePoints.decodePolyline("qkyvEq`z`Yp@DBMr@XL@Td@Eb@PREd@IFe@rKIzCY|GEvCBzCHvS@xC?HnBHtBHlBFnBFhGRtDVW~BE`@ICHLk@dE_ClPgAtHu@bFsAhPg@~Ge@bFaEtg@kEpi@oCd\\w@nIw@hGe@fBy@nBqAjC{@zBgBtFOd@M@Wv@i@`BQf@ITKCuE`@yDZqBRCHa@DKG_AHwBRiBR_Fp@y@LYBY]M@KJo@v@M@cAGoGN_Cx@}Cf@}@@mM~@qF`@gCLwBj@sBrAeAhAsAtCoF|MmAbD{@fBwAdBw@p@_Ax@BFOHAl@?`@MAQCEAOIQSaBx@{Ah@eATsAHSB?d@A`D?f@IdWy@AS??V?|BCJ}@?cA?k@Au@wBqDuKQaACg@z@gELg@GK~@uEp@{A@q@y@CHwFHcG?KDqCDK^ABABEH{AE{B{@_Ho@uFIaBFQhBaC@SQSg@k@g@q@Yw@qA{De@}B]uDCsAMEWDqAFu@@^A@TDjA@vDA`CETK|AEtAIFY@o@ALpBZ~HBlCBn@EDGPu@pASJO`@Qf@?ROr@K?qDLHnEUTsDNkENYB{Ab@I^?zA}CrCkBfBw@t@@LwA`Bo@r@eGvD}BrAGGuAj@[?i@rBVi@P}@T?F?^MxDuBhDsBzAcAn@s@zCgDAI~A{A|CsC?{A?UHItA_@DCXC~J_@TUIoEvDKTm@?Y^iALIb@k@f@aAE}AA_BC{@\\Cv@CxAEj@ExCwDDc@CYFANCh@WHEIIRQhB}B|C_E\\w@Hq@JE?a@O}CGkAIwEGmDEmDAKLA^?A}@C{@?e@E_DFQNi@LcB\\eBPsADGKOEWBOH[GCPs@Pq@\\cANs@^q@jAu@fCqAf@]HCXoCV_BVmAZmBVcDBeCCgDAaB?s@RE?aCCaEAyHAoDd@EJiD@_@AaAj@A\\A?Gp@@r@oBXm@LQ?IEy@Fy@tA[n@Gj@Tz@[~ACdAAx@Lp@Kr@]hAa@HAQoCMwCSwGSiGK_CCCKaBCgCOoCOgECwGB_OB{JHkBEmC?yCDyFF{QFue@BsYByE?oAEgAByLBiL?gLBuGXsEd@cCNA?OHa@jAuCn@eAtCyDh@k@v@EvBKr@EEkACUKaC?G~@gAlCeDFBT[jFeGZAfBEh@UpBM`AEMaFjFYIhE?hEPpCJzAPt@Fj@GNUFu@N[FyBbAuB`@_@LEIOB}@HUBQFk@FcAACGQA}@Bi@F@F[Dc@D[FQHELGhBMtDGR?D");
|
//List<PointLatLng> result = polylinePoints.decodePolyline("qkyvEq`z`Yp@DBMr@XL@Td@Eb@PREd@IFe@rKIzCY|GEvCBzCHvS@xC?HnBHtBHlBFnBFhGRtDVW~BE`@ICHLk@dE_ClPgAtHu@bFsAhPg@~Ge@bFaEtg@kEpi@oCd\\w@nIw@hGe@fBy@nBqAjC{@zBgBtFOd@M@Wv@i@`BQf@ITKCuE`@yDZqBRCHa@DKG_AHwBRiBR_Fp@y@LYBY]M@KJo@v@M@cAGoGN_Cx@}Cf@}@@mM~@qF`@gCLwBj@sBrAeAhAsAtCoF|MmAbD{@fBwAdBw@p@_Ax@BFOHAl@?`@MAQCEAOIQSaBx@{Ah@eATsAHSB?d@A`D?f@IdWy@AS??V?|BCJ}@?cA?k@Au@wBqDuKQaACg@z@gELg@GK~@uEp@{A@q@y@CHwFHcG?KDqCDK^ABABEH{AE{B{@_Ho@uFIaBFQhBaC@SQSg@k@g@q@Yw@qA{De@}B]uDCsAMEWDqAFu@@^A@TDjA@vDA`CETK|AEtAIFY@o@ALpBZ~HBlCBn@EDGPu@pASJO`@Qf@?ROr@K?qDLHnEUTsDNkENYB{Ab@I^?zA}CrCkBfBw@t@@LwA`Bo@r@eGvD}BrAGGuAj@[?i@rBVi@P}@T?F?^MxDuBhDsBzAcAn@s@zCgDAI~A{A|CsC?{A?UHItA_@DCXC~J_@TUIoEvDKTm@?Y^iALIb@k@f@aAE}AA_BC{@\\Cv@CxAEj@ExCwDDc@CYFANCh@WHEIIRQhB}B|C_E\\w@Hq@JE?a@O}CGkAIwEGmDEmDAKLA^?A}@C{@?e@E_DFQNi@LcB\\eBPsADGKOEWBOH[GCPs@Pq@\\cANs@^q@jAu@fCqAf@]HCXoCV_BVmAZmBVcDBeCCgDAaB?s@RE?aCCaEAyHAoDd@EJiD@_@AaAj@A\\A?Gp@@r@oBXm@LQ?IEy@Fy@tA[n@Gj@Tz@[~ACdAAx@Lp@Kr@]hAa@HAQoCMwCSwGSiGK_CCCKaBCgCOoCOgECwGB_OB{JHkBEmC?yCDyFF{QFue@BsYByE?oAEgAByLBiL?gLBuGXsEd@cCNA?OHa@jAuCn@eAtCyDh@k@v@EvBKr@EEkACUKaC?G~@gAlCeDFBT[jFeGZAfBEh@UpBM`AEMaFjFYIhE?hEPpCJzAPt@Fj@GNUFu@N[FyBbAuB`@_@LEIOB}@HUBQFk@FcAACGQA}@Bi@F@F[Dc@D[FQHELGhBMtDGR?D");
|
||||||
//PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: _mode, wayPoints: wayPoints);
|
//PolylineResult result = await polylinePoints.getRouteBetweenCoordinates("AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE", origin,dest, travelMode: _mode, wayPoints: wayPoints);
|
||||||
|
|
||||||
//print("#####@@@@@ ${result.points}");
|
//print("#####@@@@@ ${result.points}");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,286 +2,429 @@ import 'dart:io';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:rogapp/model/destination.dart';
|
|
||||||
import 'package:rogapp/model/rog.dart';
|
import 'package:rogapp/model/rog.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
import 'package:rogapp/utils/database_gps.dart';
|
||||||
import 'package:rogapp/screens/home/home_controller.dart';
|
|
||||||
import 'package:rogapp/utils/database_helper.dart';
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
import 'package:sqflite/sqlite_api.dart';
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../model/gps_data.dart';
|
||||||
import '../utils/const.dart';
|
import '../utils/const.dart';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rog type 0- start 1- checkin 2- goal
|
// Rog type 0- start 1- checkin 2- goal
|
||||||
//
|
//
|
||||||
|
|
||||||
class ExternalService {
|
class ExternalService {
|
||||||
static final ExternalService _instance = ExternalService._internal();
|
static final ExternalService _instance = ExternalService._internal();
|
||||||
|
|
||||||
factory ExternalService(){
|
factory ExternalService() {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExternalService._internal();
|
ExternalService._internal();
|
||||||
|
|
||||||
String getFormatedTime(DateTime datetime){
|
String getFormatedTime(DateTime datetime) {
|
||||||
return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime);
|
return DateFormat('yyyy-MM-dd HH:mm:ss').format(datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> StartRogaining() async {
|
Future<Map<String, dynamic>> startRogaining() async {
|
||||||
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
//final IndexController indexController = Get.find<IndexController>();
|
Map<String, dynamic> res = {};
|
||||||
final homeController = Get.find<HomeController>();
|
|
||||||
final authController = Get.find<AuthController>();
|
|
||||||
|
|
||||||
Map<String, dynamic> _res = {};
|
int userId = indexController.currentUser[0]["user"]["id"];
|
||||||
|
|
||||||
int user_id = authController.authList[0].user.id;
|
|
||||||
//print("--- Pressed -----");
|
//print("--- Pressed -----");
|
||||||
String _team = authController.authList[0].user.teamName;
|
String team = indexController.currentUser[0]["user"]['team_name'];
|
||||||
//print("--- _team : ${_team}-----");
|
//print("--- _team : ${_team}-----");
|
||||||
String _event_code = authController.authList[0].user.eventCode;
|
String eventCode = indexController.currentUser[0]["user"]["event_code"];
|
||||||
|
|
||||||
if(homeController.connectionStatusName != "wifi" && homeController.connectionStatusName != "mobile"){
|
if (indexController.connectionStatusName.value != "wifi" &&
|
||||||
|
indexController.connectionStatusName.value != "mobile") {
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
Rog _rog = Rog(
|
Rog rog = Rog(
|
||||||
id:1,
|
id: 1,
|
||||||
team_name: _team,
|
team_name: team,
|
||||||
event_code : _event_code,
|
event_code: eventCode,
|
||||||
user_id: user_id,
|
user_id: userId,
|
||||||
cp_number: -1,
|
cp_number: -1,
|
||||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||||
image: null,
|
image: null,
|
||||||
rog_action_type: 0
|
rog_action_type: 0);
|
||||||
);
|
db.insertRogaining(rog);
|
||||||
db.insertRogaining(_rog);
|
} else {
|
||||||
}
|
String url = 'https://rogaining.sumasen.net/gifuroge/start_from_rogapp';
|
||||||
else {
|
//print('++++++++$url');
|
||||||
String url = 'https://natnats.mobilous.com/start_from_rogapp';
|
|
||||||
print('@@@@@@+++ external_service STARTROGAINING - POST with team_name : ${_team} event_code : ${_event_code}, @@@@@@ ${url}');
|
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(
|
||||||
'team_name': _team,
|
<String, String>{'team_name': team, 'event_code': eventCode}),
|
||||||
'event_code': _event_code
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
print("---- start rogianing api status ---- ${response.statusCode}");
|
//print("---- start rogianing api status ---- ${response.statusCode}");
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
res = json.decode(utf8.decode(response.bodyBytes));
|
||||||
print('----_res : ${_res} ----');
|
//print('----_res : $res ----');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async {
|
Future<Map<String, dynamic>> makeCheckpoint(
|
||||||
Map<String, dynamic> _res = {};
|
int userId,
|
||||||
String url = 'https://natnats.mobilous.com/checkin_from_rogapp';
|
String token,
|
||||||
|
String checkinTime,
|
||||||
|
String teamname,
|
||||||
|
int cp,
|
||||||
|
String eventcode,
|
||||||
|
String imageurl) async {
|
||||||
|
// print("~~~~ in API call function ~~~~");
|
||||||
|
// print("~~~~ cp is $cp ~~~~");
|
||||||
|
//print("--cpcp-- ${cp}");
|
||||||
|
Map<String, dynamic> res = {};
|
||||||
|
String url = 'https://rogaining.sumasen.net/gifuroge/checkin_from_rogapp';
|
||||||
|
//print('++++++++$url');
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
if(imageurl != null){
|
if (imageurl != null) {
|
||||||
|
if (indexController.connectionStatusName.value != "wifi" &&
|
||||||
if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
|
indexController.connectionStatusName.value != "mobile") {
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
Rog _rog = Rog(
|
Rog rog = Rog(
|
||||||
id:1,
|
id: 1,
|
||||||
team_name: teamname,
|
team_name: teamname,
|
||||||
event_code : eventcode,
|
event_code: eventcode,
|
||||||
user_id: user_id,
|
user_id: userId,
|
||||||
cp_number: cp,
|
cp_number: cp,
|
||||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||||
image: imageurl,
|
image: imageurl,
|
||||||
rog_action_type: 1,
|
rog_action_type: 1,
|
||||||
);
|
);
|
||||||
db.insertRogaining(_rog);
|
db.insertRogaining(rog);
|
||||||
}
|
} else {
|
||||||
else {
|
String serverUrl = ConstValues.currentServer();
|
||||||
String server_url = ConstValues.currentServer();
|
String url1 = "$serverUrl/api/checkinimage/";
|
||||||
String url1 = "${server_url}/api/checkinimage/";
|
final im1Bytes = File(imageurl).readAsBytesSync();
|
||||||
final im1Bytes = File(imageurl!).readAsBytesSync();
|
|
||||||
String im1_64 = base64Encode(im1Bytes);
|
String im1_64 = base64Encode(im1Bytes);
|
||||||
print('@@@@@@+++ external_service MAKECHECKPOINT - POST with user : ${user_id.toString()} team_name : ${teamname} event_code : ${eventcode} checkinimage : ${im1_64} checkintime : ${checkin_time} cp_number : ${cp.toString()}, @@@@@@ ${url1}');
|
|
||||||
|
//print("~~~~ before calling api 1 ~~~~");
|
||||||
|
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url1),
|
Uri.parse(url1),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': 'Token ${token}'
|
'Authorization': 'Token $token'
|
||||||
},
|
},
|
||||||
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{
|
||||||
'user' : user_id.toString(),
|
'user': userId.toString(),
|
||||||
'team_name': teamname,
|
'team_name': teamname,
|
||||||
'event_code': eventcode,
|
'event_code': eventcode,
|
||||||
'checkinimage' : im1_64,
|
'checkinimage': im1_64,
|
||||||
'checkintime' : checkin_time,
|
'checkintime': checkinTime,
|
||||||
'cp_number' : cp.toString()
|
'cp_number': cp.toString()
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
res = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
//print("~~~~ api1 result $res ~~~~");
|
||||||
|
//print("-----@@@@@ checkin $_res -----");
|
||||||
|
|
||||||
print("-----@@@@@ ${_res} -----");
|
if (response.statusCode == 201) {
|
||||||
|
//print("~~~~ image from api1 ${res["checkinimage"].toString()} ~~~~");
|
||||||
if(response.statusCode == 201){
|
//print('---- toekn is ${token} -----');
|
||||||
//print('---- toekn is ${token} -----');
|
//print("~~~~ token is $token ~~~~");
|
||||||
String imgUrl = _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net');
|
//print("~~~~ before callling api2 ~~~~");
|
||||||
print('@@@@@@+++ external_service MAKECHECKPOINT - POST with team_name : ${teamname} event_code : ${eventcode} checkinimage : ${imgUrl} cp_number : ${cp.toString()}, @@@@@@ ${url}');
|
|
||||||
final http.Response response2 = await http.post(
|
|
||||||
Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
body: jsonEncode(<String, String>{
|
|
||||||
'team_name': teamname,
|
|
||||||
'cp_number': cp.toString(),
|
|
||||||
'event_code': eventcode,
|
|
||||||
'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} ----');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){
|
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
|
||||||
Rog _rog = Rog(
|
|
||||||
id:1,
|
|
||||||
team_name: teamname,
|
|
||||||
event_code : eventcode,
|
|
||||||
user_id: user_id,
|
|
||||||
cp_number: cp,
|
|
||||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
|
||||||
image: null,
|
|
||||||
rog_action_type: 1,
|
|
||||||
);
|
|
||||||
db.insertRogaining(_rog);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print('@@@@@@+++ external_service MAKECHECKPOINT - POST with team_name : ${teamname} event_code : ${eventcode} cp_number : ${cp.toString()} image : "", @@@@@@ ${url}');
|
|
||||||
final http.Response response3 = await http.post(
|
|
||||||
Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
body: jsonEncode(<String, String>{
|
|
||||||
'team_name': teamname,
|
|
||||||
'cp_number': cp.toString(),
|
|
||||||
'event_code': eventcode,
|
|
||||||
'image': ""
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
print("--- checnin response ${response3.statusCode}----");
|
|
||||||
if (response3.statusCode == 200) {
|
|
||||||
_res = json.decode(utf8.decode(response3.bodyBytes));
|
|
||||||
print('----checkin res _res : ${_res} ----');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Future<Map<String, dynamic>> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async {
|
|
||||||
Map<String, dynamic> _res2 = {};
|
|
||||||
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
|
||||||
|
|
||||||
//if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
|
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
|
||||||
Rog _rog = Rog(
|
|
||||||
id:1,
|
|
||||||
team_name: teamname,
|
|
||||||
event_code : eventcode,
|
|
||||||
user_id: user_id,
|
|
||||||
cp_number: -1,
|
|
||||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
|
||||||
image: image,
|
|
||||||
rog_action_type: 1,
|
|
||||||
);
|
|
||||||
db.insertRogaining(_rog);
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
String server_url = ConstValues.currentServer();
|
|
||||||
String url1 = "${server_url}/api/goalimage/";
|
|
||||||
final im1Bytes = File(image!).readAsBytesSync();
|
|
||||||
String im1_64 = base64Encode(im1Bytes);
|
|
||||||
print('@@@@@@+++ external_service MAKEGOAL - POST with user : ${user_id.toString()} team_name : ${teamname} event_code : ${eventcode} goaltime : ${goal_time} cp_number : -1 goalimage : ${im1_64}, @@@@@@ ${url1}');
|
|
||||||
final http.Response response = await http.post(
|
|
||||||
Uri.parse(url1),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
'Authorization': 'Token ${token}'
|
|
||||||
},
|
|
||||||
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
|
||||||
body: jsonEncode(<String, String>{
|
|
||||||
'user' : user_id.toString(),
|
|
||||||
'team_name': teamname,
|
|
||||||
'event_code': eventcode,
|
|
||||||
'goaltime' : goal_time,
|
|
||||||
'goalimage' : im1_64,
|
|
||||||
'cp_number' : "-1"
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
String url = 'https://natnats.mobilous.com/goal_from_rogapp';
|
|
||||||
if (response.statusCode == 201) {
|
|
||||||
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
|
|
||||||
String imgUrl = _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net');
|
|
||||||
print('@@@@@@+++ external_service MAKEGOAL - POST with team_name : ${teamname} event_code : ${eventcode} goal_time : ${goal_time} goalimage : ${imgUrl}, @@@@@@ ${url}');
|
|
||||||
final http.Response response2 = await http.post(
|
final http.Response response2 = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{
|
||||||
'team_name': teamname,
|
'team_name': teamname,
|
||||||
'event_code': eventcode,
|
'cp_number': cp.toString(),
|
||||||
'goal_time' : goal_time,
|
'event_code': eventcode,
|
||||||
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
'image': res["checkinimage"].toString().replaceAll(
|
||||||
}
|
'http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
),
|
}),
|
||||||
);
|
);
|
||||||
print('----- response2 is ${response2} --------');
|
var vv = jsonEncode(<String, String>{
|
||||||
if (response2.statusCode == 200) {
|
'team_name': teamname,
|
||||||
_res2 = json.decode(utf8.decode(response2.bodyBytes));
|
'cp_number': cp.toString(),
|
||||||
|
'event_code': eventcode,
|
||||||
|
'image': res["checkinimage"].toString().replaceAll(
|
||||||
|
'http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
|
});
|
||||||
|
//print("~~~~ api 2 values $vv ~~~~");
|
||||||
|
//print("--json-- $vv");
|
||||||
|
//print("--- checnin response ${response2.statusCode}----");
|
||||||
|
if (response2.statusCode == 200) {
|
||||||
|
res = json.decode(utf8.decode(response2.bodyBytes));
|
||||||
|
//print('----checkin res _res : $res ----');
|
||||||
|
if (res["status"] == "ERROR") {
|
||||||
|
Get.snackbar("エラーがおきました", res["detail"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Get.snackbar("エラーがおきました", "サーバーに更新できませんでした");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
} else {
|
||||||
destinationController.resetRogaining();
|
if (indexController.connectionStatusName.value != "wifi" ||
|
||||||
return _res2;
|
indexController.connectionStatusName.value != "mobile") {
|
||||||
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
Rog rog = Rog(
|
||||||
|
id: 1,
|
||||||
|
team_name: teamname,
|
||||||
|
event_code: eventcode,
|
||||||
|
user_id: userId,
|
||||||
|
cp_number: cp,
|
||||||
|
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||||
|
image: null,
|
||||||
|
rog_action_type: 1,
|
||||||
|
);
|
||||||
|
db.insertRogaining(rog);
|
||||||
|
} else {
|
||||||
|
final http.Response response3 = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'team_name': teamname,
|
||||||
|
'cp_number': cp.toString(),
|
||||||
|
'event_code': eventcode,
|
||||||
|
'image': ""
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
// var vvv = jsonEncode(<String, String>{
|
||||||
|
// 'team_name': teamname,
|
||||||
|
// 'cp_number': cp.toString(),
|
||||||
|
// 'event_code': eventcode,
|
||||||
|
// 'image': res["checkinimage"].toString().replaceAll(
|
||||||
|
// 'http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
|
// });
|
||||||
|
// print("--json-- $vvv");
|
||||||
|
// print("--- checnin response ${response3.statusCode}----");
|
||||||
|
if (response3.statusCode == 200) {
|
||||||
|
res = json.decode(utf8.decode(response3.bodyBytes));
|
||||||
|
//print('----checkin res _res : $res ----');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//print("~~~~ done checkin ~~~~");
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Map<String, dynamic>> makeGoal(int userId, String token,
|
||||||
|
String teamname, String image, String goalTime, String eventcode) async {
|
||||||
|
Map<String, dynamic> res2 = {};
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> usersEventCode(String teamcode, String password) async {
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
Map<String, dynamic> _res = {};
|
final DestinationController destinationController =
|
||||||
String url = "https://natnats.mobilous.com/check_event_code?zekken_number=${teamcode}&password=${password}";
|
Get.find<DestinationController>();
|
||||||
print('@@@@@@+++ external_service USEREVENTCODE - GET, @@@@@@ ${url}');
|
|
||||||
final http.Response response = await http.get(
|
//if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
|
||||||
Uri.parse(url),
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
Rog rog = Rog(
|
||||||
|
id: 1,
|
||||||
|
team_name: teamname,
|
||||||
|
event_code: eventcode,
|
||||||
|
user_id: userId,
|
||||||
|
cp_number: -1,
|
||||||
|
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||||
|
image: image,
|
||||||
|
rog_action_type: 1,
|
||||||
|
);
|
||||||
|
db.insertRogaining(rog);
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
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: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
'Authorization': 'Token $token'
|
||||||
|
},
|
||||||
|
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'user': userId.toString(),
|
||||||
|
'team_name': teamname,
|
||||||
|
'event_code': eventcode,
|
||||||
|
'goaltime': goalTime,
|
||||||
|
'goalimage': im1_64,
|
||||||
|
'cp_number': "-1"
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
String url = 'https://rogaining.sumasen.net/gifuroge/goal_from_rogapp';
|
||||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
//print('++++++++$url');
|
||||||
|
if (response.statusCode == 201) {
|
||||||
|
Map<String, dynamic> 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: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'team_name': teamname,
|
||||||
|
'event_code': eventcode,
|
||||||
|
'goal_time': goalTime,
|
||||||
|
'image': res["goalimage"].toString().replaceAll(
|
||||||
|
'http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
String rec = jsonEncode(<String, String>{
|
||||||
|
'team_name': teamname,
|
||||||
|
'event_code': eventcode,
|
||||||
|
'goal_time': goalTime,
|
||||||
|
'image': res["goalimage"]
|
||||||
|
.toString()
|
||||||
|
.replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||||
|
});
|
||||||
|
//print("-- json -- $rec");
|
||||||
|
//print('----- response2 is $response2 --------');
|
||||||
|
if (response2.statusCode == 200) {
|
||||||
|
res2 = json.decode(utf8.decode(response2.bodyBytes));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return _res;
|
//}
|
||||||
}
|
destinationController.resetRogaining(isgoal: true);
|
||||||
|
return res2;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
Future<bool> removeCheckin(int cp) async {
|
||||||
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
|
//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"];
|
||||||
|
|
||||||
|
if (indexController.connectionStatusName.value != "wifi" &&
|
||||||
|
indexController.connectionStatusName.value != "mobile") {
|
||||||
|
return Future.value(false);
|
||||||
|
} else {
|
||||||
|
String url =
|
||||||
|
'https://rogaining.sumasen.net/gifuroge/remove_checkin_from_rogapp';
|
||||||
|
//print('++++++++$url');
|
||||||
|
final http.Response response = await http.post(
|
||||||
|
Uri.parse(url),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
},
|
||||||
|
body: jsonEncode(<String, String>{
|
||||||
|
'event_code': eventCode,
|
||||||
|
'team_name': team,
|
||||||
|
'cp_number': cp.toString()
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
//print("---- remove checkin ---- ${response.statusCode}");
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return Future.value(true);
|
||||||
|
//print('----_res : $res ----');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Future.value(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
String timestampToTimeString(int timestamp) {
|
||||||
|
// Convert timestamp to DateTime and format it as needed
|
||||||
|
var dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp);
|
||||||
|
//print("^^^^ time ${dateTime}");
|
||||||
|
// Format dateTime to a time string (e.g., '12:00:00')
|
||||||
|
// Adjust the format as needed
|
||||||
|
return "${dateTime.hour}:${dateTime.minute}:${dateTime.second}";
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> pushGPS() async {
|
||||||
|
//print("^^^^ pushed ^^^");
|
||||||
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
|
|
||||||
|
//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"];
|
||||||
|
|
||||||
|
List<GpsData> gpsDataList = [];
|
||||||
|
|
||||||
|
if (indexController.connectionStatusName.value != "wifi" &&
|
||||||
|
indexController.connectionStatusName.value != "mobile") {
|
||||||
|
return Future.value(false);
|
||||||
|
} else {
|
||||||
|
// Step 1: Fetch data from the local database
|
||||||
|
gpsDataList =
|
||||||
|
await GpsDatabaseHelper.instance.getUnsyncedGPSData(team, eventCode);
|
||||||
|
|
||||||
|
// Step 2: Transform data into the required format
|
||||||
|
var payload = {
|
||||||
|
'team_name': team,
|
||||||
|
'event_code': eventCode,
|
||||||
|
'waypoints': gpsDataList.map((gpsData) {
|
||||||
|
return {
|
||||||
|
'latitude': gpsData.lat.toString(),
|
||||||
|
'longitude': gpsData.lon.toString(),
|
||||||
|
// Convert the timestamp to a formatted time string
|
||||||
|
'time': timestampToTimeString(gpsData.created_at),
|
||||||
|
};
|
||||||
|
}).toList(),
|
||||||
|
};
|
||||||
|
|
||||||
|
//print("calling push gps step 2 ${payload}");
|
||||||
|
|
||||||
|
String urlS =
|
||||||
|
'https://rogaining.sumasen.net/gifuroge/get_waypoint_datas_from_rogapp';
|
||||||
|
//print('++++++++$url');
|
||||||
|
var url = Uri.parse(urlS); // Replace with your server URL
|
||||||
|
var response = await http.post(
|
||||||
|
url,
|
||||||
|
headers: {"Content-Type": "application/json"},
|
||||||
|
body: json.encode(payload),
|
||||||
|
);
|
||||||
|
|
||||||
|
//print("GPS Data res ${response.statusCode}");
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
// Handle success
|
||||||
|
// make local data as synced
|
||||||
|
await GpsDatabaseHelper.instance.setSyncData(gpsDataList);
|
||||||
|
//print("GPS Data sent successfully");
|
||||||
|
} else {
|
||||||
|
// Handle error
|
||||||
|
//print("Failed to send data");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Future.value(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<Map<String, dynamic>> usersEventCode(
|
||||||
|
String teamcode, String password) async {
|
||||||
|
Map<String, dynamic> res = {};
|
||||||
|
String url =
|
||||||
|
"https://rogaining.sumasen.net/gifuroge/check_event_code?zekken_number=$teamcode&password=$password";
|
||||||
|
//print('++++++++$url');
|
||||||
|
final http.Response response =
|
||||||
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
res = json.decode(utf8.decode(response.bodyBytes));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,35 +1,32 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
// import 'package:geojson/geojson.dart';
|
||||||
import 'package:http/http.dart' as http;
|
// import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../utils/const.dart';
|
// import '../utils/const.dart';
|
||||||
|
|
||||||
class LocationLineService{
|
// class LocationLineService {
|
||||||
|
// static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||||
|
// final geo = GeoJson();
|
||||||
|
// GeoJsonFeature? fs;
|
||||||
|
// String serverUrl = ConstValues.currentServer();
|
||||||
|
// String url = '$serverUrl/api/location_line/';
|
||||||
|
// //print('++++++++$url');
|
||||||
|
// final response = await http.get(
|
||||||
|
// Uri.parse(url),
|
||||||
|
// headers: <String, String>{
|
||||||
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
|
||||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
// if (response.statusCode == 200) {
|
||||||
final geo = GeoJson();
|
// geo.processedFeatures.listen((fst) {
|
||||||
GeoJsonFeature? fs;
|
// fs = fst;
|
||||||
String server_url = ConstValues.currentServer();
|
// });
|
||||||
String url = '${server_url}/api/location_line/';
|
|
||||||
print('++++++++${url}');
|
|
||||||
final response = await http.get(Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// await geo.parse(response.body, verbose: true);
|
||||||
|
|
||||||
geo.processedFeatures.listen((fst) {
|
// return fs;
|
||||||
fs = fst;
|
// } else {
|
||||||
});
|
// throw Exception('Failed to create album.');
|
||||||
|
// }
|
||||||
await geo.parse(response.body, verbose:true);
|
// }
|
||||||
|
// }
|
||||||
return fs;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw Exception('Failed to create album.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,36 +1,33 @@
|
|||||||
import 'package:geojson/geojson.dart';
|
// import 'package:geojson/geojson.dart';
|
||||||
import 'package:http/http.dart' as http;
|
// import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import '../utils/const.dart';
|
// import '../utils/const.dart';
|
||||||
|
|
||||||
class LocationPolygonervice{
|
// class LocationPolygonervice {
|
||||||
|
// static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||||
|
// final geo = GeoJson();
|
||||||
|
// GeoJsonFeature? fs;
|
||||||
|
|
||||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
// String serverUrl = ConstValues.currentServer();
|
||||||
final geo = GeoJson();
|
// String url = '$serverUrl/api/location_polygon/';
|
||||||
GeoJsonFeature? fs;
|
// //print('++++++++$url');
|
||||||
|
// final response = await http.get(
|
||||||
|
// Uri.parse(url),
|
||||||
|
// headers: <String, String>{
|
||||||
|
// 'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
|
||||||
String server_url = ConstValues.currentServer();
|
// if (response.statusCode == 200) {
|
||||||
String url = '${server_url}/api/location_polygon/';
|
// geo.processedFeatures.listen((fst) {
|
||||||
print('++++++++${url}');
|
// fs = fst;
|
||||||
final response = await http.get(Uri.parse(url),
|
// });
|
||||||
headers: <String, String>{
|
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
// await geo.parse(response.body, verbose: true);
|
||||||
|
|
||||||
geo.processedFeatures.listen((fst) {
|
// return fs;
|
||||||
fs = fst;
|
// } else {
|
||||||
});
|
// throw Exception('Failed to create album.');
|
||||||
|
// }
|
||||||
await geo.parse(response.body, verbose:true);
|
// }
|
||||||
|
// }
|
||||||
return fs;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throw Exception('Failed to create album.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,75 +1,48 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'package:geojson_vi/geojson_vi.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/utils/const.dart';
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
class LocationService{
|
class LocationService {
|
||||||
|
static Future<GeoJSONFeatureCollection?> loadLocationsFor(
|
||||||
// static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
String perfecture, String cat) async {
|
||||||
|
|
||||||
// final IndexController indexController = Get.find<IndexController>();
|
|
||||||
|
|
||||||
// String server_url = ConstValues.currentServer();
|
|
||||||
// String url = "";
|
|
||||||
// if(indexController.currentUser.length > 0){
|
|
||||||
// url = '${server_url}/api/location/?is_rog=True';
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// url = '${server_url}/api/location/';
|
|
||||||
// }
|
|
||||||
// //String url = 'http://localhost:8100/api/location/';
|
|
||||||
// final response = await http.get(Uri.parse(url),
|
|
||||||
// headers: <String, String>{
|
|
||||||
// 'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
|
|
||||||
// return featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
String url = "";
|
String url = "";
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
|
|
||||||
if(cat.isNotEmpty){
|
if (cat.isNotEmpty) {
|
||||||
if(indexController.currentUser.isNotEmpty){
|
if (indexController.currentUser.isNotEmpty) {
|
||||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||||
String r = _rog == true ? 'True': 'False';
|
String r = rog == true ? 'True' : 'False';
|
||||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
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 = '$serverUrl/api/inperf/?perf=$perfecture&cat=$cat';
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
if (indexController.currentUser.isNotEmpty) {
|
||||||
|
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||||
|
String r = rog == true ? 'True' : 'False';
|
||||||
|
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||||
|
url = '$serverUrl/api/inperf/?rog=$r&perf=$perfecture';
|
||||||
|
} else {
|
||||||
|
url = '$serverUrl/api/inperf/?perf=$perfecture';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
//print('++++++++$url');
|
||||||
if(indexController.currentUser.isNotEmpty){
|
final response = await http.get(
|
||||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
Uri.parse(url),
|
||||||
String r = _rog == true ? 'True': 'False';
|
|
||||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
|
||||||
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print('@@@@@@+++ location_service LOADLOCATIONFOR - GET, @@@@@@ ${url}');
|
|
||||||
final response = await http.get(Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
GeoJSONFeatureCollection cc =
|
||||||
|
GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
//print(cc);
|
//print(cc);
|
||||||
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
@ -78,176 +51,138 @@ class LocationService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> getLocationsExt(String token) async {
|
static Future<List<dynamic>?> getLocationsExt(String token) async {
|
||||||
List<dynamic> ext = [];
|
List<dynamic> ext = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/locsext/';
|
String url = '$serverUrl/api/locsext/';
|
||||||
print('@@@@@@+++ location_service GETLOCATIONEXT - POST, with token : ${token} @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.post(Uri.parse(url),
|
final response = await http.post(Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
'Authorization': 'Token ${token}'
|
'Authorization': 'Token $token'
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{
|
||||||
'token': token,
|
'token': token,
|
||||||
})
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
ext = json.decode(utf8.decode(response.bodyBytes));
|
ext = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<GeoJSONFeatureCollection?> loadLocationsBound(
|
||||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
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<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
String url = "";
|
String url = "";
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
if(cat.isNotEmpty){
|
if (cat.isNotEmpty) {
|
||||||
if(indexController.currentUser.isNotEmpty){
|
if (indexController.currentUser.isNotEmpty) {
|
||||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||||
String r = _rog == true ? 'True': 'False';
|
String r = rog == true ? 'True' : 'False';
|
||||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||||
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture + '&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 =
|
||||||
|
'$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4&cat=$cat';
|
||||||
}
|
}
|
||||||
else{
|
} else {
|
||||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
if (indexController.currentUser.isNotEmpty) {
|
||||||
}
|
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||||
}
|
String r = rog == true ? 'True' : 'False';
|
||||||
else{
|
|
||||||
if(indexController.currentUser.isNotEmpty){
|
|
||||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
|
||||||
String r = _rog == true ? 'True': 'False';
|
|
||||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||||
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture;
|
//print("-------- requested user group $grp -------------");
|
||||||
}
|
url =
|
||||||
else{
|
'$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
} else {
|
||||||
|
url =
|
||||||
|
'$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print('@@@@@@+++ location_service LOADLOCATIONSUBFOR - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
headers: <String, String>{
|
Uri.parse(url),
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
|
||||||
//print(cc);
|
|
||||||
return cc; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static Future<GeoJsonFeatureCollection?> 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<IndexController>();
|
|
||||||
String url = "";
|
|
||||||
String server_url = ConstValues.currentServer();
|
|
||||||
if(cat.isNotEmpty){
|
|
||||||
if(indexController.currentUser.isNotEmpty){
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
url = '${server_url}/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';
|
|
||||||
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}';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print('@@@@@@+++ location_service LOADLOCATIONSBOUNDS - GET, @@@@@@ ${url}');
|
|
||||||
final response = await http.get(Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 500) {
|
if (response.statusCode == 500) {
|
||||||
return GeoJsonFeatureCollection(); //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
return null; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
DestinationController destinationController =
|
||||||
if(cc.collection.isEmpty){
|
Get.find<DestinationController>();
|
||||||
|
GeoJSONFeatureCollection cc =
|
||||||
|
GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
|
if (cc.features.isEmpty) {
|
||||||
return null;
|
return null;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
//print("---- feature got from server is ${cc.collection[0].properties} ------");
|
//print("---- feature got from server is ${cc.collection[0].properties} ------");
|
||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<GeoJSONFeatureCollection?> loadCustomLocations(
|
||||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String name, String cat) async {
|
String name, String cat) async {
|
||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
String url = "";
|
String url = "";
|
||||||
if(cat == "-all-"){
|
if (cat == "-all-") {
|
||||||
cat = "";
|
cat = "";
|
||||||
}
|
}
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
print("loadCustomLocations url is ----- ${cat}");
|
//print("loadCustomLocations url is ----- $cat");
|
||||||
if(cat.isNotEmpty){
|
if (cat.isNotEmpty) {
|
||||||
if(indexController.currentUser.isNotEmpty){
|
if (indexController.currentUser.isNotEmpty) {
|
||||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||||
String r = _rog == true ? 'True': 'False';
|
String r = rog == true ? 'True' : 'False';
|
||||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
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 = '$serverUrl/api/custom_area/?&cat=$cat';
|
||||||
}
|
}
|
||||||
else{
|
} else {
|
||||||
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
if (indexController.currentUser.isNotEmpty) {
|
||||||
|
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||||
|
String r = rog == true ? 'True' : 'False';
|
||||||
|
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||||
|
url = '$serverUrl/api/customarea?rog=$r&name=$name';
|
||||||
|
} else {
|
||||||
|
url = '$serverUrl/api/customarea?name=$name';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
//print('++++++++$url');
|
||||||
if(indexController.currentUser.isNotEmpty){
|
final response = await http.get(
|
||||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
Uri.parse(url),
|
||||||
String r = _rog == true ? 'True': 'False';
|
|
||||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
|
||||||
url = '${server_url}/api/customarea?rog=${r}&name=${name}';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
url = '${server_url}/api/customarea?name=${name}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print('@@@@@@+++ location_service LOADCUSTOMLOCATIONS - GET, @@@@@@ ${url}');
|
|
||||||
final response = await http.get(Uri.parse(url),
|
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 500) {
|
if (response.statusCode == 500) {
|
||||||
return GeoJsonFeatureCollection(); //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
return null; //featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
GeoJsonFeatureCollection cc = await featuresFromGeoJson(utf8.decode(response.bodyBytes));
|
GeoJSONFeatureCollection cc =
|
||||||
if(cc.collection.isEmpty){
|
GeoJSONFeatureCollection.fromJSON(utf8.decode(response.bodyBytes));
|
||||||
|
if (cc.features.isEmpty) {
|
||||||
return null;
|
return null;
|
||||||
}
|
} else {
|
||||||
else{
|
return cc;
|
||||||
return cc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,73 +1,66 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
|
|
||||||
|
class MatrixService {
|
||||||
class MatrixService{
|
static Future<Map<String, dynamic>> getDestinations(
|
||||||
|
List<Destination> destinations) async {
|
||||||
static Future<Map<String, dynamic>> getDestinations(List<Destination> destinations) async {
|
final DestinationController destinationController =
|
||||||
|
Get.find<DestinationController>();
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
|
||||||
|
|
||||||
String locs = "";
|
String locs = "";
|
||||||
String origin = "";
|
String origin = "";
|
||||||
String destination = "";
|
String destination = "";
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Destination d in destinations){
|
for (Destination d in destinations) {
|
||||||
|
//print("---- getting matrix for $d ------------");
|
||||||
|
|
||||||
print("---- getting matrix for ${d} ------------");
|
if (i == 0) {
|
||||||
|
|
||||||
if(i==0){
|
|
||||||
origin = "${d.lat}, ${d.lon}";
|
origin = "${d.lat}, ${d.lon}";
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == (destinations.length - 1)){
|
if (i == (destinations.length - 1)) {
|
||||||
destination = "${d.lat}, ${d.lon}";
|
destination = "${d.lat}, ${d.lon}";
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
print("lat is ${d.lat}, long is ${d.lon}");
|
//print("lat is ${d.lat}, long is ${d.lon}");
|
||||||
locs += "${d.lat}, ${d.lon}|";
|
locs += "${d.lat}, ${d.lon}|";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
locs = "optimize:false|${locs}";
|
locs = "optimize:false|$locs";
|
||||||
|
|
||||||
String _mode = "walking";
|
String mode = "walking";
|
||||||
switch (destinationController.travelMode.value) {
|
switch (destinationController.travelMode.value) {
|
||||||
case 1:
|
case 1:
|
||||||
_mode = "driving";
|
mode = "driving";
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
_mode = "transit";
|
mode = "transit";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mode = "walking";
|
mode = "walking";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
String url =
|
||||||
print('@@@@@@+++ matrix_service GETDESTINATIONS - GET, @@@@@@ ${url}');
|
"https://maps.googleapis.com/maps/api/directions/json?destination=$destination&mode=$mode&waypoints=$locs&origin=$origin&key=AIzaSyCN2xFsqFyadWwpjiFxymrxzS6G1tNzraI";
|
||||||
final http.Response response = await http.get(
|
//print('++++++++$url');
|
||||||
Uri.parse(url),
|
final http.Response response =
|
||||||
headers: <String, String>{
|
await http.get(Uri.parse(url), headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,22 +2,20 @@ import 'dart:convert';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/utils/const.dart';
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
class PerfectureService {
|
||||||
class PerfectureService{
|
|
||||||
|
|
||||||
static Future<List<dynamic>?> loadPerfectures() async {
|
static Future<List<dynamic>?> loadPerfectures() async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/perf_main/';
|
String url = '$serverUrl/api/perf_main/';
|
||||||
print('@@@@@@+++ perfeture_service LOADPERFECTURES - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
perfs = json.decode(utf8.decode(response.bodyBytes));
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return perfs;
|
return perfs;
|
||||||
@ -25,36 +23,35 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/subperfinmain/?area=' + area;
|
String url = '$serverUrl/api/subperfinmain/?area=$area';
|
||||||
print('@@@@@@+++ perfeture_service LOADSUBPERFECTURES - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
perfs = json.decode(utf8.decode(response.bodyBytes));
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return perfs;
|
return perfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/mainperfext/?perf=' + id;
|
String url = '$serverUrl/api/mainperfext/?perf=$id';
|
||||||
print('@@@@@@+++ perfeture_service GETMAINPERFEXT - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
perfs = json.decode(utf8.decode(response.bodyBytes));
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return perfs;
|
return perfs;
|
||||||
@ -62,17 +59,17 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
|
String url = '$serverUrl/api/allgifuareas/?perf=$perf';
|
||||||
print('@@@@@@+++ perfeture_service LOADGIFUAREAS - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
perfs = json.decode(utf8.decode(response.bodyBytes));
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return perfs;
|
return perfs;
|
||||||
@ -80,42 +77,37 @@ class PerfectureService{
|
|||||||
|
|
||||||
static Future<List<dynamic>?> loadCustomAreas() async {
|
static Future<List<dynamic>?> loadCustomAreas() async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/customareanames';
|
String url = '$serverUrl/api/customareanames';
|
||||||
print('@@@@@@+++ perfeture_service LOADCUSTOMAREAS - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
perfs = json.decode(utf8.decode(response.bodyBytes));
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return perfs;
|
return perfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Future<List<dynamic>?> getSubExt(String id) async {
|
static Future<List<dynamic>?> getSubExt(String id) async {
|
||||||
List<dynamic> perfs = [];
|
List<dynamic> perfs = [];
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/perfext/?sub_perf=' + id;
|
String url = '$serverUrl/api/perfext/?sub_perf=$id';
|
||||||
print('@@@@@@+++ perfeture_service GETSUBEXT - GET, @@@@@@ ${url}');
|
//print('++++++++$url');
|
||||||
final response = await http.get(Uri.parse(url),
|
final response = await http.get(
|
||||||
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|
||||||
perfs = json.decode(utf8.decode(response.bodyBytes));
|
perfs = json.decode(utf8.decode(response.bodyBytes));
|
||||||
}
|
}
|
||||||
return perfs;
|
return perfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,28 +1,22 @@
|
|||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:rogapp/utils/const.dart';
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
|
||||||
class TrackingService {
|
class TrackingService {
|
||||||
|
static Future<Map<String, dynamic>> addTrack(
|
||||||
static Future<Map<String, dynamic>> addTrack(String user_id, double lat, double lon) async {
|
String userId, double lat, double lon) async {
|
||||||
Map<String, dynamic> cats = {};
|
Map<String, dynamic> cats = {};
|
||||||
String server_url = ConstValues.currentServer();
|
String serverUrl = ConstValues.currentServer();
|
||||||
String url = '${server_url}/api/track/';
|
String url = '$serverUrl/api/track/';
|
||||||
final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}';
|
//print('++++++++$url');
|
||||||
print('@@@@@@+++ tracking_service ADDTRAACK - POST, with user_id : ${user_id} geom : ${geom} @@@@@@ ${url}');
|
final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}';
|
||||||
final http.Response response = await http.post(
|
final http.Response response = await http.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
},
|
},
|
||||||
body: jsonEncode(<String, String>{
|
body: jsonEncode(<String, String>{'user_id': userId, 'geom': geom}),
|
||||||
'user_id': user_id,
|
|
||||||
'geom': geom
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
@ -30,5 +24,4 @@ class TrackingService {
|
|||||||
}
|
}
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rogapp/theme/pallete.dart';
|
|
||||||
|
|
||||||
class AppTheme {
|
|
||||||
static ThemeData theme = ThemeData.light(useMaterial3: true).copyWith(
|
|
||||||
scaffoldBackgroundColor: Pallete.WHITE_COLOR,
|
|
||||||
primaryColor: Pallete.BLUE_COLOR,
|
|
||||||
secondaryHeaderColor: Pallete.GREEN_COLOR,
|
|
||||||
appBarTheme: const AppBarTheme(
|
|
||||||
color: Pallete.BACKGROUND_COLOR,
|
|
||||||
elevation: 0
|
|
||||||
),
|
|
||||||
floatingActionButtonTheme: const FloatingActionButtonThemeData(
|
|
||||||
backgroundColor: Pallete.BLUE_COLOR
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class Pallete {
|
|
||||||
static const Color BACKGROUND_COLOR = Color.fromRGBO(191, 33, 46, 1);
|
|
||||||
static const Color SEARCHBAR_COLOR = Color.fromRGBO(191, 33, 120, 1);
|
|
||||||
static const Color BLUE_COLOR = Color.fromRGBO(36, 163, 191, 1);
|
|
||||||
static const Color GREEN_COLOR = Color.fromRGBO(31, 140, 58, 1);
|
|
||||||
static const Color BROWN_COLOR = Color.fromRGBO(191, 135, 31, 1);
|
|
||||||
static const Color WHITE_COLOR = Colors.white;
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
export 'pallete.dart';
|
|
||||||
export 'app_theme.dart';
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
import 'package:sqflite/sqflite.dart';
|
|
||||||
import 'package:path/path.dart';
|
|
||||||
|
|
||||||
class CheckinDBHelper {
|
|
||||||
static final _databaseName = "EventDatabase.db";
|
|
||||||
static final _databaseVersion = 1;
|
|
||||||
|
|
||||||
static final table = 'event_table';
|
|
||||||
|
|
||||||
static final columnLocationId = 'location_id';
|
|
||||||
static final columnOrderId = 'order_id';
|
|
||||||
static final columnCheckinTime = 'checkin_time';
|
|
||||||
static final columnEventName = 'event_name';
|
|
||||||
|
|
||||||
// make this a singleton class
|
|
||||||
CheckinDBHelper._privateConstructor();
|
|
||||||
static final CheckinDBHelper instance = CheckinDBHelper._privateConstructor();
|
|
||||||
|
|
||||||
// only have a single app-wide reference to the database
|
|
||||||
static Database? _database;
|
|
||||||
Future<Database> get database async {
|
|
||||||
if (_database != null) return _database!;
|
|
||||||
_database = await _initDatabase();
|
|
||||||
return _database!;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this opens the database (and creates it if it doesn't exist)
|
|
||||||
_initDatabase() async {
|
|
||||||
String path = join(await getDatabasesPath(), _databaseName);
|
|
||||||
return await openDatabase(path,
|
|
||||||
version: _databaseVersion,
|
|
||||||
onCreate: _onCreate);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SQL code to create the database table
|
|
||||||
Future _onCreate(Database db, int version) async {
|
|
||||||
await db.execute('''
|
|
||||||
CREATE TABLE $table (
|
|
||||||
$columnLocationId INTEGER PRIMARY KEY,
|
|
||||||
$columnOrderId INTEGER NOT NULL,
|
|
||||||
$columnCheckinTime TEXT NOT NULL,
|
|
||||||
$columnEventName TEXT NOT NULL
|
|
||||||
)
|
|
||||||
''');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper methods
|
|
||||||
|
|
||||||
Future<int> insert(Map<String, dynamic> row) async {
|
|
||||||
Database db = await instance.database;
|
|
||||||
return await db.insert(table, row);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<bool> exists(int locationId) async {
|
|
||||||
Database db = await instance.database;
|
|
||||||
List<Map<String, dynamic>> rows = await db.query(
|
|
||||||
table,
|
|
||||||
where: '$columnLocationId = ?',
|
|
||||||
whereArgs: [locationId],
|
|
||||||
);
|
|
||||||
return rows.isNotEmpty;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> queryAllRows() async {
|
|
||||||
Database db = await instance.database;
|
|
||||||
return await db.query(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> queryRowsByLocation(int locationId) async {
|
|
||||||
Database db = await instance.database;
|
|
||||||
return await db.query(table,
|
|
||||||
where: '$columnLocationId = ?',
|
|
||||||
whereArgs: [locationId],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> update(Map<String, dynamic> row) async {
|
|
||||||
Database db = await instance.database;
|
|
||||||
int id = row[columnLocationId];
|
|
||||||
return await db.update(table, row, where: '$columnLocationId = ?', whereArgs: [id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -10,6 +10,7 @@ class ConstValues{
|
|||||||
static const dev_home_ip_mserver = "http://192.168.1.10:8100";
|
static const dev_home_ip_mserver = "http://192.168.1.10:8100";
|
||||||
|
|
||||||
static String currentServer(){
|
static String currentServer(){
|
||||||
|
//return dev_ip_server;
|
||||||
return server_uri;
|
return server_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
102
lib/utils/database_gps.dart
Normal file
102
lib/utils/database_gps.dart
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'package:path/path.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:rogapp/model/gps_data.dart';
|
||||||
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
|
||||||
|
class GpsDatabaseHelper {
|
||||||
|
GpsDatabaseHelper._privateConstructor();
|
||||||
|
static final GpsDatabaseHelper instance =
|
||||||
|
GpsDatabaseHelper._privateConstructor();
|
||||||
|
static Database? _database;
|
||||||
|
Future<Database> get database async => _database ??= await _initDatabase();
|
||||||
|
|
||||||
|
Future<Database> _initDatabase() async {
|
||||||
|
Directory documentDirectory = await getApplicationDocumentsDirectory();
|
||||||
|
String path = join(documentDirectory.path, 'rog.db');
|
||||||
|
// return await openDatabase(
|
||||||
|
// path,
|
||||||
|
// version: 1,
|
||||||
|
// onCreate: _onCreate,
|
||||||
|
// );
|
||||||
|
return openDatabase(
|
||||||
|
join(
|
||||||
|
await getDatabasesPath(),
|
||||||
|
'gps.db',
|
||||||
|
),
|
||||||
|
version: 1,
|
||||||
|
onCreate: _onCreate);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _onCreate(Database db, int version) async {
|
||||||
|
await db.execute('''
|
||||||
|
CREATE TABLE gps(
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
team_name TEXT,
|
||||||
|
event_code TEXT,
|
||||||
|
lat REAL,
|
||||||
|
lon REAL,
|
||||||
|
is_checkin int,
|
||||||
|
created_at INTEGER,
|
||||||
|
is_synced INTEGER DEFAULT 0
|
||||||
|
)
|
||||||
|
''');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<int> insertGps(GpsData gps) async {
|
||||||
|
try {
|
||||||
|
print("---- try insering ${gps.toMap()}");
|
||||||
|
Database db = await instance.database;
|
||||||
|
int? nextOrder =
|
||||||
|
Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM gps'));
|
||||||
|
nextOrder = nextOrder ?? 0;
|
||||||
|
nextOrder = nextOrder + 1;
|
||||||
|
gps.id = nextOrder;
|
||||||
|
print("---- insering ${gps.toMap()}");
|
||||||
|
int res = await db.insert(
|
||||||
|
'gps',
|
||||||
|
gps.toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
|
);
|
||||||
|
print("------ database helper insert $res-----------::::::::");
|
||||||
|
return res;
|
||||||
|
} catch (err) {
|
||||||
|
print("------ error $err-----------::::::::");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<GpsData>> getGPSData(String team_name, String event_code) async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
var gpss = await db.query('gps',
|
||||||
|
where: "team_name = ? and event_code = ?",
|
||||||
|
whereArgs: [team_name, event_code],
|
||||||
|
orderBy: 'created_at');
|
||||||
|
List<GpsData> gpsDatas =
|
||||||
|
gpss.isNotEmpty ? gpss.map((e) => GpsData.fromMap(e)).toList() : [];
|
||||||
|
//print("--------- db list $gpsDatas");
|
||||||
|
return gpsDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<GpsData>> getUnsyncedGPSData(
|
||||||
|
String team_name, String event_code) async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
var gpss = await db.query('gps',
|
||||||
|
where: 'team_name = ? and event_code = ? and is_synced = 0',
|
||||||
|
whereArgs: [team_name, event_code],
|
||||||
|
orderBy: 'created_at');
|
||||||
|
return gpss.isNotEmpty ? gpss.map((e) => GpsData.fromMap(e)).toList() : [];
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> setSyncData(List<GpsData> data) async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
for (var record in data) {
|
||||||
|
await db.update(
|
||||||
|
'gps',
|
||||||
|
{'is_synced': 1},
|
||||||
|
where: 'id = ?',
|
||||||
|
whereArgs: [record.id],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,12 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:rogapp/model/Rogaining.dart';
|
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
|
||||||
import '../model/rog.dart';
|
import '../model/rog.dart';
|
||||||
|
|
||||||
class DatabaseHelper{
|
class DatabaseHelper {
|
||||||
DatabaseHelper._privateConstructor();
|
DatabaseHelper._privateConstructor();
|
||||||
static final DatabaseHelper instance = DatabaseHelper._privateConstructor();
|
static final DatabaseHelper instance = DatabaseHelper._privateConstructor();
|
||||||
|
|
||||||
@ -22,7 +21,13 @@ class DatabaseHelper{
|
|||||||
// version: 1,
|
// version: 1,
|
||||||
// onCreate: _onCreate,
|
// onCreate: _onCreate,
|
||||||
// );
|
// );
|
||||||
return openDatabase(join(await getDatabasesPath(), 'rog.db',), version: 1, onCreate: _onCreate);
|
return openDatabase(
|
||||||
|
join(
|
||||||
|
await getDatabasesPath(),
|
||||||
|
'rog.db',
|
||||||
|
),
|
||||||
|
version: 1,
|
||||||
|
onCreate: _onCreate);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _onCreate(Database db, int version) async {
|
Future _onCreate(Database db, int version) async {
|
||||||
@ -49,11 +54,16 @@ class DatabaseHelper{
|
|||||||
cp REAL,
|
cp REAL,
|
||||||
checkin_point REAL,
|
checkin_point REAL,
|
||||||
buy_point REAL,
|
buy_point REAL,
|
||||||
hidden_location INTEGER
|
hidden_location INTEGER,
|
||||||
|
checkin_image TEXT,
|
||||||
|
buypoint_image TEXT,
|
||||||
|
forced_checkin INTEGER,
|
||||||
|
recipt_times INTEGER,
|
||||||
|
tags TEXT
|
||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await db.execute('''
|
await db.execute('''
|
||||||
CREATE TABLE rogaining(
|
CREATE TABLE rogaining(
|
||||||
rog_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
rog_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
course_id INTEGER,
|
course_id INTEGER,
|
||||||
@ -66,7 +76,7 @@ class DatabaseHelper{
|
|||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await db.execute('''
|
await db.execute('''
|
||||||
CREATE TABLE rog(
|
CREATE TABLE rog(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
team_name TEXT,
|
team_name TEXT,
|
||||||
@ -78,156 +88,137 @@ class DatabaseHelper{
|
|||||||
rog_action_type INTEGER
|
rog_action_type INTEGER
|
||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Rog>> allRogianing() async {
|
Future<List<Rog>> allRogianing() async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var rog = await db.query('rog');
|
var rog = await db.query('rog');
|
||||||
List<Rog> roglist = rog.isNotEmpty ?
|
List<Rog> roglist =
|
||||||
rog.map((e) => Rog.fromMap(e)).toList() : [];
|
rog.isNotEmpty ? rog.map((e) => Rog.fromMap(e)).toList() : [];
|
||||||
print("--------- ${rog}");
|
//print("--------- $rog");
|
||||||
return roglist;
|
return roglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<List<Rog>> getRogainingByLatLon(double lat, double lon) async {
|
Future<List<Rog>> getRogainingByLatLon(double lat, double lon) async {
|
||||||
Database db = await instance.database;
|
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<Rog> roglist = rog.isNotEmpty
|
List<Rog> roglist =
|
||||||
? rog.map((e) => Rog.fromMap(e)).toList() : [];
|
rog.isNotEmpty ? rog.map((e) => Rog.fromMap(e)).toList() : [];
|
||||||
return roglist;
|
return roglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future clearSelection() async {
|
Future clearSelection() async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
Map<String, dynamic> row_clear = {
|
Map<String, dynamic> rowClear = {"selected": false};
|
||||||
"selected": false
|
return await db.update("destination", rowClear);
|
||||||
};
|
|
||||||
return await db.update(
|
|
||||||
"destination",
|
|
||||||
row_clear
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> toggleSelecttion(Destination dest) async {
|
Future<int> toggleSelecttion(Destination dest) async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
|
|
||||||
bool val = !dest.selected!;
|
bool val = !dest.selected!;
|
||||||
Map<String, dynamic> row_target = {
|
Map<String, dynamic> rowTarget = {"selected": val};
|
||||||
"selected": val
|
|
||||||
};
|
|
||||||
|
|
||||||
await clearSelection();
|
await clearSelection();
|
||||||
|
|
||||||
return await db.update(
|
return await db.update("destination", rowTarget,
|
||||||
"destination",
|
where: 'location_id = ?', whereArgs: [dest.location_id!]);
|
||||||
row_target,
|
|
||||||
where: 'location_id = ?',
|
|
||||||
whereArgs: [dest.location_id!]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteRogaining(int id) async {
|
Future<int> deleteRogaining(int id) async {
|
||||||
Database db = await instance.database;
|
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;
|
int ret = rog > 0 ? rog : -1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<void> deleteAllRogaining() async {
|
Future<void> deleteAllRogaining() async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
await db.delete('rog');
|
await db.delete('rog');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> isRogAlreadyAvailable(int id) async {
|
||||||
Future<bool>isRogAlreadyAvailable(int id) async{
|
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var rog = await db.query('rog', where: "id = ${id}");
|
var rog = await db.query('rog', where: "id = $id");
|
||||||
return rog.length > 0 ? true : false;
|
return rog.isNotEmpty ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int?>latestGoal() async{
|
Future<int?> latestGoal() async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
return Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(checkintime) FROM rog'));
|
return Sqflite.firstIntValue(
|
||||||
|
await db.rawQuery('SELECT MAX(checkintime) FROM rog'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> insertRogaining(Rog rog) async {
|
Future<int> insertRogaining(Rog rog) async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
|
int? nextOrder =
|
||||||
next_order = next_order==null ? 0 : next_order;
|
Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
|
||||||
next_order = next_order + 1;
|
nextOrder = nextOrder ?? 0;
|
||||||
rog.id = next_order;
|
nextOrder = nextOrder + 1;
|
||||||
|
rog.id = nextOrder;
|
||||||
int res = await db.insert(
|
int res = await db.insert(
|
||||||
'rog',
|
'rog',
|
||||||
rog.toMap(),
|
rog.toMap(),
|
||||||
conflictAlgorithm: ConflictAlgorithm.replace,
|
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
);
|
);
|
||||||
print("------ database helper insert ${res}-----------::::::::");
|
//print("------ database helper insert $res-----------::::::::");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<List<Destination>> getDestinations() async {
|
Future<List<Destination>> getDestinations() async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var dest = await db.query('destination', orderBy: 'list_order');
|
var dest = await db.query('destination', orderBy: 'list_order');
|
||||||
List<Destination> destList = dest.isNotEmpty ?
|
List<Destination> destList =
|
||||||
dest.map((e) => Destination.fromMap(e)).toList() : [];
|
dest.isNotEmpty ? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||||
print("--------- ${destList}");
|
//print("--------- $destList");
|
||||||
return destList;
|
return destList;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Destination>> getDestinationById(int id) async {
|
Future<List<Destination>> getDestinationById(int id) async {
|
||||||
Database db = await instance.database;
|
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<Destination> deslist = rog.isNotEmpty
|
List<Destination> deslist =
|
||||||
? rog.map((e) => Destination.fromMap(e)).toList() : [];
|
rog.isNotEmpty ? rog.map((e) => Destination.fromMap(e)).toList() : [];
|
||||||
return deslist;
|
return deslist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<Destination>> getDestinationByLatLon(
|
||||||
Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async {
|
double lat, double lon) async {
|
||||||
Database db = await instance.database;
|
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',
|
||||||
List<Destination> destList = dest.isNotEmpty
|
where: "lat = $lat and lon= $lon", orderBy: 'list_order');
|
||||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
List<Destination> destList =
|
||||||
|
dest.isNotEmpty ? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||||
return destList;
|
return destList;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteDestination(int location_id) async {
|
Future<int> deleteDestination(int locationId) async {
|
||||||
Database db = await instance.database;
|
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;
|
int ret = dest > 0 ? dest : -1;
|
||||||
|
|
||||||
//after deleting set correct order
|
//after deleting set correct order
|
||||||
await setOrder();
|
await setOrder();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void>setOrder() async {
|
Future<void> setOrder() async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var byOrder = await db.query('destination', orderBy: 'list_order');
|
var byOrder = await db.query('destination', orderBy: 'list_order');
|
||||||
|
|
||||||
List<Destination> des_db = byOrder.isNotEmpty
|
List<Destination> desDb = byOrder.isNotEmpty
|
||||||
? byOrder.map((e) => Destination.fromMap(e)).toList() : [];
|
? byOrder.map((e) => Destination.fromMap(e)).toList()
|
||||||
|
: [];
|
||||||
|
|
||||||
int order = 1;
|
int order = 1;
|
||||||
for( Destination d in des_db){
|
for (Destination d in desDb) {
|
||||||
|
Map<String, dynamic> rowTarget = {"list_order": order};
|
||||||
|
|
||||||
Map<String, dynamic> row_target = {
|
await db.update("destination", rowTarget,
|
||||||
"list_order": order
|
where: 'location_id = ?', whereArgs: [d.location_id]);
|
||||||
};
|
|
||||||
|
|
||||||
await db.update(
|
|
||||||
"destination",
|
|
||||||
row_target,
|
|
||||||
where: 'location_id = ?',
|
|
||||||
whereArgs: [d.location_id]
|
|
||||||
);
|
|
||||||
|
|
||||||
order += 1;
|
order += 1;
|
||||||
}
|
}
|
||||||
@ -238,18 +229,21 @@ class DatabaseHelper{
|
|||||||
await db.delete('destination');
|
await db.delete('destination');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool>isAlreadyAvailable(int location_id) async{
|
Future<bool> isAlreadyAvailable(int locationId) async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var dest = await db.query('destination', where: "location_id = ${location_id}");
|
var dest =
|
||||||
return dest.length > 0 ? true : false;
|
await db.query('destination', where: "location_id = $locationId");
|
||||||
|
return dest.isNotEmpty ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> insertDestination(Destination dest) async {
|
Future<int> insertDestination(Destination dest) async {
|
||||||
|
await deleteDestination(dest.location_id!);
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
|
int? nextOrder = Sqflite.firstIntValue(
|
||||||
next_order = next_order==null ? 0 : next_order;
|
await db.rawQuery('SELECT MAX(list_order) FROM destination'));
|
||||||
next_order = next_order + 1;
|
nextOrder = nextOrder ?? 0;
|
||||||
dest.list_order = next_order;
|
nextOrder = nextOrder + 1;
|
||||||
|
dest.list_order = nextOrder;
|
||||||
int res = await db.insert(
|
int res = await db.insert(
|
||||||
'destination',
|
'destination',
|
||||||
dest.toMap(),
|
dest.toMap(),
|
||||||
@ -259,60 +253,63 @@ class DatabaseHelper{
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> updateAction(Destination destination, bool checkin)async {
|
Future<int> updateCancelBuyPoint(Destination destination) async {
|
||||||
|
//print("---- updating puypint image in db -----");
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
int act = checkin == false ? 0 : 1;
|
Map<String, dynamic> row = {"buy_point": 0};
|
||||||
Map<String, dynamic> row = {
|
return await db.update("destination", row,
|
||||||
"checkedin": act
|
where: 'location_id = ?', whereArgs: [destination.location_id!]);
|
||||||
};
|
|
||||||
return await db.update(
|
|
||||||
"destination",
|
|
||||||
row,
|
|
||||||
where: 'location_id = ?',
|
|
||||||
whereArgs: [destination.location_id!]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateOrder(Destination d, int dir)async {
|
Future<int> updateBuyPoint(Destination destination, String imageUrl) async {
|
||||||
|
//print("---- updating puypint image in db -----");
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}");
|
Map<String, dynamic> row = {"buypoint_image": imageUrl};
|
||||||
var dest = await db.query('destination', where: "location_id = ${d.location_id}");
|
return await db.update("destination", row,
|
||||||
|
where: 'location_id = ?', whereArgs: [destination.location_id!]);
|
||||||
|
}
|
||||||
|
|
||||||
print("--- target in db is ${target}");
|
Future<int> updateAction(Destination destination, bool checkin) async {
|
||||||
print("--- destine in db is ${dest}");
|
Database db = await instance.database;
|
||||||
|
int act = checkin == false ? 0 : 1;
|
||||||
|
Map<String, dynamic> row = {"checkedin": act};
|
||||||
|
return await db.update("destination", row,
|
||||||
|
where: 'location_id = ?', whereArgs: [destination.location_id!]);
|
||||||
|
}
|
||||||
|
|
||||||
if(target.isNotEmpty){
|
Future<void> updateOrder(Destination d, int dir) async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
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}");
|
||||||
|
|
||||||
List<Destination> target_indb = target.isNotEmpty
|
// print("--- target in db is $target");
|
||||||
? target.map((e) => Destination.fromMap(e)).toList() : [];
|
// print("--- destine in db is $dest");
|
||||||
|
|
||||||
List<Destination> dest_indb = dest.isNotEmpty
|
if (target.isNotEmpty) {
|
||||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
List<Destination> targetIndb = target.isNotEmpty
|
||||||
|
? target.map((e) => Destination.fromMap(e)).toList()
|
||||||
|
: [];
|
||||||
|
|
||||||
Map<String, dynamic> row_target = {
|
List<Destination> destIndb = dest.isNotEmpty
|
||||||
"list_order": d.list_order
|
? dest.map((e) => Destination.fromMap(e)).toList()
|
||||||
};
|
: [];
|
||||||
|
|
||||||
Map<String, dynamic> row_des = {
|
Map<String, dynamic> rowTarget = {"list_order": d.list_order};
|
||||||
"list_order": dest_indb[0].list_order! + dir
|
|
||||||
|
Map<String, dynamic> rowDes = {
|
||||||
|
"list_order": destIndb[0].list_order! + dir
|
||||||
};
|
};
|
||||||
|
|
||||||
// print("--- target destination is ${target_indb[0].location_id}");
|
// print("--- target destination is ${target_indb[0].location_id}");
|
||||||
// print("--- destine destination is is ${dest_indb[0].location_id}");
|
// print("--- destine destination is is ${dest_indb[0].location_id}");
|
||||||
|
|
||||||
await db.update(
|
await db.update("destination", rowTarget,
|
||||||
"destination",
|
where: 'location_id = ?', whereArgs: [targetIndb[0].location_id]);
|
||||||
row_target,
|
|
||||||
where: 'location_id = ?',
|
|
||||||
whereArgs: [target_indb[0]!.location_id]
|
|
||||||
);
|
|
||||||
|
|
||||||
await db.update(
|
await db.update("destination", rowDes,
|
||||||
"destination",
|
where: 'location_id = ?', whereArgs: [destIndb[0].location_id]);
|
||||||
row_des,
|
|
||||||
where: 'location_id = ?',
|
|
||||||
whereArgs: [dest_indb[0]!.location_id]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,6 +317,4 @@ class DatabaseHelper{
|
|||||||
// Database db = await instance.database;
|
// Database db = await instance.database;
|
||||||
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,170 +0,0 @@
|
|||||||
import 'package:flutter_map/flutter_map.dart';
|
|
||||||
import 'package:rogapp/model/location_response.dart';
|
|
||||||
import 'package:sqflite/sqflite.dart';
|
|
||||||
import 'package:path/path.dart';
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
|
||||||
import 'dart:io';
|
|
||||||
import 'dart:convert'; // for jsonEncode
|
|
||||||
|
|
||||||
class DatabaseHelper {
|
|
||||||
static const _databaseName = "FeatureDatabase.db";
|
|
||||||
static const _databaseVersion = 1;
|
|
||||||
|
|
||||||
// Singleton class
|
|
||||||
DatabaseHelper._();
|
|
||||||
static final DatabaseHelper instance = DatabaseHelper._();
|
|
||||||
|
|
||||||
Database? _database;
|
|
||||||
Future<Database> get database async {
|
|
||||||
if (_database != null) return _database!;
|
|
||||||
_database = await _initDatabase();
|
|
||||||
return _database!;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Database> _initDatabase() async {
|
|
||||||
Directory documentsDirectory = await getApplicationDocumentsDirectory();
|
|
||||||
String path = join(documentsDirectory.path, _databaseName);
|
|
||||||
return await openDatabase(
|
|
||||||
path,
|
|
||||||
version: _databaseVersion,
|
|
||||||
onCreate: _onCreate,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onCreate(Database db, int version) async {
|
|
||||||
await db.execute('''
|
|
||||||
CREATE TABLE features (
|
|
||||||
id INTEGER PRIMARY KEY,
|
|
||||||
geometry TEXT NOT NULL,
|
|
||||||
properties TEXT NOT NULL,
|
|
||||||
type TEXT NOT NULL,
|
|
||||||
location_id,
|
|
||||||
latitude REAL NOT NULL,
|
|
||||||
longitude REAL NOT NULL
|
|
||||||
)
|
|
||||||
''');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Database insert operation
|
|
||||||
Future<void> insertFeature(Map<String, dynamic> feature) async {
|
|
||||||
// Get a reference to the database.
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
// Insert the feature into the correct table.
|
|
||||||
await db.insert(
|
|
||||||
'features',
|
|
||||||
feature,
|
|
||||||
conflictAlgorithm: ConflictAlgorithm.replace,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Database get operation
|
|
||||||
Future<List<Feature>> getFeatures() async {
|
|
||||||
Database db = await database;
|
|
||||||
final List<Map<String, dynamic>> maps = await db.query('features');
|
|
||||||
|
|
||||||
return List.generate(maps.length, (i) {
|
|
||||||
return Feature(
|
|
||||||
id: maps[i]['id'],
|
|
||||||
geometry: Geometry.fromMap(jsonDecode(maps[i]['geometry'])),
|
|
||||||
properties: Properties.fromMap(jsonDecode(maps[i]['properties'])),
|
|
||||||
type: maps[i]['type'],
|
|
||||||
location_id: Properties.fromMap(jsonDecode(maps[i]['properties'])).location_id,
|
|
||||||
latitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][1],
|
|
||||||
longitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][0]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Database delete operation
|
|
||||||
Future<void> deleteFeature(int id) async {
|
|
||||||
Database db = await database;
|
|
||||||
await db.delete(
|
|
||||||
'features',
|
|
||||||
where: "id = ?",
|
|
||||||
whereArgs: [id],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deleteAll() async {
|
|
||||||
// Get a reference to the database.
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
// Delete all rows.
|
|
||||||
await db.rawDelete('DELETE FROM features');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Database search by location_id
|
|
||||||
Future<List<Feature>> getFeatureByLocationId(int locationId) async {
|
|
||||||
Database db = await database;
|
|
||||||
final List<Map<String, dynamic>> maps = await db.query(
|
|
||||||
'features',
|
|
||||||
where: "location_id = ?",
|
|
||||||
whereArgs: [locationId],
|
|
||||||
);
|
|
||||||
|
|
||||||
return List.generate(maps.length, (i) {
|
|
||||||
return Feature(
|
|
||||||
id: maps[i]['id'],
|
|
||||||
geometry: Geometry.fromMap(jsonDecode(maps[i]['geometry'])),
|
|
||||||
properties: Properties.fromMap(jsonDecode(maps[i]['properties'])),
|
|
||||||
type: maps[i]['type'],
|
|
||||||
location_id: Properties.fromMap(jsonDecode(maps[i]['properties'])).location_id,
|
|
||||||
latitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][1],
|
|
||||||
longitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][0]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Database search by latitude and longitude
|
|
||||||
Future<List<Feature>> getFeatureByLatLon(double latitude, double longitude) async {
|
|
||||||
Database db = await database;
|
|
||||||
final List<Map<String, dynamic>> maps = await db.query(
|
|
||||||
'features',
|
|
||||||
where: "latitude = ? AND longitude = ?",
|
|
||||||
whereArgs: [latitude, longitude],
|
|
||||||
);
|
|
||||||
|
|
||||||
return List.generate(maps.length, (i) {
|
|
||||||
return Feature(
|
|
||||||
id: maps[i]['id'],
|
|
||||||
geometry: Geometry.fromMap(jsonDecode(maps[i]['geometry'])),
|
|
||||||
properties: Properties.fromMap(jsonDecode(maps[i]['properties'])),
|
|
||||||
type: maps[i]['type'],
|
|
||||||
location_id: Properties.fromMap(jsonDecode(maps[i]['properties'])).location_id,
|
|
||||||
latitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][1],
|
|
||||||
longitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][0]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<List<Feature>> getFeaturesWithinBounds(LatLngBounds bounds) async {
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
final List<Map<String, dynamic>> maps = await db.query(
|
|
||||||
'features',
|
|
||||||
where: 'latitude BETWEEN ? AND ? AND longitude BETWEEN ? AND ?',
|
|
||||||
whereArgs: [
|
|
||||||
bounds.southWest!.latitude,
|
|
||||||
bounds.northEast!.latitude,
|
|
||||||
bounds.southWest!.longitude,
|
|
||||||
bounds.northEast!.longitude,
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
return List.generate(maps.length, (i) {
|
|
||||||
return Feature(
|
|
||||||
id: maps[i]['id'],
|
|
||||||
geometry: Geometry.fromMap(jsonDecode(maps[i]['geometry'])),
|
|
||||||
properties: Properties.fromMap(jsonDecode(maps[i]['properties'])),
|
|
||||||
type: maps[i]['type'],
|
|
||||||
location_id: Properties.fromMap(jsonDecode(maps[i]['properties'])).location_id,
|
|
||||||
latitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][1],
|
|
||||||
longitude: Geometry.fromMap(jsonDecode(maps[i]['geometry'])).coordinates![0][0]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
162
lib/utils/location_controller.dart
Normal file
162
lib/utils/location_controller.dart
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
|
import 'package:rogapp/widgets/debug_widget.dart';
|
||||||
|
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||||
|
|
||||||
|
class LocationController extends GetxController {
|
||||||
|
// Reactive variable to hold the current position
|
||||||
|
Rx<Position?> currentPosition = Rx<Position?>(null);
|
||||||
|
|
||||||
|
// Subscription to the position stream
|
||||||
|
StreamSubscription<Position>? positionStream;
|
||||||
|
|
||||||
|
final locationMarkerPositionStreamController =
|
||||||
|
StreamController<LocationMarkerPosition?>.broadcast();
|
||||||
|
|
||||||
|
bool isStreamPaused = false;
|
||||||
|
|
||||||
|
Stream<LocationMarkerPosition?> get locationMarkerPositionStream =>
|
||||||
|
locationMarkerPositionStreamController.stream;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
// Start listening to location updates when the controller is initialized
|
||||||
|
startPositionStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void startPositionStream() async {
|
||||||
|
// Check for location service and permissions before starting the stream
|
||||||
|
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||||
|
if (!serviceEnabled) {
|
||||||
|
// Use GetX's context to show a dialog
|
||||||
|
Get.dialog(
|
||||||
|
AlertDialog(
|
||||||
|
title: const Text('Location Services Disabled'),
|
||||||
|
content: const Text(
|
||||||
|
'Please enable location services to continue using the app.'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
// Close the dialog
|
||||||
|
Get.back();
|
||||||
|
// Optionally, you can direct the user to the settings page
|
||||||
|
// Geolocator.openLocationSettings();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
barrierDismissible: false, // User must tap button to close dialog
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocationPermission permission = await Geolocator.checkPermission();
|
||||||
|
if (permission == LocationPermission.denied) {
|
||||||
|
permission = await Geolocator.requestPermission();
|
||||||
|
if (permission == LocationPermission.denied) {
|
||||||
|
// Show a dialog if permissions are still denied
|
||||||
|
Get.dialog(
|
||||||
|
AlertDialog(
|
||||||
|
title: const Text('Location Permission Denied'),
|
||||||
|
content: const Text(
|
||||||
|
'This app requires location permissions to function properly. Please enable location permissions in your device settings.'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
// Close the dialog
|
||||||
|
Get.back();
|
||||||
|
// Optionally, direct the user to the app settings
|
||||||
|
// Geolocator.openAppSettings();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
barrierDismissible: false,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (permission == LocationPermission.deniedForever) {
|
||||||
|
// Show a dialog if permissions are permanently denied
|
||||||
|
Get.dialog(
|
||||||
|
AlertDialog(
|
||||||
|
title: const Text('Location Permission Needed'),
|
||||||
|
content: const Text(
|
||||||
|
'Location permissions have been permanently denied. Please open app settings to enable location permissions.'),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('Open Settings'),
|
||||||
|
onPressed: () {
|
||||||
|
// Close the dialog and open app settings
|
||||||
|
Get.back();
|
||||||
|
Geolocator.openAppSettings();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
barrierDismissible: false,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up the location options
|
||||||
|
const locationOptions =
|
||||||
|
LocationSettings(accuracy: LocationAccuracy.high, distanceFilter: 0);
|
||||||
|
|
||||||
|
await positionStream?.cancel();
|
||||||
|
|
||||||
|
positionStream =
|
||||||
|
Geolocator.getPositionStream(locationSettings: locationOptions).listen(
|
||||||
|
(Position? position) {
|
||||||
|
if (position != null) {
|
||||||
|
final LocationMarkerPosition locationMarkerPosition =
|
||||||
|
LocationMarkerPosition(
|
||||||
|
latitude: position.latitude,
|
||||||
|
longitude: position.longitude,
|
||||||
|
accuracy: position.accuracy);
|
||||||
|
locationMarkerPositionStreamController.add(locationMarkerPosition);
|
||||||
|
} else {
|
||||||
|
locationMarkerPositionStreamController.add(null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onError: (e) {
|
||||||
|
locationMarkerPositionStreamController.addError(e);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
// Resume stream if it was paused previously
|
||||||
|
if (isStreamPaused) {
|
||||||
|
isStreamPaused = false;
|
||||||
|
positionStream!.resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method to stop the position stream
|
||||||
|
void stopPositionStream() {
|
||||||
|
if (positionStream != null) {
|
||||||
|
positionStream!.pause();
|
||||||
|
isStreamPaused = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method to resume the position stream
|
||||||
|
void resumePositionStream() {
|
||||||
|
if (positionStream != null && isStreamPaused) {
|
||||||
|
positionStream!.resume();
|
||||||
|
isStreamPaused = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// Cancel the position stream subscription when the controller is closed
|
||||||
|
positionStream?.cancel();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -129,7 +129,7 @@ class StringValues extends Translations{
|
|||||||
'finishing_rogaining' : 'ロゲイニングを終えて',
|
'finishing_rogaining' : 'ロゲイニングを終えて',
|
||||||
'cp_pls_take_photo' : "CPです。撮影してください。",
|
'cp_pls_take_photo' : "CPです。撮影してください。",
|
||||||
'take_photo of the clock' : '時計の写真を撮る',
|
'take_photo of the clock' : '時計の写真を撮る',
|
||||||
'finish_goal': 'フィニッシュゴール',
|
'finish_goal': 'ゴール完了',
|
||||||
'goal_saved': "目標を保存しました",
|
'goal_saved': "目標を保存しました",
|
||||||
'goal_added_successfuly' : '目標が正常に追加されました',
|
'goal_added_successfuly' : '目標が正常に追加されました',
|
||||||
'goal_not_added' : '目標が追加されていません',
|
'goal_not_added' : '目標が追加されていません',
|
||||||
|
|||||||
@ -1,46 +1,39 @@
|
|||||||
|
import 'package:geojson_vi/geojson_vi.dart';
|
||||||
import 'package:geojson/geojson.dart';
|
|
||||||
import 'package:rogapp/model/destination.dart';
|
import 'package:rogapp/model/destination.dart';
|
||||||
import 'package:rogapp/model/location_response.dart';
|
|
||||||
|
|
||||||
class TextUtils{
|
class TextUtils {
|
||||||
|
static String getDisplayTextFeture(GeoJSONFeature f) {
|
||||||
static String getDisplayTextFeture(GeoJsonFeature f){
|
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
String txt = "";
|
||||||
String txt = "";
|
// if(f.properties!["cp"] > 0){
|
||||||
// if(f.properties!["cp"] > 0){
|
// //print("-- sub-- ${f.properties!["cp"]} ----");
|
||||||
// //print("-- sub-- ${f.properties!["cp"]} ----");
|
// txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}";
|
||||||
// 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"]}";
|
|
||||||
//}
|
|
||||||
return txt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static String getDisplayText(Feature dp){
|
|
||||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
||||||
String txt = "";
|
|
||||||
if(dp.properties!.cp! > 0){
|
|
||||||
txt = "${dp.properties!.cp.toString().replaceAll(regex, '')}";
|
|
||||||
if(dp.properties!.checkin_point != null && dp.properties!.checkin_point! > 0){
|
|
||||||
txt = txt + "{${dp.properties!.checkin_point.toString().replaceAll(regex, '')}}";
|
|
||||||
}
|
|
||||||
if(dp.properties!.buy_point != null && dp.properties!.buy_point! > 0){
|
|
||||||
txt = "#${dp.properties!.cp.toString().replaceAll(regex, '')}(${dp.properties!.checkin_point.toString().replaceAll(regex, '')}+${dp.properties!.buy_point.toString().replaceAll(regex, '')})";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return txt;
|
|
||||||
}
|
|
||||||
|
|
||||||
static String getDisplayTextForFeature(Feature f){
|
|
||||||
return "${f.properties!.sub_loc_id}";
|
|
||||||
}
|
|
||||||
|
|
||||||
// static String getDisplayText(String num){
|
|
||||||
// RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
||||||
// return "${num.replaceAll(regex, '')}";
|
|
||||||
// }
|
// }
|
||||||
|
//if(f.properties!["buy_point"] != null && f.properties!["buy_point"] > 0){
|
||||||
|
txt = "$txt${f.properties!["sub_loc_id"]}";
|
||||||
|
//}
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
static String getDisplayText(Destination dp) {
|
||||||
|
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||||
|
String txt = "";
|
||||||
|
if (dp.cp! > 0) {
|
||||||
|
txt = dp.cp.toString().replaceAll(regex, '');
|
||||||
|
if (dp.checkin_point != null && dp.checkin_point! > 0) {
|
||||||
|
txt = "$txt{${dp.checkin_point.toString().replaceAll(regex, '')}}";
|
||||||
|
}
|
||||||
|
if (dp.buy_point != null && dp.buy_point! > 0) {
|
||||||
|
//print("^^^^^^^^^ ${dp.sub_loc_id}^^^^^^^^^^");
|
||||||
|
txt =
|
||||||
|
"#${dp.cp.toString().replaceAll(regex, '')}(${dp.checkin_point.toString().replaceAll(regex, '')}+${dp.buy_point.toString().replaceAll(regex, '')})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return txt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static String getDisplayText(String num){
|
||||||
|
// RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||||
|
// return "${num.replaceAll(regex, '')}";
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|||||||
57
lib/widgets/GameState/CheckinState.dart
Normal file
57
lib/widgets/GameState/CheckinState.dart
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rogapp/widgets/GameState/Colors.dart';
|
||||||
|
|
||||||
|
class LocationVisitedWidget extends StatelessWidget {
|
||||||
|
final int count;
|
||||||
|
final bool minimized;
|
||||||
|
|
||||||
|
const LocationVisitedWidget(
|
||||||
|
{Key? key, required this.count, this.minimized = false})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (minimized) {
|
||||||
|
return Container(
|
||||||
|
height: 40,
|
||||||
|
width: 40,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: JapaneseColors.mizu,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'$count',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 14,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: JapaneseColors.matcha,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.check_circle_outline, color: Colors.white, size: 24),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'$count チェックイン', // "X Check-ins" in Japanese
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 16),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
lib/widgets/GameState/Colors.dart
Normal file
12
lib/widgets/GameState/Colors.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class JapaneseColors {
|
||||||
|
static const Color mizu = Color(0xFFA4DDED); // Mizu (light blue)
|
||||||
|
static const Color matcha = Color(0xFFC5E1A5);
|
||||||
|
static const Color ume = Color(0xFFE1A8A8); // Ume (plum)
|
||||||
|
static const Color take = Color(0xFF7B8D42); // Take (bamboo)
|
||||||
|
static const Color sora = Color(0xFFA1CAF1);
|
||||||
|
static const Color indigo = Color(0xFF264653); // Aizome
|
||||||
|
static const Color sakuraPink = Color(0xFFFAD2E1); // Sakura-iro
|
||||||
|
/// Matcha (green tea)
|
||||||
|
}
|
||||||
72
lib/widgets/GameState/ConnectionStatus.dart
Normal file
72
lib/widgets/GameState/ConnectionStatus.dart
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rogapp/widgets/GameState/Colors.dart';
|
||||||
|
|
||||||
|
enum ConnectionStatus { none, mobile, wifi }
|
||||||
|
|
||||||
|
class ConnectionStatusIndicator extends StatelessWidget {
|
||||||
|
final ConnectionStatus connectionStatus;
|
||||||
|
final bool minimized;
|
||||||
|
|
||||||
|
const ConnectionStatusIndicator({
|
||||||
|
Key? key,
|
||||||
|
required this.connectionStatus,
|
||||||
|
this.minimized = false,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Color backgroundColor;
|
||||||
|
IconData iconData;
|
||||||
|
String text;
|
||||||
|
|
||||||
|
switch (connectionStatus) {
|
||||||
|
case ConnectionStatus.none:
|
||||||
|
backgroundColor = JapaneseColors.ume;
|
||||||
|
iconData = Icons.signal_cellular_off;
|
||||||
|
text = 'No Connection';
|
||||||
|
break;
|
||||||
|
case ConnectionStatus.mobile:
|
||||||
|
backgroundColor = JapaneseColors.take;
|
||||||
|
iconData = Icons.signal_cellular_alt;
|
||||||
|
text = 'Mobile Data';
|
||||||
|
break;
|
||||||
|
case ConnectionStatus.wifi:
|
||||||
|
backgroundColor = JapaneseColors.sora;
|
||||||
|
iconData = Icons.wifi;
|
||||||
|
text = 'Wi-Fi';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
backgroundColor = Colors.grey; // Fallback color
|
||||||
|
iconData = Icons.device_unknown;
|
||||||
|
text = 'Unknown';
|
||||||
|
}
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
height: minimized ? 40 : null,
|
||||||
|
width: minimized ? 40 : null,
|
||||||
|
padding:
|
||||||
|
minimized ? null : EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: backgroundColor,
|
||||||
|
shape: minimized ? BoxShape.circle : BoxShape.rectangle,
|
||||||
|
borderRadius: minimized ? null : BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: minimized
|
||||||
|
? Center(
|
||||||
|
child: Icon(iconData, color: Colors.white, size: 24),
|
||||||
|
)
|
||||||
|
: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(iconData, color: Colors.white),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
text,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
51
lib/widgets/GameState/DashboardWidget.dart
Normal file
51
lib/widgets/GameState/DashboardWidget.dart
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rogapp/widgets/GameState/CheckinState.dart';
|
||||||
|
import 'package:rogapp/widgets/GameState/game_on_off.dart';
|
||||||
|
|
||||||
|
class DashboardWidget extends StatelessWidget {
|
||||||
|
final bool gameStarted;
|
||||||
|
final int locationsVisited;
|
||||||
|
final bool isMinimized;
|
||||||
|
|
||||||
|
const DashboardWidget({
|
||||||
|
Key? key,
|
||||||
|
required this.gameStarted,
|
||||||
|
required this.locationsVisited,
|
||||||
|
this.isMinimized = false,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
List<Widget> widgets = [
|
||||||
|
GameStatusIndicator(gameStarted: gameStarted, minimized: isMinimized),
|
||||||
|
SizedBox(
|
||||||
|
height: isMinimized ? 0 : 8, width: isMinimized ? 8 : 0), // Spacing
|
||||||
|
LocationVisitedWidget(count: locationsVisited, minimized: isMinimized),
|
||||||
|
];
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.all(isMinimized ? 8 : 16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.5),
|
||||||
|
spreadRadius: 5,
|
||||||
|
blurRadius: 7,
|
||||||
|
offset: Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: isMinimized
|
||||||
|
? Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: widgets,
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: widgets,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
55
lib/widgets/GameState/game_on_off.dart
Normal file
55
lib/widgets/GameState/game_on_off.dart
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rogapp/widgets/GameState/Colors.dart';
|
||||||
|
|
||||||
|
class GameStatusIndicator extends StatelessWidget {
|
||||||
|
final bool gameStarted;
|
||||||
|
final bool minimized;
|
||||||
|
|
||||||
|
const GameStatusIndicator(
|
||||||
|
{Key? key, required this.gameStarted, this.minimized = true})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// Icons to show based on the game status
|
||||||
|
IconData iconData =
|
||||||
|
gameStarted ? Icons.stop_circle : Icons.play_circle_filled;
|
||||||
|
// Text to show based on the game status
|
||||||
|
String text = gameStarted ? 'ゲーム開始' : 'ゲーム未開始';
|
||||||
|
|
||||||
|
// Layout for minimized view
|
||||||
|
if (minimized) {
|
||||||
|
return Container(
|
||||||
|
height: 40, // Square size
|
||||||
|
width: 40, // Square size
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
gameStarted ? JapaneseColors.indigo : JapaneseColors.sakuraPink,
|
||||||
|
shape: BoxShape
|
||||||
|
.circle, // Making it circle when minimized for a more distinct look
|
||||||
|
),
|
||||||
|
child: Icon(iconData, color: Colors.white),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Layout for expanded view
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: gameStarted ? JapaneseColors.indigo : JapaneseColors.sakuraPink,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(iconData, color: Colors.white),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
text,
|
||||||
|
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,17 +8,14 @@ class BaseLayer extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TileLayer(
|
return TileLayer(
|
||||||
urlTemplate: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",
|
urlTemplate: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",
|
||||||
tileProvider: FMTC.instance('OpenStreetMap (A)').getTileProvider(
|
tileProvider: FMTC.instance('OpenStreetMap (A)').getTileProvider(
|
||||||
FMTCTileProviderSettings(
|
settings: FMTCTileProviderSettings(
|
||||||
behavior: CacheBehavior.values
|
behavior: CacheBehavior.values.byName('cacheFirst'),
|
||||||
.byName('cacheFirst'),
|
cachedValidDuration: const Duration(days: 14),
|
||||||
cachedValidDuration: Duration(
|
),
|
||||||
days: 14
|
),
|
||||||
),
|
);
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user