Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cd685b65e | |||
| a358f65853 |
@ -6,7 +6,6 @@
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
<uses-permission android:name="android.permission.CAMERA"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<application
|
||||
android:label="岐阜ナビ"
|
||||
android:name="${applicationName}"
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.7.10'
|
||||
ext.kotlin_version = '1.6.10'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
@ -26,6 +26,6 @@ subprojects {
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
tasks.register("clean", Delete) {
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
||||
|
||||
121
ios/Podfile.lock
121
ios/Podfile.lock
@ -4,11 +4,47 @@ PODS:
|
||||
- connectivity_plus (0.0.1):
|
||||
- Flutter
|
||||
- ReachabilitySwift
|
||||
- DKImagePickerController/Core (4.3.4):
|
||||
- DKImagePickerController/ImageDataManager
|
||||
- DKImagePickerController/Resource
|
||||
- DKImagePickerController/ImageDataManager (4.3.4)
|
||||
- DKImagePickerController/PhotoGallery (4.3.4):
|
||||
- DKImagePickerController/Core
|
||||
- DKPhotoGallery
|
||||
- DKImagePickerController/Resource (4.3.4)
|
||||
- DKPhotoGallery (0.0.17):
|
||||
- DKPhotoGallery/Core (= 0.0.17)
|
||||
- DKPhotoGallery/Model (= 0.0.17)
|
||||
- DKPhotoGallery/Preview (= 0.0.17)
|
||||
- DKPhotoGallery/Resource (= 0.0.17)
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Core (0.0.17):
|
||||
- DKPhotoGallery/Model
|
||||
- DKPhotoGallery/Preview
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Model (0.0.17):
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Preview (0.0.17):
|
||||
- DKPhotoGallery/Model
|
||||
- DKPhotoGallery/Resource
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Resource (0.0.17):
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- file_picker (0.0.1):
|
||||
- DKImagePickerController/PhotoGallery
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
- flutter_compass (0.0.1):
|
||||
- Flutter
|
||||
- flutter_keyboard_visibility (0.0.1):
|
||||
- Flutter
|
||||
- flutter_local_notifications (0.0.1):
|
||||
- Flutter
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
@ -16,102 +52,127 @@ PODS:
|
||||
- Flutter
|
||||
- google_maps_flutter_ios (0.0.1):
|
||||
- Flutter
|
||||
- GoogleMaps (< 8.0)
|
||||
- GoogleMaps (5.2.0):
|
||||
- GoogleMaps/Maps (= 5.2.0)
|
||||
- GoogleMaps/Base (5.2.0)
|
||||
- GoogleMaps/Maps (5.2.0):
|
||||
- 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):
|
||||
- Flutter
|
||||
- isar_flutter_libs (1.0.0):
|
||||
- move_to_background (0.0.1):
|
||||
- Flutter
|
||||
- path_provider_foundation (0.0.1):
|
||||
- path_provider_ios (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- permission_handler_apple (9.1.1):
|
||||
- permission_handler_apple (9.0.4):
|
||||
- Flutter
|
||||
- ReachabilitySwift (5.0.0)
|
||||
- SDWebImage (5.15.5):
|
||||
- SDWebImage/Core (= 5.15.5)
|
||||
- SDWebImage/Core (5.15.5)
|
||||
- share_plus (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- sqflite (0.0.3):
|
||||
- sqflite (0.0.2):
|
||||
- Flutter
|
||||
- FMDB (>= 2.7.5)
|
||||
- SwiftyGif (5.4.4)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_compass (from `.symlinks/plugins/flutter_compass/ios`)
|
||||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
|
||||
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
- move_to_background (from `.symlinks/plugins/move_to_background/ios`)
|
||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
|
||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- DKImagePickerController
|
||||
- DKPhotoGallery
|
||||
- FMDB
|
||||
- GoogleMaps
|
||||
- ReachabilitySwift
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
camera_avfoundation:
|
||||
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
||||
connectivity_plus:
|
||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||
file_picker:
|
||||
:path: ".symlinks/plugins/file_picker/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_compass:
|
||||
:path: ".symlinks/plugins/flutter_compass/ios"
|
||||
flutter_keyboard_visibility:
|
||||
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
|
||||
flutter_local_notifications:
|
||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
||||
geolocator_apple:
|
||||
:path: ".symlinks/plugins/geolocator_apple/ios"
|
||||
google_maps_flutter_ios:
|
||||
:path: ".symlinks/plugins/google_maps_flutter_ios/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
isar_flutter_libs:
|
||||
:path: ".symlinks/plugins/isar_flutter_libs/ios"
|
||||
path_provider_foundation:
|
||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||
move_to_background:
|
||||
:path: ".symlinks/plugins/move_to_background/ios"
|
||||
path_provider_ios:
|
||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||
permission_handler_apple:
|
||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||
share_plus:
|
||||
:path: ".symlinks/plugins/share_plus/ios"
|
||||
shared_preferences_foundation:
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
|
||||
sqflite:
|
||||
:path: ".symlinks/plugins/sqflite/ios"
|
||||
url_launcher_ios:
|
||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
|
||||
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
|
||||
camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9
|
||||
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
|
||||
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_compass: cbbd285cea1584c7ac9c4e0c3e1f17cbea55e855
|
||||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
|
||||
google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd
|
||||
GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
|
||||
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
|
||||
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
|
||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
|
||||
google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9
|
||||
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef
|
||||
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
|
||||
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d
|
||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
|
||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
|
||||
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
|
||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
||||
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
|
||||
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
||||
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
|
||||
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
||||
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
|
||||
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
||||
|
||||
PODFILE CHECKSUM: a1c2f8dde3796ecc1697a15e7c75eb5205d8a740
|
||||
|
||||
COCOAPODS: 1.12.1
|
||||
COCOAPODS: 1.12.0
|
||||
|
||||
@ -156,7 +156,7 @@
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1430;
|
||||
LastUpgradeCheck = 1300;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
@ -379,7 +379,6 @@
|
||||
DEVELOPMENT_TEAM = D5SL68ATB9;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -509,7 +508,6 @@
|
||||
DEVELOPMENT_TEAM = D5SL68ATB9;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -533,7 +531,6 @@
|
||||
DEVELOPMENT_TEAM = D5SL68ATB9;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1430"
|
||||
LastUpgradeVersion = "1300"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@ -38,8 +38,6 @@
|
||||
<string>プロフィールに動画を投稿してください。</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>写真ライブラリへのアクセス警告</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Need to save image in phone Album</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
12
lib/common/state/game/game_binding.dart
Normal file
12
lib/common/state/game/game_binding.dart
Normal file
@ -0,0 +1,12 @@
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
25
lib/common/state/game/game_controller.dart
Normal file
25
lib/common/state/game/game_controller.dart
Normal file
@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
lib/common/ui/widgets/uis.dart
Normal file
16
lib/common/ui/widgets/uis.dart
Normal file
@ -0,0 +1,16 @@
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,24 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:google_fonts/google_fonts.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_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/theme/theme.dart';
|
||||
import 'package:rogapp/utils/string_values.dart';
|
||||
// import 'package:is_lock_screen/is_lock_screen.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
void main() async {
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await FlutterMapTileCaching.initialise();
|
||||
FlutterMapTileCaching.initialise(await RootDirectory.normalCache);
|
||||
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
|
||||
await instanceA.manage.createAsync();
|
||||
await instanceA.metadata.addAsync(
|
||||
@ -27,57 +34,12 @@ void main() async {
|
||||
value: 'cacheFirst',
|
||||
);
|
||||
|
||||
runApp(const MyApp());
|
||||
runApp(MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
class MyApp extends StatelessWidget {
|
||||
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.
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
switch (state) {
|
||||
case AppLifecycleState.resumed:
|
||||
print("RESUMED");
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
if(destinationController.positionStream == null){
|
||||
destinationController.startGPSTimer();
|
||||
}
|
||||
break;
|
||||
case AppLifecycleState.inactive:
|
||||
print("INACTIVE");
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
print("PAUSED");
|
||||
break;
|
||||
case AppLifecycleState.detached:
|
||||
print("DETACHED");
|
||||
break;
|
||||
case AppLifecycleState.hidden:
|
||||
print("DETACHED");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetMaterialApp(
|
||||
@ -86,18 +48,14 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
||||
//locale: const Locale('en', 'US'),
|
||||
fallbackLocale: const Locale('en', 'US'),
|
||||
title: 'ROGAINING',
|
||||
theme: ThemeData(
|
||||
colorScheme:
|
||||
ColorScheme.fromSeed(seedColor: Color.fromARGB(255, 36, 135, 221)),
|
||||
useMaterial3: true,
|
||||
),
|
||||
theme: AppTheme.theme,
|
||||
debugShowCheckedModeBanner: false,
|
||||
defaultTransition: Transition.cupertino,
|
||||
opaqueRoute: Get.isOpaqueRouteDefault,
|
||||
popGesture: Get.isPopGestureEnable,
|
||||
transitionDuration: const Duration(milliseconds: 230),
|
||||
initialBinding: IndexBinding(), //HomeBinding(),
|
||||
initialRoute: AppPages.PERMISSION,
|
||||
initialBinding: GameBinding(),
|
||||
initialRoute: AppPages.S_LOGIN,
|
||||
getPages: AppPages.routes,
|
||||
enableLog: true,
|
||||
);
|
||||
|
||||
591
lib/model/location_response.dart
Normal file
591
lib/model/location_response.dart
Normal file
@ -0,0 +1,591 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
45
lib/model/user.dart
Normal file
45
lib/model/user.dart
Normal file
@ -0,0 +1,45 @@
|
||||
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'],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -4,18 +4,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.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/index/index_controller.dart';
|
||||
import 'package:rogapp/services/external_service.dart';
|
||||
|
||||
class CameraPage extends StatelessWidget {
|
||||
Destination? destination;
|
||||
Feature? destination;
|
||||
CameraPage({Key? key, this.destination}) : super(key: key);
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
var settingGoal = false.obs;
|
||||
|
||||
Timer? timer;
|
||||
|
||||
ImageProvider getFinishImage(){
|
||||
@ -23,34 +22,29 @@ class CameraPage extends StatelessWidget {
|
||||
return FileImage(destinationController.photos[0]);
|
||||
}
|
||||
else{
|
||||
return const AssetImage('assets/images/empty_image.png');
|
||||
return AssetImage('assets/images/empty_image.png');
|
||||
}
|
||||
}
|
||||
|
||||
Widget getAction(BuildContext context) {
|
||||
Widget getAction(BuildContext context){
|
||||
if(destinationController.is_at_goal.value && destinationController.is_in_rog.value){
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(settingGoal.value ==false){
|
||||
destinationController.openCamera(context);
|
||||
}
|
||||
},
|
||||
child: Text("take_photo of the clock".tr)
|
||||
),
|
||||
Obx(() =>
|
||||
destinationController.photos.isNotEmpty ?
|
||||
settingGoal.value == false ?
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red
|
||||
primary: Colors.red
|
||||
),
|
||||
onPressed: () async {
|
||||
settingGoal.value = true;
|
||||
try{
|
||||
int userId = indexController.currentUser[0]["user"]["id"];
|
||||
onPressed: (){
|
||||
int user_id = indexController.currentUser[0]["user"]["id"];
|
||||
//print("--- Pressed -----");
|
||||
String _team = indexController.currentUser[0]["user"]['team_name'];
|
||||
//print("--- _team : ${_team}-----");
|
||||
@ -61,7 +55,7 @@ class CameraPage extends StatelessWidget {
|
||||
DateTime now = DateTime.now();
|
||||
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
|
||||
|
||||
await ExternalService().makeGoal(userId, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
||||
ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
|
||||
print("---called ext api ${value['status']} ------");
|
||||
if(value['status'] == 'OK'){
|
||||
Get.back();
|
||||
@ -74,23 +68,9 @@ class CameraPage extends StatelessWidget {
|
||||
Get.snackbar("目標が追加されていません", "please_try_again");
|
||||
}
|
||||
});
|
||||
}
|
||||
on Exception catch(_){
|
||||
settingGoal.value = false;
|
||||
}
|
||||
finally{
|
||||
settingGoal.value = false;
|
||||
}
|
||||
},
|
||||
child:Text("finish_goal".tr)
|
||||
)
|
||||
:
|
||||
Container(
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
)
|
||||
:
|
||||
child: Text("finish_goal".tr)
|
||||
):
|
||||
Container()
|
||||
)
|
||||
],
|
||||
@ -105,14 +85,14 @@ class CameraPage extends StatelessWidget {
|
||||
onPressed: (){
|
||||
destinationController.openCamera(context);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty ? const Text("再撮影") : const Text("撮影")
|
||||
child: destinationController.photos.length > 0 ? Text("再撮影") : Text("撮影")
|
||||
)
|
||||
),
|
||||
Obx(() =>
|
||||
destinationController.photos.isNotEmpty ?
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red
|
||||
primary: Colors.red
|
||||
),
|
||||
onPressed: (){
|
||||
print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
|
||||
@ -136,7 +116,7 @@ class CameraPage extends StatelessWidget {
|
||||
// }
|
||||
// });
|
||||
},
|
||||
child: const Text("チェックイン")
|
||||
child: Text("チェックイン")
|
||||
):
|
||||
Container()
|
||||
)
|
||||
@ -156,7 +136,7 @@ class CameraPage extends StatelessWidget {
|
||||
appBar:
|
||||
destinationController.is_in_rog.value && destinationController.rogaining_counted.value == true ?
|
||||
AppBar(
|
||||
title: destination!.cp == -1 ?
|
||||
title: destination!.properties!.cp == -1 ?
|
||||
Text("finishing_rogaining".tr)
|
||||
:
|
||||
Text("cp_pls_take_photo".tr)
|
||||
@ -166,7 +146,7 @@ class CameraPage extends StatelessWidget {
|
||||
onPressed: (){
|
||||
Navigator.of(context).pop();
|
||||
destinationController.skip_10s = true;
|
||||
timer = Timer.periodic(const Duration(seconds: 10), (Timer t){
|
||||
timer = Timer.periodic(Duration(seconds: 10), (Timer t){
|
||||
destinationController.skip_10s = false;
|
||||
});
|
||||
},
|
||||
@ -175,13 +155,13 @@ class CameraPage extends StatelessWidget {
|
||||
)
|
||||
:
|
||||
AppBar(
|
||||
title: const Text("チェックポイント"),
|
||||
title: Text("チェックポイント"),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(() =>
|
||||
Container(
|
||||
@ -226,14 +206,14 @@ class StartRogaining extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("You have not started rogaining yet.".tr, style: const TextStyle(fontSize: 24)),
|
||||
const SizedBox(height: 40.0,),
|
||||
Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)),
|
||||
SizedBox(height: 40.0,),
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
Get.back();
|
||||
destinationController.skip_gps = false;
|
||||
},
|
||||
child: const Text("Back"),
|
||||
child: Text("Back"),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -259,14 +239,14 @@ class NotAtGoal extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("You have not reached the goal yet.".tr, style: const TextStyle(fontSize: 24)),
|
||||
const SizedBox(height: 40.0,),
|
||||
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: const Text("Back"),
|
||||
child: Text("Back"),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class ChangePasswordPage extends StatelessWidget {
|
||||
ChangePasswordPage({Key? key}) : super(key: key);
|
||||
@ -22,10 +23,10 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body:
|
||||
SizedBox(
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -36,13 +37,13 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Text("change_password".tr, style: const TextStyle(fontSize: 24.0),),
|
||||
child: Text("change_password".tr, style: TextStyle(fontSize: 24.0),),
|
||||
),
|
||||
const SizedBox(height: 30,),
|
||||
SizedBox(height: 30,),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
@ -53,9 +54,9 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 3,left: 3),
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
@ -70,7 +71,7 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const CircularProgressIndicator(),
|
||||
child: CircularProgressIndicator(),
|
||||
) :
|
||||
Column(
|
||||
children: [
|
||||
@ -82,9 +83,9 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"values_required".tr,
|
||||
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -98,12 +99,12 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const Text("ログイン",style: TextStyle(
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10.0,),
|
||||
SizedBox(height: 10.0,),
|
||||
|
||||
],
|
||||
)
|
||||
@ -111,8 +112,8 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
const Row(
|
||||
SizedBox(height: 20,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
@ -131,17 +132,17 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:const TextStyle(
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
const SizedBox(height: 5,),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
@ -153,7 +154,7 @@ class ChangePasswordPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30.0,)
|
||||
SizedBox(height: 30.0,)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class DestinationBinding extends Bindings {
|
||||
@override
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,20 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera_camera/camera_camera.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/destination_map/destination_map_page.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/external_service.dart';
|
||||
import 'package:rogapp/widgets/destination_widget.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
class DestnationPage extends StatelessWidget {
|
||||
DestnationPage({Key? key}) : super(key: key);
|
||||
@ -26,13 +32,13 @@ class DestnationPage extends StatelessWidget {
|
||||
permission = await Geolocator.requestPermission();
|
||||
}
|
||||
Position position = await Geolocator.getCurrentPosition(
|
||||
desiredAccuracy: LocationAccuracy.high, forceAndroidLocationManager: true);
|
||||
indexController.rogMapController.move(LatLng(position.latitude, position.longitude), 14);
|
||||
desiredAccuracy: LocationAccuracy.high);
|
||||
indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14);
|
||||
}
|
||||
|
||||
Image getImage(int index){
|
||||
if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(destinationController.destinations[index].photos!));
|
||||
@ -42,18 +48,21 @@ class DestnationPage extends StatelessWidget {
|
||||
Widget getRoutingImage(int route){
|
||||
switch (route) {
|
||||
case 0:
|
||||
return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
||||
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
||||
case 1:
|
||||
return const Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,);
|
||||
return 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,);
|
||||
return 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,);
|
||||
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||
final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
@ -76,12 +85,12 @@ class DestnationPage extends StatelessWidget {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top:30.0, bottom: 30),
|
||||
child: Center(child: Text("select_travel_mode".tr, style: const TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
|
||||
child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
|
||||
),
|
||||
ListTile(
|
||||
selected: destinationController.travelMode == 0 ? true : false,
|
||||
selectedTileColor: Colors.amber.shade200,
|
||||
leading: const Image(image: AssetImage('assets/images/p4_9_man.png'),),
|
||||
leading: Image(image: AssetImage('assets/images/p4_9_man.png'),),
|
||||
title: Text("walking".tr),
|
||||
onTap:(){
|
||||
destinationController.travelMode.value = 0;
|
||||
@ -92,7 +101,7 @@ class DestnationPage extends StatelessWidget {
|
||||
ListTile(
|
||||
selected: destinationController.travelMode == 1 ? true : false,
|
||||
selectedTileColor: Colors.amber.shade200,
|
||||
leading: const Image(image: AssetImage('assets/images/p4_8_car.png'),),
|
||||
leading: Image(image: AssetImage('assets/images/p4_8_car.png'),),
|
||||
title: Text("driving".tr),
|
||||
onTap:(){
|
||||
destinationController.travelMode.value = 1;
|
||||
@ -140,9 +149,9 @@ class DestnationPage extends StatelessWidget {
|
||||
tooltip: 'Increment',
|
||||
child: Obx(() =>
|
||||
indexController.desination_mode == 1 ?
|
||||
const Image(image: AssetImage('assets/images/list2.png'))
|
||||
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,
|
||||
),
|
||||
@ -161,12 +170,12 @@ class DestnationPage extends StatelessWidget {
|
||||
destinationController.is_at_goal == true ?
|
||||
IconButton(
|
||||
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
|
||||
icon: const Icon(Icons.assistant_photo),
|
||||
icon: Icon(Icons.assistant_photo),
|
||||
)
|
||||
:
|
||||
IconButton(
|
||||
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
|
||||
icon: const Icon(Icons.accessibility),
|
||||
icon: Icon(Icons.accessibility),
|
||||
),
|
||||
),
|
||||
// Obx(() =>
|
||||
@ -176,7 +185,7 @@ class DestnationPage extends StatelessWidget {
|
||||
ToggleButtons(
|
||||
disabledColor: Colors.grey.shade200,
|
||||
selectedColor: Colors.red,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
Icon(Icons.explore, size: 35.0,
|
||||
)],
|
||||
onPressed: (int index) {
|
||||
|
||||
@ -1,33 +1,40 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';
|
||||
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/utils/text_util.dart';
|
||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
|
||||
|
||||
class DestinationMapPage extends StatelessWidget {
|
||||
DestinationMapPage({Key? key}) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
StreamSubscription? subscription;
|
||||
final PopupController _popupLayerController = PopupController();
|
||||
|
||||
List<LatLng>? getPoints() {
|
||||
List<LatLng>? getPoints(){
|
||||
print("##### --- route point ${indexController.routePoints.length}");
|
||||
List<LatLng> pts = [];
|
||||
for (PointLatLng p in indexController.routePoints) {
|
||||
for(PointLatLng p in indexController.routePoints){
|
||||
LatLng l = LatLng(p.latitude, p.longitude);
|
||||
pts.add(l);
|
||||
}
|
||||
@ -39,64 +46,56 @@ class DestinationMapPage extends StatelessWidget {
|
||||
int index = -1;
|
||||
for (int i = 0; i < destinationController.destinations.length; i++) {
|
||||
Destination d = destinationController.destinations[i];
|
||||
print("^^^^ $d ^^^^");
|
||||
print("^^^^ ${d} ^^^^");
|
||||
Marker m = Marker(
|
||||
point: LatLng(d.lat!, d.lon!),
|
||||
anchorPos: AnchorPos.align(AnchorAlign.center),
|
||||
builder: (cts) {
|
||||
builder:(cts){
|
||||
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
onTap: (){
|
||||
print("-- Destination is --- ${d.name} ------");
|
||||
if (indexController.currentDestinationFeature.isNotEmpty) {
|
||||
if(d != null){
|
||||
if(indexController.currentDestinationFeature.length > 0) {
|
||||
indexController.currentDestinationFeature.clear();
|
||||
}
|
||||
indexController.currentDestinationFeature.add(d);
|
||||
//indexController.getAction();
|
||||
|
||||
showModalBottomSheet(
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
builder: ((context) => BottomSheetNew())).whenComplete(() {
|
||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||
builder:((context) => BottomSheetNew())
|
||||
).whenComplete((){
|
||||
print("---- set skip gps to false -----");
|
||||
destinationController.skip_gps = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
width:20,
|
||||
height:20,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(
|
||||
border: new Border.all(
|
||||
color: Colors.white,
|
||||
width:
|
||||
d.checkin_radious != null ? d.checkin_radious! : 1,
|
||||
width: d.checkin_radious != null ? d.checkin_radious! : 1,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
child: new Center(
|
||||
child: new Text(
|
||||
(i + 1).toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: Colors.yellow,
|
||||
child: Text(
|
||||
TextUtils.getDisplayText(d),
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
overflow: TextOverflow.visible),
|
||||
)),
|
||||
//Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
pts.add(m);
|
||||
@ -106,7 +105,8 @@ class DestinationMapPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx((() => Stack(
|
||||
return Obx((() =>
|
||||
Stack(
|
||||
children: [
|
||||
// indexController.is_rog_mapcontroller_loaded.value == false ?
|
||||
// Center(child: CircularProgressIndicator())
|
||||
@ -116,62 +116,322 @@ class DestinationMapPage extends StatelessWidget {
|
||||
// child: BreadCrumbWidget(mapController:indexController.rogMapController),
|
||||
// ),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 0.0),
|
||||
padding: const EdgeInsets.only(top:0.0),
|
||||
//child: TravelMap(),
|
||||
child: TravelMap(),
|
||||
child:
|
||||
TravelMap(),
|
||||
),
|
||||
],
|
||||
)));
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
FlutterMap TravelMap() {
|
||||
return FlutterMap(
|
||||
mapController: indexController.rogMapController,
|
||||
options: MapOptions(
|
||||
onMapReady: () {
|
||||
onMapReady: (){
|
||||
indexController.is_rog_mapcontroller_loaded.value = true;
|
||||
subscription = indexController.rogMapController.mapEventStream
|
||||
.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {}
|
||||
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd) {
|
||||
//destinationController.is_gps_selected.value = true;
|
||||
//indexController.mapController!.move(c.center, c.zoom);
|
||||
LatLngBounds bounds = indexController.rogMapController.bounds!;
|
||||
LatLngBounds bounds = indexController.rogMapController!.bounds!;
|
||||
indexController.currentBound.clear();
|
||||
indexController.currentBound.add(bounds);
|
||||
if (indexController.currentUser.isEmpty) {
|
||||
if(indexController.currentUser.length <= 0){
|
||||
indexController.loadLocationsBound();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
bounds: indexController.currentBound.isNotEmpty
|
||||
? indexController.currentBound[0]
|
||||
: LatLngBounds.fromPoints([
|
||||
LatLng(35.03999881162295, 136.40587119778962),
|
||||
LatLng(36.642756778706904, 137.95226720406063)
|
||||
]),
|
||||
} ,
|
||||
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,
|
||||
),
|
||||
children: [
|
||||
const BaseLayer(),
|
||||
Obx(
|
||||
() => indexController.routePointLenght > 0
|
||||
? PolylineLayer(
|
||||
BaseLayer(),
|
||||
Obx(() =>
|
||||
indexController.routePointLenght > 0 ?
|
||||
PolylineLayer(
|
||||
polylines: [
|
||||
Polyline(
|
||||
points: getPoints()!,
|
||||
strokeWidth: 6.0,
|
||||
color: Colors.indigo),
|
||||
color: Colors.indigo
|
||||
),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
|
||||
:
|
||||
Container(),
|
||||
),
|
||||
CurrentLocationLayer(),
|
||||
MarkerLayer(markers: getMarkers()!),
|
||||
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,6 +1,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/auth_service.dart';
|
||||
@ -32,16 +33,16 @@ class DrawerPage extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child:
|
||||
indexController.currentUser.isEmpty ?
|
||||
Flexible(child: Text("drawer_title".tr, style: const TextStyle(color: Colors.black, fontSize: 20),))
|
||||
indexController.currentUser.length == 0 ?
|
||||
Flexible(child: Text("drawer_title".tr, style: TextStyle(color: Colors.black, fontSize: 20),))
|
||||
:
|
||||
Text(indexController.currentUser[0]['user']['email'], style: const TextStyle(color: Colors.black, fontSize: 20),),
|
||||
Text(indexController.currentUser[0]['user']['email'], style: TextStyle(color: Colors.black, fontSize: 20),),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
Obx(() =>
|
||||
indexController.currentUser.isEmpty ?
|
||||
indexController.currentUser.length == 0 ?
|
||||
ListTile(
|
||||
leading: const Icon(Icons.login),
|
||||
title: Text("login".tr),
|
||||
@ -54,11 +55,11 @@ class DrawerPage extends StatelessWidget {
|
||||
title: Text("logout".tr),
|
||||
onTap: (){
|
||||
indexController.logout();
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
},
|
||||
)
|
||||
),
|
||||
indexController.currentUser.isNotEmpty ?
|
||||
indexController.currentUser.length > 0 ?
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
title: Text("change_password".tr),
|
||||
@ -66,8 +67,8 @@ class DrawerPage extends StatelessWidget {
|
||||
Get.toNamed(AppPages.CHANGE_PASSWORD);
|
||||
},
|
||||
) :
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
indexController.currentUser.isEmpty ?
|
||||
Container(width: 0, height: 0,),
|
||||
indexController.currentUser.length == 0 ?
|
||||
ListTile(
|
||||
leading: const Icon(Icons.person),
|
||||
title: Text("sign_up".tr),
|
||||
@ -75,8 +76,8 @@ class DrawerPage extends StatelessWidget {
|
||||
Get.toNamed(AppPages.REGISTER);
|
||||
},
|
||||
) :
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
indexController.currentUser.isNotEmpty ?
|
||||
Container(width: 0, height: 0,),
|
||||
indexController.currentUser.length > 0 ?
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete_forever),
|
||||
title: Text("delete_account".tr),
|
||||
@ -91,7 +92,7 @@ class DrawerPage extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
) :
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
Container(width: 0, height: 0,),
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.person),
|
||||
// title: Text("profile".tr),
|
||||
@ -107,7 +108,7 @@ class DrawerPage extends StatelessWidget {
|
||||
// title: Text("point_rank".tr),
|
||||
// onTap: (){},
|
||||
// ),
|
||||
indexController.currentUser.isNotEmpty ?
|
||||
indexController.currentUser.length > 0 ?
|
||||
ListTile(
|
||||
leading: const Icon(Icons.featured_video),
|
||||
title: Text("rog_web".tr),
|
||||
@ -115,7 +116,7 @@ class DrawerPage extends StatelessWidget {
|
||||
_launchURL("https://www.gifuai.net/?page_id=17397");
|
||||
},
|
||||
) :
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
Container(width: 0, height: 0,),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.privacy_tip),
|
||||
title: Text("privacy".tr),
|
||||
|
||||
@ -1,76 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
|
||||
class HistoryPage extends StatefulWidget {
|
||||
const HistoryPage({super.key});
|
||||
|
||||
@override
|
||||
State<HistoryPage> createState() => _HistoryPageState();
|
||||
}
|
||||
|
||||
class _HistoryPageState extends State<HistoryPage> {
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("History"),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: db.getDestinations(),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<Destination>> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occurred',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
} else if (snapshot.hasData) {
|
||||
final dests = snapshot.data;
|
||||
if (dests!.length > 0) {
|
||||
print("----- history -----");
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 150,
|
||||
child: Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: dests.length,
|
||||
itemBuilder: (ctx, index) {
|
||||
return ListTile(
|
||||
title: Text(dests[index].name ?? ""),
|
||||
subtitle:
|
||||
Text(dests[index].address ?? ""),
|
||||
leading: dests[0].photos != null
|
||||
? Container(width: 100, height: 100, child: Image.file(File(dests[0].photos!)))
|
||||
: Container(),
|
||||
);
|
||||
}),
|
||||
));
|
||||
} else {
|
||||
return Center(child: Text("No checkin yet"));
|
||||
}
|
||||
}
|
||||
} else if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
return Container();
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,6 @@ import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/search/search_page.dart';
|
||||
|
||||
class HomePage extends GetView{
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class IndexBinding extends Bindings {
|
||||
|
||||
@ -20,7 +20,6 @@ import 'package:rogapp/services/cat_service.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
import 'package:rogapp/services/perfecture_service.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class IndexController extends GetxController {
|
||||
List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
|
||||
@ -40,8 +39,6 @@ class IndexController extends GetxController {
|
||||
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
||||
var routePointLenght = 0.obs;
|
||||
|
||||
double current_lat = 0.0, current_lon = 0.0;
|
||||
|
||||
var is_loading = false.obs;
|
||||
|
||||
var is_mapController_loaded = false.obs;
|
||||
@ -52,8 +49,6 @@ class IndexController extends GetxController {
|
||||
MapController mapController = MapController();
|
||||
MapController rogMapController = MapController();
|
||||
|
||||
String? userToken;
|
||||
|
||||
var mode = 0.obs;
|
||||
|
||||
// master mode, rog or selection
|
||||
@ -122,12 +117,11 @@ class IndexController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
|
||||
|
||||
if(perfectures.isEmpty){
|
||||
if(perfectures.length == 0){
|
||||
PerfectureService.loadPerfectures().then((value){
|
||||
perfectures.add(value);
|
||||
loadAreaFor("9");
|
||||
@ -137,6 +131,7 @@ class IndexController extends GetxController {
|
||||
}
|
||||
|
||||
_connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@ -194,25 +189,48 @@ List<LatLng> getLocationsList(){
|
||||
}
|
||||
|
||||
|
||||
void login(String email, String password, BuildContext context) {
|
||||
AuthService.login(email, password).then((value) {
|
||||
print("------- logged in user details ######## $value ###### --------");
|
||||
if (value.isNotEmpty) {
|
||||
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);
|
||||
print("--------- user details login ----- $value");
|
||||
changeUser(value);
|
||||
} else {
|
||||
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: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -220,7 +238,7 @@ List<LatLng> getLocationsList(){
|
||||
String _token = currentUser[0]['token'];
|
||||
//print("------- change password ######## ${currentUser[0]['token']} ###### --------");
|
||||
AuthService.changePassword(oldpassword, newpassword, _token).then((value){
|
||||
print("------- change password ######## $value ###### --------");
|
||||
print("------- change password ######## ${value} ###### --------");
|
||||
if(value.isNotEmpty){
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
@ -234,9 +252,9 @@ List<LatLng> getLocationsList(){
|
||||
Get.snackbar(
|
||||
'failed'.tr,
|
||||
'password_change_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,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -251,7 +269,9 @@ List<LatLng> getLocationsList(){
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.deleteAllDestinations().then((value){
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
if(destinationController != null){
|
||||
destinationController.PopulateDestinations();
|
||||
}
|
||||
});
|
||||
currentUser.clear();
|
||||
cats.clear();
|
||||
@ -271,9 +291,9 @@ List<LatLng> getLocationsList(){
|
||||
Get.snackbar(
|
||||
'failed'.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,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -282,13 +302,13 @@ List<LatLng> getLocationsList(){
|
||||
}
|
||||
|
||||
void makeAction(BuildContext context){
|
||||
int userId = currentUser[0]["user"]["id"] as int;
|
||||
int locationId = currentFeature[0].properties!["location_id"] as int;
|
||||
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(userId > 0){
|
||||
ActionService.makeAction(userId, locationId, wanttogo, like, checkin).then((value){
|
||||
if(user_id > 0){
|
||||
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){
|
||||
});
|
||||
}
|
||||
|
||||
@ -296,7 +316,7 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
String getCatText(){
|
||||
String _cat = 'all'.tr;
|
||||
if(currentUser.isNotEmpty){
|
||||
if(currentUser.length > 0){
|
||||
Map<String, dynamic> _urs = currentUser[0];
|
||||
print('-- is_rogaining :-- ${_urs['user']['is_rogaining']} ------');
|
||||
if(_urs['user']['is_rogaining'] == true){
|
||||
@ -311,8 +331,8 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
void loadCatsv2(){
|
||||
dynamic initVal = {'category':getCatText()};
|
||||
LatLngBounds bounds = mapController.bounds!;
|
||||
if(bounds.southWest != null && bounds.northEast != null ){
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) {
|
||||
cats.clear();
|
||||
cats.add(initVal);
|
||||
@ -327,8 +347,8 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
void loadCatForCity(String city){
|
||||
dynamic initVal = {'category':getCatText()};
|
||||
LatLngBounds bounds = mapController.bounds!;
|
||||
if(bounds.southWest != null && bounds.northEast != null ){
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
CatService.loadCatByCity(city).then((value) {
|
||||
cats.clear();
|
||||
cats.add(initVal);
|
||||
@ -373,12 +393,12 @@ List<LatLng> getLocationsList(){
|
||||
}
|
||||
|
||||
void loadUserDetails(){
|
||||
if(currentUser.isNotEmpty){
|
||||
int userId = currentUser[0]["user"]["id"] as int;
|
||||
AuthService.UserDetails(userId).then((value){
|
||||
print("--------- user details ----- $value");
|
||||
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;
|
||||
bool paid = value![0]["paid"] as bool;
|
||||
if(paid){
|
||||
loadCustomAreas();
|
||||
}
|
||||
@ -387,63 +407,11 @@ List<LatLng> getLocationsList(){
|
||||
}
|
||||
}
|
||||
|
||||
void saveToDevice(String val) async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString("user_token", val);
|
||||
}
|
||||
|
||||
void changeUser(Map<String, dynamic> value, {bool replace = true}) {
|
||||
print("---- change user to ${value} -----");
|
||||
currentUser.clear();
|
||||
currentUser.add(value);
|
||||
if(replace){
|
||||
saveToDevice(currentUser[0]["token"]);
|
||||
}
|
||||
is_loading.value = false;
|
||||
loadUserDetails();
|
||||
loadLocationsBound();
|
||||
cats.clear();
|
||||
if (currentFeature.isNotEmpty) {
|
||||
getAction();
|
||||
}
|
||||
|
||||
if (currentUser.isNotEmpty) {
|
||||
rog_mode.value = 0;
|
||||
} else {
|
||||
rog_mode.value = 1;
|
||||
}
|
||||
|
||||
if (rog_mode.value == 1) {
|
||||
switchPage(AppPages.TRAVEL);
|
||||
} else {
|
||||
switchPage(AppPages.INITIAL);
|
||||
}
|
||||
//Get.toNamed(AppPages.INITIAL);
|
||||
}
|
||||
|
||||
loadUserDetailsForToken(String token) async {
|
||||
AuthService.userForToken(token).then((value) {
|
||||
print("----token val-- $value ------");
|
||||
if(value![0]["user"].isEmpty){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
return;
|
||||
}
|
||||
changeUser(value[0], replace:false);
|
||||
print("--------- user details ----- $value");
|
||||
// if (value != null && value.isNotEmpty) {
|
||||
// bool paid = value[0]["paid"] as bool;
|
||||
// if (paid) {
|
||||
// loadCustomAreas();
|
||||
// }
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void loadCustomAreas(){
|
||||
customAreas.clear();
|
||||
PerfectureService.loadCustomAreas().then((value){
|
||||
print("--- loading custom areas $value");
|
||||
print("--- loading custom areas ${value}");
|
||||
customAreas.add(value);
|
||||
});
|
||||
}
|
||||
@ -461,7 +429,7 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
String getSubInitialVal(){
|
||||
int min = 0;
|
||||
if(subPerfs.isNotEmpty){
|
||||
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;
|
||||
@ -501,16 +469,16 @@ List<LatLng> getLocationsList(){
|
||||
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
print("----- $customarea");
|
||||
print("----- ${customarea}");
|
||||
LocationService.loadCustomLocations(customarea, cat).then((value){
|
||||
locations.clear();
|
||||
locations.add(value!);
|
||||
List<LatLng> locs = getLocationsList();
|
||||
LatLngBounds bounds = boundsFromLatLngList(locs);
|
||||
mapController.fitBounds(bounds);
|
||||
mapController!.fitBounds(bounds);
|
||||
setBound(bounds);
|
||||
Future.delayed(const Duration(microseconds: 400), () {
|
||||
mapController.fitBounds(bounds);
|
||||
Future.delayed(Duration(microseconds: 400), () {
|
||||
mapController!.fitBounds(bounds);
|
||||
});
|
||||
|
||||
});
|
||||
@ -525,33 +493,33 @@ List<LatLng> getLocationsList(){
|
||||
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
LatLngBounds bounds = mapController.bounds!;
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
currentBound.clear();
|
||||
currentBound.add(bounds);
|
||||
//print(currentCat);
|
||||
if(bounds.southWest != null && bounds.northEast != null ){
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){
|
||||
//print("---value length ------ ${value!.collection.length}");
|
||||
if(value == null){
|
||||
return;
|
||||
}
|
||||
if(value.collection.isEmpty){
|
||||
if(value != null && value.collection.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),
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
showPopup = false;
|
||||
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
||||
}
|
||||
if(value.collection.isNotEmpty){
|
||||
if(value != null && value.collection.isNotEmpty){
|
||||
//print("---- added---");
|
||||
locations.add(value);
|
||||
loadCatsv2();
|
||||
@ -572,7 +540,7 @@ List<LatLng> getLocationsList(){
|
||||
LatLng lat1 = LatLng(value![1], value[0]);
|
||||
LatLng lat2 = LatLng(value[3], value[2]);
|
||||
LatLngBounds bound = LatLngBounds(lat1, lat2);
|
||||
mapController.fitBounds(bound);
|
||||
mapController!.fitBounds(bound);
|
||||
setBound(bound);
|
||||
});
|
||||
|
||||
@ -586,7 +554,7 @@ List<LatLng> getLocationsList(){
|
||||
LatLng lat1 = LatLng(value![1], value[0]);
|
||||
LatLng lat2 = LatLng(value[3], value[2]);
|
||||
LatLngBounds bound = LatLngBounds(lat1, lat2);
|
||||
mapController.fitBounds(bound);
|
||||
mapController!.fitBounds(bound);
|
||||
setBound(bound);
|
||||
});
|
||||
|
||||
@ -616,7 +584,7 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
|
||||
GeoJsonFeature? getFeatureForLatLong(double lat, double long){
|
||||
if(locations.isNotEmpty){
|
||||
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){
|
||||
@ -624,26 +592,25 @@ List<LatLng> getLocationsList(){
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void getAction(){
|
||||
//print(currentUser[0]["user"]["id"]);
|
||||
//print(currentFeature[0].properties!["location_id"]);
|
||||
if(currentUser.isEmpty){
|
||||
if(currentUser.length == 0){
|
||||
return;
|
||||
}
|
||||
int userId = currentUser[0]["user"]["id"] as int;
|
||||
int user_id = currentUser[0]["user"]["id"] as int;
|
||||
print("---- loc id ${currentFeature[0].properties}");
|
||||
int locationId = currentFeature[0].properties!["location_id"] as int;
|
||||
ActionService.userAction(userId, locationId).then((value){
|
||||
print("------$value");
|
||||
if(value != null && value.isNotEmpty){
|
||||
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": userId, "location": locationId, "wanttogo": false, "like": false, "checkin": false}];
|
||||
List<dynamic> initval = [{"user": user_id, "location": location_id, "wanttogo": false, "like": false, "checkin": false}];
|
||||
currentAction.clear();
|
||||
currentAction.add(initval);
|
||||
}
|
||||
@ -663,15 +630,15 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
if(currentFeature.isNotEmpty){
|
||||
if(currentFeature.length > 0){
|
||||
currentFeature.clear();
|
||||
}
|
||||
if(i >= locations[0].collection.length - 1 ){
|
||||
currentFeature.add(locations[0].collection[0]);
|
||||
currentFeature.add(locations[0].collection[0] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i + 1]);
|
||||
currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
}
|
||||
@ -696,15 +663,15 @@ List<LatLng> getLocationsList(){
|
||||
|
||||
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
|
||||
|
||||
if(currentFeature.isNotEmpty){
|
||||
if(currentFeature.length > 0){
|
||||
currentFeature.clear();
|
||||
}
|
||||
if(i == 0 ){
|
||||
currentFeature.add(locations[0].collection[locations[0].collection.length -1]);
|
||||
currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i - 1]);
|
||||
currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,51 +1,48 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
import 'package:rogapp/widgets/cat_widget.dart';
|
||||
import 'package:rogapp/widgets/list_widget.dart';
|
||||
import 'package:rogapp/widgets/map_widget.dart';
|
||||
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
|
||||
class IndexPage extends GetView<IndexController> {
|
||||
IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
onWillPop: () async {
|
||||
indexController.switchPage(AppPages.INITIAL);
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
drawer: DrawerPage(),
|
||||
//drawer: const DrawerPage(),
|
||||
appBar: AppBar(
|
||||
// automaticallyImplyLeading: false,
|
||||
// leading: IconButton(
|
||||
// icon: Icon(Icons.arrow_back_ios),
|
||||
// onPressed: (){
|
||||
// indexController.switchPage(AppPages.TRAVEL);
|
||||
// },
|
||||
// ),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
onPressed: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
},
|
||||
),
|
||||
//automaticallyImplyLeading: false,
|
||||
title: Text("add_location".tr),
|
||||
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: () {
|
||||
onTap: (){
|
||||
Get.toNamed(AppPages.SEARCH);
|
||||
},
|
||||
child: Container(
|
||||
@ -54,10 +51,9 @@ class IndexPage extends GetView<IndexController> {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(Icons.search),
|
||||
),
|
||||
child: const Center(child: Icon(Icons.search),),
|
||||
),
|
||||
),
|
||||
//CatWidget(indexController: indexController,),
|
||||
@ -68,57 +64,49 @@ class IndexPage extends GetView<IndexController> {
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child:
|
||||
Obx(() => destinationController.is_gps_selected == true
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 10.0, top: 4.0, bottom: 4.0),
|
||||
Obx(() =>
|
||||
destinationController.is_gps_selected == true ?
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child: const Image(
|
||||
image: AssetImage(
|
||||
'assets/images/route3_off.png'),
|
||||
width: 35,
|
||||
height: 35,
|
||||
child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,),
|
||||
onTap: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
},
|
||||
),
|
||||
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);
|
||||
},
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child: const Image(
|
||||
image: AssetImage(
|
||||
'assets/images/route2_on.png'),
|
||||
width: 35,
|
||||
height: 35,
|
||||
)
|
||||
),
|
||||
onTap: () {
|
||||
//indexController.switchPage(AppPages.TRAVEL);
|
||||
},
|
||||
),
|
||||
))),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () {
|
||||
onPressed: (){
|
||||
indexController.toggleMode();
|
||||
if (indexController.currentCat.isNotEmpty) {
|
||||
if(indexController.currentCat.isNotEmpty){
|
||||
print(indexController.currentCat[0].toString());
|
||||
}
|
||||
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: Obx(
|
||||
() => indexController.mode == 0
|
||||
? const Image(image: AssetImage('assets/images/list2.png'))
|
||||
: const Image(image: AssetImage('assets/images/map.png')),
|
||||
child: Obx(() =>
|
||||
indexController.mode == 0 ?
|
||||
Image(image: AssetImage('assets/images/list2.png'))
|
||||
:
|
||||
Image(image: AssetImage('assets/images/map.png')),
|
||||
),
|
||||
elevation: 4.0,
|
||||
),
|
||||
@ -173,15 +161,18 @@ class IndexPage extends GetView<IndexController> {
|
||||
// ),
|
||||
// ),
|
||||
Expanded(
|
||||
child: Obx(
|
||||
() => indexController.mode == 0
|
||||
? MapWidget()
|
||||
: const ListWidget(),
|
||||
))
|
||||
child: Obx(() =>
|
||||
indexController.mode == 0 ?
|
||||
MapWidget() :
|
||||
ListWidget(),
|
||||
)
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,18 +17,18 @@ class _LandingPageState extends State<LandingPage> {
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
||||
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
"こんにちは!",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
|
||||
),
|
||||
const SizedBox(height: 30,),
|
||||
SizedBox(height: 30,),
|
||||
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@ -38,11 +38,11 @@ class _LandingPageState extends State<LandingPage> {
|
||||
),
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height/3,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg'))
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20.0,),
|
||||
SizedBox(height: 20.0,),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
@ -51,18 +51,18 @@ class _LandingPageState extends State<LandingPage> {
|
||||
},
|
||||
color: Colors.indigoAccent[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
side: const BorderSide(
|
||||
side: BorderSide(
|
||||
color: Colors.black,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const Text("ログイン",style: TextStyle(
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15.0,),
|
||||
SizedBox(height: 15.0,),
|
||||
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
@ -74,7 +74,7 @@ class _LandingPageState extends State<LandingPage> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const Text("サインアップ",style: TextStyle(
|
||||
child: Text("サインアップ",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,
|
||||
|
||||
),),
|
||||
|
||||
@ -7,8 +7,8 @@ class LoadingPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
alignment: Alignment.topCenter,
|
||||
margin: const EdgeInsets.only(top: 20),
|
||||
child: const CircularProgressIndicator(
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
child: CircularProgressIndicator(
|
||||
value: 0.8,
|
||||
)
|
||||
);
|
||||
|
||||
@ -11,8 +11,6 @@ class LoginPage extends StatelessWidget {
|
||||
TextEditingController emailController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
|
||||
LoginPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -24,11 +22,11 @@ class LoginPage extends StatelessWidget {
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body:
|
||||
indexController.currentUser.isEmpty ?
|
||||
SizedBox(
|
||||
indexController.currentUser.length == 0 ?
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@ -39,16 +37,16 @@ class LoginPage extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height/6,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
SizedBox(height: 5,),
|
||||
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
@ -59,9 +57,9 @@ class LoginPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 3,left: 3),
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
@ -76,7 +74,7 @@ class LoginPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const CircularProgressIndicator(),
|
||||
child: CircularProgressIndicator(),
|
||||
) :
|
||||
Column(
|
||||
children: [
|
||||
@ -88,9 +86,9 @@ class LoginPage extends StatelessWidget {
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"email_and_password_required".tr,
|
||||
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -103,12 +101,12 @@ class LoginPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const Text("ログイン",style: TextStyle(
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5.0,),
|
||||
SizedBox(height: 5.0,),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:40,
|
||||
@ -119,12 +117,12 @@ class LoginPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("sign_up".tr,style: const TextStyle(
|
||||
child: Text("sign_up".tr,style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2.0,),
|
||||
SizedBox(height: 2.0,),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:40,
|
||||
@ -135,7 +133,7 @@ class LoginPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("cancel".tr,style: const TextStyle(
|
||||
child: Text("cancel".tr,style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
@ -146,14 +144,14 @@ class LoginPage extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
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(
|
||||
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),),
|
||||
),
|
||||
@ -166,7 +164,7 @@ class LoginPage extends StatelessWidget {
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text("app_developed_by_gifu_dx".tr, style: const TextStyle(
|
||||
child: Text("app_developed_by_gifu_dx".tr, style: TextStyle(
|
||||
overflow: TextOverflow.ellipsis, fontSize: 10.0
|
||||
),),
|
||||
),
|
||||
@ -184,7 +182,7 @@ class LoginPage extends StatelessWidget {
|
||||
onPressed: (){
|
||||
indexController.currentUser.clear();
|
||||
},
|
||||
child: const Text("Already Logged in, Click to logout"),
|
||||
child: Text("Already Logged in, Click to logout"),
|
||||
),
|
||||
)
|
||||
,
|
||||
@ -196,17 +194,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:const TextStyle(
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
const SizedBox(height: 5,),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
@ -218,7 +216,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30.0,)
|
||||
SizedBox(height: 30.0,)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -22,11 +22,11 @@ class LoginPopupPage extends StatelessWidget {
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body:
|
||||
indexController.currentUser.isEmpty ?
|
||||
SizedBox(
|
||||
indexController.currentUser.length == 0 ?
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@ -37,16 +37,16 @@ class LoginPopupPage extends StatelessWidget {
|
||||
children: [
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height/5,
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5,),
|
||||
SizedBox(height: 5,),
|
||||
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
@ -57,9 +57,9 @@ class LoginPopupPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 3,left: 3),
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
@ -74,7 +74,7 @@ class LoginPopupPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const CircularProgressIndicator(),
|
||||
child: CircularProgressIndicator(),
|
||||
) :
|
||||
Column(
|
||||
children: [
|
||||
@ -86,9 +86,9 @@ class LoginPopupPage extends StatelessWidget {
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"email_and_password_required".tr,
|
||||
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -101,12 +101,12 @@ class LoginPopupPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: const Text("ログイン",style: TextStyle(
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 19.0,),
|
||||
SizedBox(height: 19.0,),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:50,
|
||||
@ -117,12 +117,12 @@ class LoginPopupPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("sign_up".tr,style: const TextStyle(
|
||||
child: Text("sign_up".tr,style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 19.0,),
|
||||
SizedBox(height: 19.0,),
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:50,
|
||||
@ -133,7 +133,7 @@ class LoginPopupPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("cancel".tr,style: const TextStyle(
|
||||
child: Text("cancel".tr,style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
@ -144,14 +144,14 @@ class LoginPopupPage extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
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(
|
||||
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle(
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),),
|
||||
),
|
||||
@ -169,7 +169,7 @@ class LoginPopupPage extends StatelessWidget {
|
||||
onPressed: (){
|
||||
indexController.currentUser.clear();
|
||||
},
|
||||
child: const Text("Already Logged in, Click to logout"),
|
||||
child: Text("Already Logged in, Click to logout"),
|
||||
),
|
||||
)
|
||||
,
|
||||
@ -181,17 +181,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:const TextStyle(
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
const SizedBox(height: 5,),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
@ -203,7 +203,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30.0,)
|
||||
SizedBox(height: 30.0,)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -11,7 +11,7 @@ class MainPerfPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Select Main Perfecture"),
|
||||
title: Text("Select Main Perfecture"),
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: indexController.perfectures.length,
|
||||
@ -19,7 +19,7 @@ class MainPerfPage extends StatelessWidget {
|
||||
return ListTile(
|
||||
onTap: (){
|
||||
indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
|
||||
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController);
|
||||
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!);
|
||||
Get.back();
|
||||
},
|
||||
title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'dart:io';
|
||||
|
||||
class PermissionHandlerScreen extends StatefulWidget {
|
||||
const PermissionHandlerScreen({Key? key}) : super(key: key);
|
||||
const PermissionHandlerScreen({super.key});
|
||||
|
||||
@override
|
||||
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
|
||||
@ -13,201 +14,220 @@ class PermissionHandlerScreen extends StatefulWidget {
|
||||
|
||||
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: const SingleChildScrollView(
|
||||
child: ListBody(
|
||||
children: <Widget>[
|
||||
Text( 'このアプリでは、位置情報の収集を行います。'),
|
||||
Text( 'このアプリでは、開始時点で位置情報を収集します。'),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: const Text('わかった'),
|
||||
onPressed: () {
|
||||
//Navigator.of(context).pop();
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
void initState(){
|
||||
super.initState();
|
||||
|
||||
//permissionServiceCall();
|
||||
_checkPermissions();
|
||||
}
|
||||
|
||||
Future<PermissionStatus> checkLocationPermission() async {
|
||||
return await Permission.location.status;
|
||||
}
|
||||
|
||||
permissionServiceCall() async {
|
||||
await permissionServices().then(
|
||||
(value) {
|
||||
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.
|
||||
void _checkPermissions() async {
|
||||
// You can ask for multiple permissions at once.
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
Permission.location,
|
||||
|
||||
//add more permission to request here.
|
||||
Permission.camera,
|
||||
].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 */
|
||||
}
|
||||
}
|
||||
bool isCameraGranted = statuses[Permission.camera]!.isGranted;
|
||||
bool isLocationGranted = statuses[Permission.location]!.isGranted;
|
||||
|
||||
if (!isCameraGranted || !isLocationGranted) {
|
||||
bool isCameraPermanentlyDenied = statuses[Permission.camera]!.isPermanentlyDenied;
|
||||
bool isLocationPermanentlyDenied = statuses[Permission.location]!.isPermanentlyDenied;
|
||||
|
||||
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 {
|
||||
if (statuses[Permission.location]!.isDenied) {
|
||||
permissionServiceCall();
|
||||
// ask permissions again
|
||||
_checkPermissions();
|
||||
}
|
||||
} else {
|
||||
Get.toNamed(AppPages.INITIAL);
|
||||
}
|
||||
|
||||
/*{Permission.camera: PermissionStatus.granted, Permission.storage: PermissionStatus.granted}*/
|
||||
return statuses;
|
||||
}
|
||||
|
||||
|
||||
requestPermission() async {
|
||||
PermissionStatus permission = await Permission.location.status;
|
||||
if(permission == PermissionStatus.permanentlyDenied){
|
||||
showPermanentAlert(context);
|
||||
}else{
|
||||
PermissionStatus newPermission = await Permission.location.request();
|
||||
//showAlert(context);
|
||||
|
||||
if (newPermission != PermissionStatus.granted) {
|
||||
// If permission not granted, handle the issue in your own way
|
||||
exit(0);
|
||||
}
|
||||
else{
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
}
|
||||
}
|
||||
|
||||
// if (permission != PermissionStatus.granted) {
|
||||
|
||||
// }
|
||||
// If permission is granted or already was granted
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var status = Permission.location.status.then((value){
|
||||
if(value.isGranted == false){
|
||||
showAlert(context);
|
||||
//requestPermission() ? Get.toNamed(AppPages.TRAVEL) : exit(0);
|
||||
//Future.delayed(Duration.zero, () => showAlert(context));
|
||||
}
|
||||
else if(value.isPermanentlyDenied){
|
||||
|
||||
}
|
||||
else {
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
}
|
||||
});
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
child: const Text(""),
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: Text('Checking permissions...'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showPermanentAlert(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();
|
||||
permissionServiceCall();
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
//permissionServiceCall();
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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,4 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/foundation/key.dart';
|
||||
import 'package:flutter/src/widgets/container.dart';
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
|
||||
class ProgressPage extends StatelessWidget {
|
||||
const ProgressPage({Key? key}) : super(key: key);
|
||||
@ -7,7 +10,7 @@ class ProgressPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
child: const Center(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
|
||||
@ -13,8 +13,6 @@ class RegisterPage extends StatelessWidget {
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
TextEditingController confirmPasswordController = TextEditingController();
|
||||
|
||||
RegisterPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -26,11 +24,11 @@ class RegisterPage extends StatelessWidget {
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
@ -41,20 +39,20 @@ class RegisterPage extends StatelessWidget {
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
const Text ("サインアップ", style: TextStyle(
|
||||
Text ("サインアップ", style: TextStyle(
|
||||
fontSize: 30,
|
||||
fontWeight: FontWeight.bold,
|
||||
),),
|
||||
const SizedBox(height: 20,),
|
||||
SizedBox(height: 20,),
|
||||
Text("アカウントを作成し、無料です",style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey[700],
|
||||
),),
|
||||
const SizedBox(height: 30,)
|
||||
SizedBox(height: 30,)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
@ -66,12 +64,12 @@ class RegisterPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40),
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 3,left: 3),
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
border: const Border(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.black),
|
||||
top: BorderSide(color: Colors.black),
|
||||
right: BorderSide(color: Colors.black),
|
||||
@ -86,9 +84,9 @@ class RegisterPage extends StatelessWidget {
|
||||
Get.snackbar(
|
||||
"No match",
|
||||
"Passwords does not match",
|
||||
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -97,9 +95,9 @@ class RegisterPage extends StatelessWidget {
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"email_and_password_required".tr,
|
||||
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: const Duration(milliseconds: 800),
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
@ -112,23 +110,23 @@ class RegisterPage extends StatelessWidget {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("sign_up".tr,style: const TextStyle(
|
||||
child: Text("sign_up".tr,style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,
|
||||
|
||||
),),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20,),
|
||||
SizedBox(height: 20,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
||||
Flexible(child: Text("すでにアカウントをお持ちですか?")),
|
||||
TextButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
child: const Text("ログイン",style: TextStyle(
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18
|
||||
),),
|
||||
@ -151,17 +149,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:const TextStyle(
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
const SizedBox(height: 5,),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
@ -173,7 +171,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30,)
|
||||
SizedBox(height: 30,)
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class SearchBarController extends GetxController {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
@ -12,16 +13,14 @@ class SearchPage extends StatelessWidget {
|
||||
SearchBarController searchController = Get.find<SearchBarController>();
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
Image getImage(int index) {
|
||||
if (searchController.searchResults[index].properties!["photos"] == null ||
|
||||
searchController.searchResults[index].properties!["photos"] == "") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
Image getImage(int index){
|
||||
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(
|
||||
image: NetworkImage(
|
||||
searchController.searchResults[index].properties!["photos"]),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
image: NetworkImage(searchController.searchResults[index].properties!["photos"]),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
@ -35,66 +34,41 @@ class SearchPage extends StatelessWidget {
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
onPressed:(){
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.arrow_back_ios_new,
|
||||
color: Colors.black,
|
||||
)),
|
||||
centerTitle: true,
|
||||
//title: const CupertinoSearchTextField(),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: TypeAheadField(
|
||||
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
|
||||
title: TypeAheadField(
|
||||
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
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
suggestionsCallback: (pattern) async {
|
||||
return searchController.searchResults.where(
|
||||
(GeoJsonFeature element) => element.properties!["location_name"]
|
||||
.toString()
|
||||
.contains(pattern));
|
||||
suggestionsCallback: (pattern) async{
|
||||
return searchController.searchResults.where((GeoJsonFeature element) => element.properties!["location_name"].toString().contains(pattern));
|
||||
//return await
|
||||
},
|
||||
itemBuilder: (context, GeoJsonFeature suggestion) {
|
||||
itemBuilder: (context, GeoJsonFeature suggestion){
|
||||
return ListTile(
|
||||
title: Text(suggestion.properties!["location_name"]),
|
||||
subtitle: suggestion.properties!["category"] != null
|
||||
? Text(suggestion.properties!["category"])
|
||||
: const Text(""),
|
||||
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
|
||||
//leading: getImage(index),
|
||||
);
|
||||
},
|
||||
onSuggestionSelected: (GeoJsonFeature suggestion) {
|
||||
onSuggestionSelected: (GeoJsonFeature suggestion){
|
||||
indexController.currentFeature.clear();
|
||||
indexController.currentFeature.add(suggestion);
|
||||
Get.back();
|
||||
showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder: ((context) => BottomSheetNew()));
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
},
|
||||
),
|
||||
//title: const CupertinoSearchTextField(),
|
||||
|
||||
),
|
||||
//body:
|
||||
// Obx(() =>
|
||||
// ListView.builder(
|
||||
// itemCount: searchController.searchResults.length,
|
||||
|
||||
@ -11,7 +11,7 @@ class SubPerfPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Select Sub Perfecture"),
|
||||
title: Text("Select Sub Perfecture"),
|
||||
),
|
||||
body: ListView.builder(
|
||||
itemCount: indexController.subPerfs.length,
|
||||
|
||||
@ -6,8 +6,6 @@ import 'package:rogapp/pages/changepassword/change_password_page.dart';
|
||||
import 'package:rogapp/pages/city/city_page.dart';
|
||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
||||
import 'package:rogapp/pages/history/history_page.dart';
|
||||
import 'package:rogapp/pages/home/home_binding.dart';
|
||||
import 'package:rogapp/pages/home/home_page.dart';
|
||||
|
||||
import 'package:rogapp/pages/index/index_page.dart';
|
||||
@ -21,14 +19,23 @@ import 'package:rogapp/pages/register/register_page.dart';
|
||||
import 'package:rogapp/pages/search/search_binding.dart';
|
||||
import 'package:rogapp/pages/search/search_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_page.dart';
|
||||
|
||||
import '../screens/home/home_binding.dart';
|
||||
|
||||
|
||||
part 'app_routes.dart';
|
||||
|
||||
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
|
||||
static const INITIAL = Routes.INDEX;
|
||||
// ignore: constant_identifier_names
|
||||
@ -49,7 +56,6 @@ class AppPages {
|
||||
static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD;
|
||||
static const CAMERA_PAGE = Routes.CAMERA_PAGE;
|
||||
static const PROGRESS = Routes.PROGRESS;
|
||||
static const HISTORY = Routes.HISTORY;
|
||||
|
||||
static final routes = [
|
||||
// GetPage(
|
||||
@ -62,6 +68,20 @@ class AppPages {
|
||||
// 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(
|
||||
name: Routes.INDEX,
|
||||
page: () => IndexPage(),
|
||||
@ -74,7 +94,7 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.LANDING,
|
||||
page: () => const LandingPage(),
|
||||
page: () => LandingPage(),
|
||||
//binding: SpaBinding(),
|
||||
),
|
||||
GetPage(
|
||||
@ -94,7 +114,7 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.LOADING,
|
||||
page: () => const LoadingPage(),
|
||||
page: () => LoadingPage(),
|
||||
//binding: DestinationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
@ -104,12 +124,12 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.HOME,
|
||||
page: () => const HomePage(),
|
||||
page: () => HomePage(),
|
||||
binding: HomeBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.PERMISSION,
|
||||
page: () => const PermissionHandlerScreen(),
|
||||
page: () => PermissionHandlerScreen(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.SEARCH,
|
||||
@ -126,11 +146,11 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.CITY,
|
||||
page: () => const CityPage(),
|
||||
page: () => CityPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.CATEOGORY,
|
||||
page: () => const CategoryPage(),
|
||||
page: () => CategoryPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.CHANGE_PASSWORD,
|
||||
@ -142,11 +162,7 @@ class AppPages {
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.PROGRESS,
|
||||
page: () => const ProgressPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routes.HISTORY,
|
||||
page: () => const HistoryPage(),
|
||||
page: () => ProgressPage(),
|
||||
)
|
||||
];
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
part of 'app_pages.dart';
|
||||
|
||||
abstract class Routes {
|
||||
static const S_HOME = '/s_home';
|
||||
static const S_LOGIN = '/s_login';
|
||||
static const S_REGISTER = '/s_register';
|
||||
// Main Menu Route
|
||||
// static const HOME = '/';
|
||||
// static const MAP = '/map';
|
||||
@ -24,5 +27,4 @@ abstract class Routes {
|
||||
static const CHANGE_PASSWORD = '/change_password';
|
||||
static const CAMERA_PAGE = '/camera_page';
|
||||
static const PROGRESS = '/progress';
|
||||
static const HISTORY = '/history';
|
||||
}
|
||||
|
||||
36
lib/screens/auth/common/uis/auth_text_field.dart
Normal file
36
lib/screens/auth/common/uis/auth_text_field.dart
Normal file
@ -0,0 +1,36 @@
|
||||
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,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
30
lib/screens/auth/common/uis/rounded_small_button.dart
Normal file
30
lib/screens/auth/common/uis/rounded_small_button.dart
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
45
lib/screens/auth/controller/auth_controller.dart
Normal file
45
lib/screens/auth/controller/auth_controller.dart
Normal file
@ -0,0 +1,45 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
0
lib/screens/auth/views/login/login_binding.dart
Normal file
0
lib/screens/auth/views/login/login_binding.dart
Normal file
5
lib/screens/auth/views/login/login_controller.dart
Normal file
5
lib/screens/auth/views/login/login_controller.dart
Normal file
@ -0,0 +1,5 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LoginController extends GetxController{
|
||||
|
||||
}
|
||||
75
lib/screens/auth/views/login/login_screen.dart
Normal file
75
lib/screens/auth/views/login/login_screen.dart
Normal file
@ -0,0 +1,75 @@
|
||||
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);
|
||||
},
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
10
lib/screens/auth/views/register/register_screen.dart
Normal file
10
lib/screens/auth/views/register/register_screen.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class RegisterScreen extends StatelessWidget {
|
||||
const RegisterScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
12
lib/screens/home/home_binding.dart
Normal file
12
lib/screens/home/home_binding.dart
Normal file
@ -0,0 +1,12 @@
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
124
lib/screens/home/home_controller.dart
Normal file
124
lib/screens/home/home_controller.dart
Normal file
@ -0,0 +1,124 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
183
lib/screens/home/home_screen.dart
Normal file
183
lib/screens/home/home_screen.dart
Normal file
@ -0,0 +1,183 @@
|
||||
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()),
|
||||
],
|
||||
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
318
lib/screens/home/location_controller.dart
Normal file
318
lib/screens/home/location_controller.dart
Normal file
@ -0,0 +1,318 @@
|
||||
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){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -5,14 +5,13 @@ import 'package:rogapp/utils/const.dart';
|
||||
|
||||
class ActionService{
|
||||
|
||||
static Future<Map<String, dynamic>> makeAction(int userId, int locationId, bool wanttogo, bool like, bool checkin) async {
|
||||
print("----- action is ---- $like-- $wanttogo-- $checkin");
|
||||
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}");
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/makeaction/?user_id=$userId&location_id=$locationId&wanttogo=$wanttogo&like=$like&checkin=$checkin";
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||
//String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
|
||||
print('++++++++$url');
|
||||
print("url is ------ $url");
|
||||
print('@@@@@@+++ action_service MAKEACTION - GET, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -27,11 +26,11 @@ class ActionService{
|
||||
}
|
||||
|
||||
|
||||
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 = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/useraction/?user_id=$userId&location_id=$locationId';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||
print('@@@@@@+++ action_service USERACTION - GET, @@@@@@ ${url}');
|
||||
//String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -8,14 +8,14 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async {
|
||||
Map<String, dynamic> changePassword = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/change-password/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/change-password/';
|
||||
print('@@@@@@+++ auth_service CHANGE PASSWORD - PUT with old_password : ${oldpassword} new_password : ${newpassword}, @@@@@@ ${url}');
|
||||
final http.Response response = await http.put(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token $token'
|
||||
'Authorization': 'Token ${token}'
|
||||
},
|
||||
body: jsonEncode(<String, String>{
|
||||
'old_password': oldpassword,
|
||||
@ -31,11 +31,11 @@ class AuthService{
|
||||
|
||||
|
||||
static Future<Map<String, dynamic>> login(String email, String password) async {
|
||||
print("------- in logged email $email pwd $password ###### --------");
|
||||
//print("------- in logged email ${email} pwd ${password} ###### --------");
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/login/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/login/';
|
||||
print('@@@@@@+++ auth_service LOGIN - POST with email : ${email} password : ${password}, @@@@@@ ${url}');
|
||||
//String url = 'http://localhost:8100/api/login/';
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
@ -57,9 +57,9 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> register(String email, String password) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/register/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/register/';
|
||||
print('@@@@@@+++ auth_service REGISTER - POST with email : ${email} password : ${password}, @@@@@@ ${url}');
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -70,7 +70,7 @@ class AuthService{
|
||||
'password': password
|
||||
}),
|
||||
);
|
||||
print(response.body);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
@ -79,14 +79,14 @@ class AuthService{
|
||||
|
||||
static Future<Map<String, dynamic>> deleteUser(String token) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/delete-account/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/delete-account/';
|
||||
print('@@@@@@+++ auth_service DELETE USER - GET with Authorization : Token ${token}, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token $token'
|
||||
'Authorization': 'Token ${token}'
|
||||
}
|
||||
);
|
||||
|
||||
@ -99,10 +99,9 @@ class AuthService{
|
||||
|
||||
static Future<List<dynamic>?> UserDetails(int userid) async {
|
||||
List<dynamic> cats = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/userdetials?user_id=$userid';
|
||||
print('++++++++$url');
|
||||
print("---- UserDetails url is $url");
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/userdetials?user_id=${userid}';
|
||||
print('@@@@@@+++ auth_service USER DETAILS - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -118,26 +117,6 @@ class AuthService{
|
||||
|
||||
|
||||
|
||||
static Future<List<dynamic>?> userForToken(String token) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/user/';
|
||||
print('++++++++$url');
|
||||
print("---- UserDetails url is $url");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token $token'
|
||||
},
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
print("--- eeeeee $cats ----");
|
||||
}
|
||||
return [{"user":cats}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../utils/const.dart';
|
||||
@ -8,9 +9,9 @@ class CatService{
|
||||
|
||||
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 = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/cats/?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
print('@@@@@@+++ cat_service LOADCATS - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -27,9 +28,9 @@ class CatService{
|
||||
|
||||
static Future<List<dynamic>?> loadCatByCity(String cityname)async {
|
||||
List<dynamic> cats = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/catbycity/?$cityname';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/catbycity/?${cityname}';
|
||||
print('@@@@@@+++ cat_service CHANGE PASSWORD - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -11,11 +11,11 @@ import '../utils/const.dart';
|
||||
|
||||
class DestinationService{
|
||||
|
||||
static Future<List<dynamic>> getDestinations(int userId) async {
|
||||
static Future<List<dynamic>> getDestinations(int user_id) async {
|
||||
List<dynamic> cats = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/destinations/?user_id=$userId";
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/destinations/?user_id=${user_id}";
|
||||
print('@@@@@@+++ destination_service GETDESTINATIONS - GET, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -29,11 +29,11 @@ class DestinationService{
|
||||
return cats;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> deleteDestination(int destId) async {
|
||||
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/delete_destination/?dest_id=$destId";
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
|
||||
print('@@@@@@+++ destination_service DELETEDESTINATION - GET, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -44,15 +44,15 @@ class DestinationService{
|
||||
if (response.statusCode == 200) {
|
||||
cats = json.decode(utf8.decode(response.bodyBytes));
|
||||
}
|
||||
print("####### ---- $cats");
|
||||
print("####### ---- ${cats}");
|
||||
return cats;
|
||||
}
|
||||
|
||||
static Future<int> updateOrder(int actionId, int order, String dir) async {
|
||||
static Future<int> updateOrder(int action_id, int order, String dir) async {
|
||||
int cats = 0;
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = "$serverUrl/api/updateorder/?user_action_id=$actionId&order=$order&dir=$dir";
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
|
||||
print('@@@@@@+++ destination_service UPDATEORDER - GET, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -69,7 +69,7 @@ class DestinationService{
|
||||
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations, Map<String, dynamic> mtx) async{
|
||||
PolylinePoints polylinePoints = PolylinePoints();
|
||||
|
||||
if(destinations.isEmpty){
|
||||
if(destinations.length <= 0){
|
||||
return [];
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ class DestinationService{
|
||||
|
||||
int j = 0;
|
||||
|
||||
PolylineWayPoint pwp = PolylineWayPoint(location: "$la,$ln", stopOver: false);
|
||||
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: false);
|
||||
|
||||
|
||||
//print("----- UUUUUU ${pwp}");
|
||||
@ -101,13 +101,13 @@ class DestinationService{
|
||||
}
|
||||
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
int travMode = destinationController.travelMode.value;
|
||||
int trav_mode = destinationController.travelMode.value;
|
||||
String _mode = "WALKING";
|
||||
if(travMode == 1){
|
||||
if(trav_mode == 1){
|
||||
//_mode = TravelMode.driving;
|
||||
_mode = "DRIVING";
|
||||
}
|
||||
else if(travMode == 2) {
|
||||
else if(trav_mode == 2) {
|
||||
//_mode = TravelMode.transit;
|
||||
_mode = "TRANSIT";
|
||||
}
|
||||
|
||||
@ -2,10 +2,14 @@ import 'dart:io';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/model/rog.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/screens/auth/controller/auth_controller.dart';
|
||||
import 'package:rogapp/screens/home/home_controller.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:sqflite/sqlite_api.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import '../utils/const.dart';
|
||||
@ -29,23 +33,25 @@ class ExternalService {
|
||||
|
||||
Future<Map<String, dynamic>> StartRogaining() async {
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
//final IndexController indexController = Get.find<IndexController>();
|
||||
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 -----");
|
||||
String _team = indexController.currentUser[0]["user"]['team_name'];
|
||||
String _team = authController.authList[0].user.teamName;
|
||||
//print("--- _team : ${_team}-----");
|
||||
String _event_code = indexController.currentUser[0]["user"]["event_code"];
|
||||
String _event_code = authController.authList[0].user.eventCode;
|
||||
|
||||
if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
|
||||
if(homeController.connectionStatusName != "wifi" && homeController.connectionStatusName != "mobile"){
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
Rog _rog = Rog(
|
||||
id:1,
|
||||
team_name: _team,
|
||||
event_code : _event_code,
|
||||
user_id: userId,
|
||||
user_id: user_id,
|
||||
cp_number: -1,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: null,
|
||||
@ -54,8 +60,8 @@ class ExternalService {
|
||||
db.insertRogaining(_rog);
|
||||
}
|
||||
else {
|
||||
String url = 'https://rogaining.sumasen.net/gifuroge/start_from_rogapp';
|
||||
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(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -71,17 +77,15 @@ class ExternalService {
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
||||
print('----_res : $_res ----');
|
||||
print('----_res : ${_res} ----');
|
||||
}
|
||||
}
|
||||
return _res;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> makeCheckpoint(int userId, String token, String checkinTime, String teamname, int cp, String eventcode, String imageurl) async {
|
||||
//print("--cpcp-- ${cp}");
|
||||
Future<Map<String, dynamic>> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async {
|
||||
Map<String, dynamic> _res = {};
|
||||
String url = 'https://rogaining.sumasen.net/gifuroge/checkin_from_rogapp';
|
||||
print('++++++++$url');
|
||||
String url = 'https://natnats.mobilous.com/checkin_from_rogapp';
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
if(imageurl != null){
|
||||
@ -92,7 +96,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: teamname,
|
||||
event_code : eventcode,
|
||||
user_id: userId,
|
||||
user_id: user_id,
|
||||
cp_number: cp,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: imageurl,
|
||||
@ -101,34 +105,36 @@ class ExternalService {
|
||||
db.insertRogaining(_rog);
|
||||
}
|
||||
else {
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url1 = "$serverUrl/api/checkinimage/";
|
||||
final im1Bytes = File(imageurl).readAsBytesSync();
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url1 = "${server_url}/api/checkinimage/";
|
||||
final im1Bytes = File(imageurl!).readAsBytesSync();
|
||||
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}');
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse(url1),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token $token'
|
||||
'Authorization': 'Token ${token}'
|
||||
},
|
||||
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||
body: jsonEncode(<String, String>{
|
||||
'user' : userId.toString(),
|
||||
'user' : user_id.toString(),
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'checkinimage' : im1_64,
|
||||
'checkintime' : checkinTime,
|
||||
'checkintime' : checkin_time,
|
||||
'cp_number' : cp.toString()
|
||||
}),
|
||||
);
|
||||
|
||||
_res = json.decode(utf8.decode(response.bodyBytes));
|
||||
|
||||
print("-----@@@@@ $_res -----");
|
||||
print("-----@@@@@ ${_res} -----");
|
||||
|
||||
if(response.statusCode == 201){
|
||||
//print('---- toekn is ${token} -----');
|
||||
String imgUrl = _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net');
|
||||
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>{
|
||||
@ -141,17 +147,10 @@ class ExternalService {
|
||||
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
|
||||
}),
|
||||
);
|
||||
var vv = 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-- $vv");
|
||||
print("--- checnin response ${response2.statusCode}----");
|
||||
if (response2.statusCode == 200) {
|
||||
_res = json.decode(utf8.decode(response2.bodyBytes));
|
||||
print('----checkin res _res : $_res ----');
|
||||
print('----checkin res _res : ${_res} ----');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,7 +162,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: teamname,
|
||||
event_code : eventcode,
|
||||
user_id: userId,
|
||||
user_id: user_id,
|
||||
cp_number: cp,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: null,
|
||||
@ -172,6 +171,7 @@ class ExternalService {
|
||||
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>{
|
||||
@ -184,17 +184,10 @@ class ExternalService {
|
||||
'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('----checkin res _res : ${_res} ----');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +195,7 @@ class ExternalService {
|
||||
}
|
||||
|
||||
|
||||
Future<Map<String, dynamic>> makeGoal(int userId, String token, String teamname, String image, String goalTime, String eventcode) async {
|
||||
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>();
|
||||
@ -214,7 +207,7 @@ class ExternalService {
|
||||
id:1,
|
||||
team_name: teamname,
|
||||
event_code : eventcode,
|
||||
user_id: userId,
|
||||
user_id: user_id,
|
||||
cp_number: -1,
|
||||
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
|
||||
image: image,
|
||||
@ -223,34 +216,33 @@ class ExternalService {
|
||||
db.insertRogaining(_rog);
|
||||
// }
|
||||
// else{
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url1 = "$serverUrl/api/goalimage/";
|
||||
final im1Bytes = File(image).readAsBytesSync();
|
||||
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'
|
||||
'Authorization': 'Token ${token}'
|
||||
},
|
||||
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
|
||||
body: jsonEncode(<String, String>{
|
||||
'user' : userId.toString(),
|
||||
'user' : user_id.toString(),
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'goaltime' : goalTime,
|
||||
'goaltime' : goal_time,
|
||||
'goalimage' : im1_64,
|
||||
'cp_number' : "-1"
|
||||
}),
|
||||
);
|
||||
|
||||
String url = 'https://rogaining.sumasen.net/gifuroge/goal_from_rogapp';
|
||||
print('++++++++$url');
|
||||
String url = 'https://natnats.mobilous.com/goal_from_rogapp';
|
||||
if (response.statusCode == 201) {
|
||||
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
|
||||
print('----_res : $_res ----');
|
||||
print('---- image url ${_res["goalimage"]} ----');
|
||||
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(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -259,20 +251,12 @@ class ExternalService {
|
||||
body: jsonEncode(<String, String>{
|
||||
'team_name': teamname,
|
||||
'event_code': eventcode,
|
||||
'goal_time' : goalTime,
|
||||
'goal_time' : goal_time,
|
||||
'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 --------');
|
||||
print('----- response2 is ${response2} --------');
|
||||
if (response2.statusCode == 200) {
|
||||
_res2 = json.decode(utf8.decode(response2.bodyBytes));
|
||||
}
|
||||
@ -285,8 +269,8 @@ class ExternalService {
|
||||
|
||||
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');
|
||||
String url = "https://natnats.mobilous.com/check_event_code?zekken_number=${teamcode}&password=${password}";
|
||||
print('@@@@@@+++ external_service USEREVENTCODE - GET, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -8,9 +8,9 @@ class LocationLineService{
|
||||
static Future<GeoJsonFeature?> loadLocationLines() async {
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/location_line/';
|
||||
print('++++++++$url');
|
||||
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',
|
||||
|
||||
@ -9,9 +9,9 @@ class LocationPolygonervice{
|
||||
final geo = GeoJson();
|
||||
GeoJsonFeature? fs;
|
||||
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/location_polygon/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location_polygon/';
|
||||
print('++++++++${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -37,17 +37,17 @@ class LocationService{
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
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 = '$serverUrl/api/inperf/?rog=$r&perf=' + perfecture + '&cat=' + cat;
|
||||
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
else {
|
||||
url = '$serverUrl/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -55,13 +55,13 @@ class LocationService{
|
||||
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;
|
||||
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture;
|
||||
}
|
||||
else {
|
||||
url = '$serverUrl/api/inperf/?perf=' + perfecture;
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||
}
|
||||
}
|
||||
print('++++++++$url');
|
||||
print('@@@@@@+++ location_service LOADLOCATIONFOR - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -78,13 +78,13 @@ class LocationService{
|
||||
|
||||
static Future<List<dynamic>?> getLocationsExt(String token) async {
|
||||
List<dynamic> ext = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/locsext/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/locsext/';
|
||||
print('@@@@@@+++ location_service GETLOCATIONEXT - POST, with token : ${token} @@@@@@ ${url}');
|
||||
final response = await http.post(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Authorization': 'Token $token'
|
||||
'Authorization': 'Token ${token}'
|
||||
},
|
||||
body: jsonEncode(<String, String>{
|
||||
'token': token,
|
||||
@ -102,16 +102,16 @@ class LocationService{
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
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 = '$serverUrl/api/insubperf?rog=$r&subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '$serverUrl/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -119,13 +119,13 @@ class LocationService{
|
||||
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/insubperf?rog=$r&subperf=' + subperfecture;
|
||||
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture;
|
||||
}
|
||||
else{
|
||||
url = '$serverUrl/api/insubperf?subperf=' + subperfecture;
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||
}
|
||||
}
|
||||
print('++++++++$url');
|
||||
print('@@@@@@+++ location_service LOADLOCATIONSUBFOR - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -145,16 +145,16 @@ class LocationService{
|
||||
print("-------- in location for bound -------------");
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
String url = "";
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
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 = '$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;
|
||||
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 = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4' '&cat=' + cat;
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -162,14 +162,14 @@ class LocationService{
|
||||
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 = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||
print("-------- requested user group ${grp} -------------");
|
||||
url = '${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 = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
}
|
||||
}
|
||||
print('++++++++$url');
|
||||
print('@@@@@@+++ location_service LOADLOCATIONSBOUNDS - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -200,17 +200,17 @@ class LocationService{
|
||||
if(cat == "-all-"){
|
||||
cat = "";
|
||||
}
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
print("loadCustomLocations url is ----- $cat");
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("loadCustomLocations url is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
|
||||
String r = _rog == true ? 'True': 'False';
|
||||
var grp = indexController.currentUser[0]['user']['event_code'];
|
||||
url = '$serverUrl/api/custom_area/?rog=$r&&cat=' + cat;
|
||||
url = '${server_url}/api/custom_area/?rog=${r}&&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
url = '$serverUrl/api/custom_area/?&cat=' + cat;
|
||||
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
||||
}
|
||||
}
|
||||
else{
|
||||
@ -218,13 +218,13 @@ class LocationService{
|
||||
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';
|
||||
url = '${server_url}/api/customarea?rog=${r}&name=${name}';
|
||||
}
|
||||
else{
|
||||
url = '$serverUrl/api/customarea?name=$name';
|
||||
url = '${server_url}/api/customarea?name=${name}';
|
||||
}
|
||||
}
|
||||
print('++++++++$url');
|
||||
print('@@@@@@+++ location_service LOADCUSTOMLOCATIONS - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -18,7 +18,7 @@ class MatrixService{
|
||||
int i = 0;
|
||||
for(Destination d in destinations){
|
||||
|
||||
print("---- getting matrix for $d ------------");
|
||||
print("---- getting matrix for ${d} ------------");
|
||||
|
||||
if(i==0){
|
||||
origin = "${d.lat}, ${d.lon}";
|
||||
@ -37,7 +37,7 @@ class MatrixService{
|
||||
i++;
|
||||
}
|
||||
|
||||
locs = "optimize:false|$locs";
|
||||
locs = "optimize:false|${locs}";
|
||||
|
||||
String _mode = "walking";
|
||||
switch (destinationController.travelMode.value) {
|
||||
@ -53,8 +53,8 @@ class MatrixService{
|
||||
}
|
||||
|
||||
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";
|
||||
print('++++++++$url');
|
||||
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
|
||||
print('@@@@@@+++ matrix_service GETDESTINATIONS - GET, @@@@@@ ${url}');
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
|
||||
@ -7,9 +7,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadPerfectures() async {
|
||||
List<dynamic> perfs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/perf_main/';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/perf_main/';
|
||||
print('@@@@@@+++ perfeture_service LOADPERFECTURES - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -25,9 +25,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
|
||||
List<dynamic> perfs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/subperfinmain/?area=' + area;
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/subperfinmain/?area=' + area;
|
||||
print('@@@@@@+++ perfeture_service LOADSUBPERFECTURES - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -44,9 +44,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> getMainPerfExt(String id) async {
|
||||
List<dynamic> perfs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/mainperfext/?perf=' + id;
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/mainperfext/?perf=' + id;
|
||||
print('@@@@@@+++ perfeture_service GETMAINPERFEXT - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -62,9 +62,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
|
||||
List<dynamic> perfs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/allgifuareas/?perf=' + perf;
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
|
||||
print('@@@@@@+++ perfeture_service LOADGIFUAREAS - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -80,9 +80,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> loadCustomAreas() async {
|
||||
List<dynamic> perfs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/customareanames';
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/customareanames';
|
||||
print('@@@@@@+++ perfeture_service LOADCUSTOMAREAS - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -99,9 +99,9 @@ class PerfectureService{
|
||||
|
||||
static Future<List<dynamic>?> getSubExt(String id) async {
|
||||
List<dynamic> perfs = [];
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/perfext/?sub_perf=' + id;
|
||||
print('++++++++$url');
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/perfext/?sub_perf=' + id;
|
||||
print('@@@@@@+++ perfeture_service GETSUBEXT - GET, @@@@@@ ${url}');
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
|
||||
@ -1,25 +1,26 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
|
||||
|
||||
class TrackingService {
|
||||
|
||||
static Future<Map<String, dynamic>> addTrack(String userId, double lat, double lon) async {
|
||||
static Future<Map<String, dynamic>> addTrack(String user_id, double lat, double lon) async {
|
||||
Map<String, dynamic> cats = {};
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
String url = '$serverUrl/api/track/';
|
||||
print('++++++++$url');
|
||||
final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}';
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/track/';
|
||||
final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}';
|
||||
print('@@@@@@+++ tracking_service ADDTRAACK - POST, with user_id : ${user_id} geom : ${geom} @@@@@@ ${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>{
|
||||
'user_id': userId,
|
||||
'user_id': user_id,
|
||||
'geom': geom
|
||||
}),
|
||||
);
|
||||
|
||||
17
lib/theme/app_theme.dart
Normal file
17
lib/theme/app_theme.dart
Normal file
@ -0,0 +1,17 @@
|
||||
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
|
||||
),
|
||||
);
|
||||
}
|
||||
10
lib/theme/pallete.dart
Normal file
10
lib/theme/pallete.dart
Normal file
@ -0,0 +1,10 @@
|
||||
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;
|
||||
}
|
||||
3
lib/theme/theme.dart
Normal file
3
lib/theme/theme.dart
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
export 'pallete.dart';
|
||||
export 'app_theme.dart';
|
||||
82
lib/utils/checkin_db_helper.dart
Normal file
82
lib/utils/checkin_db_helper.dart
Normal file
@ -0,0 +1,82 @@
|
||||
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]);
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:rogapp/model/Rogaining.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart';
|
||||
@ -85,14 +86,14 @@ class DatabaseHelper{
|
||||
var rog = await db.query('rog');
|
||||
List<Rog> roglist = rog.isNotEmpty ?
|
||||
rog.map((e) => Rog.fromMap(e)).toList() : [];
|
||||
print("--------- $rog");
|
||||
print("--------- ${rog}");
|
||||
return roglist;
|
||||
}
|
||||
|
||||
|
||||
Future<List<Rog>> getRogainingByLatLon(double lat, double lon) async {
|
||||
Database db = await instance.database;
|
||||
var rog = await db.query('rog', where: "lat = $lat and lon= $lon");
|
||||
var rog = await db.query('rog', where: "lat = ${lat} and lon= ${lon}");
|
||||
List<Rog> roglist = rog.isNotEmpty
|
||||
? rog.map((e) => Rog.fromMap(e)).toList() : [];
|
||||
return roglist;
|
||||
@ -100,12 +101,12 @@ class DatabaseHelper{
|
||||
|
||||
Future clearSelection() async {
|
||||
Database db = await instance.database;
|
||||
Map<String, dynamic> rowClear = {
|
||||
Map<String, dynamic> row_clear = {
|
||||
"selected": false
|
||||
};
|
||||
return await db.update(
|
||||
"destination",
|
||||
rowClear
|
||||
row_clear
|
||||
);
|
||||
}
|
||||
|
||||
@ -113,7 +114,7 @@ class DatabaseHelper{
|
||||
Database db = await instance.database;
|
||||
|
||||
bool val = !dest.selected!;
|
||||
Map<String, dynamic> rowTarget = {
|
||||
Map<String, dynamic> row_target = {
|
||||
"selected": val
|
||||
};
|
||||
|
||||
@ -121,7 +122,7 @@ class DatabaseHelper{
|
||||
|
||||
return await db.update(
|
||||
"destination",
|
||||
rowTarget,
|
||||
row_target,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [dest.location_id!]
|
||||
);
|
||||
@ -129,7 +130,7 @@ class DatabaseHelper{
|
||||
|
||||
Future<int> deleteRogaining(int id) async {
|
||||
Database db = await instance.database;
|
||||
var rog = await db.delete('rog', where: "id = $id");
|
||||
var rog = await db.delete('rog', where: "id = ${id}");
|
||||
int ret = rog > 0 ? rog : -1;
|
||||
|
||||
return ret;
|
||||
@ -144,8 +145,8 @@ class DatabaseHelper{
|
||||
|
||||
Future<bool>isRogAlreadyAvailable(int id) async{
|
||||
Database db = await instance.database;
|
||||
var rog = await db.query('rog', where: "id = $id");
|
||||
return rog.isNotEmpty ? true : false;
|
||||
var rog = await db.query('rog', where: "id = ${id}");
|
||||
return rog.length > 0 ? true : false;
|
||||
}
|
||||
|
||||
Future<int?>latestGoal() async{
|
||||
@ -156,16 +157,16 @@ class DatabaseHelper{
|
||||
|
||||
Future<int> insertRogaining(Rog rog) async {
|
||||
Database db = await instance.database;
|
||||
int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
|
||||
nextOrder = nextOrder ?? 0;
|
||||
nextOrder = nextOrder + 1;
|
||||
rog.id = nextOrder;
|
||||
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
|
||||
next_order = next_order==null ? 0 : next_order;
|
||||
next_order = next_order + 1;
|
||||
rog.id = next_order;
|
||||
int res = await db.insert(
|
||||
'rog',
|
||||
rog.toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||
);
|
||||
print("------ database helper insert $res-----------::::::::");
|
||||
print("------ database helper insert ${res}-----------::::::::");
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -175,13 +176,13 @@ class DatabaseHelper{
|
||||
var dest = await db.query('destination', orderBy: 'list_order');
|
||||
List<Destination> destList = dest.isNotEmpty ?
|
||||
dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
print("--------- $destList");
|
||||
print("--------- ${destList}");
|
||||
return destList;
|
||||
}
|
||||
|
||||
Future<List<Destination>> getDestinationById(int id) async {
|
||||
Database db = await instance.database;
|
||||
var rog = await db.query('destination', where: "location_id = $id");
|
||||
var rog = await db.query('destination', where: "location_id = ${id}");
|
||||
List<Destination> deslist = rog.isNotEmpty
|
||||
? rog.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
return deslist;
|
||||
@ -190,15 +191,15 @@ class DatabaseHelper{
|
||||
|
||||
Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.query('destination', where: "lat = $lat and lon= $lon", orderBy: 'list_order');
|
||||
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}", orderBy: 'list_order');
|
||||
List<Destination> destList = dest.isNotEmpty
|
||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
return destList;
|
||||
}
|
||||
|
||||
Future<int> deleteDestination(int locationId) async {
|
||||
Future<int> deleteDestination(int location_id) async {
|
||||
Database db = await instance.database;
|
||||
var dest = await db.delete('destination', where: "location_id = $locationId");
|
||||
var dest = await db.delete('destination', where: "location_id = ${location_id}");
|
||||
int ret = dest > 0 ? dest : -1;
|
||||
|
||||
//after deleting set correct order
|
||||
@ -211,19 +212,19 @@ class DatabaseHelper{
|
||||
Database db = await instance.database;
|
||||
var byOrder = await db.query('destination', orderBy: 'list_order');
|
||||
|
||||
List<Destination> desDb = byOrder.isNotEmpty
|
||||
List<Destination> des_db = byOrder.isNotEmpty
|
||||
? byOrder.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
int order = 1;
|
||||
for( Destination d in desDb){
|
||||
for( Destination d in des_db){
|
||||
|
||||
Map<String, dynamic> rowTarget = {
|
||||
Map<String, dynamic> row_target = {
|
||||
"list_order": order
|
||||
};
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
rowTarget,
|
||||
row_target,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [d.location_id]
|
||||
);
|
||||
@ -237,18 +238,18 @@ class DatabaseHelper{
|
||||
await db.delete('destination');
|
||||
}
|
||||
|
||||
Future<bool>isAlreadyAvailable(int locationId) async{
|
||||
Future<bool>isAlreadyAvailable(int location_id) async{
|
||||
Database db = await instance.database;
|
||||
var dest = await db.query('destination', where: "location_id = $locationId");
|
||||
return dest.isNotEmpty ? true : false;
|
||||
var dest = await db.query('destination', where: "location_id = ${location_id}");
|
||||
return dest.length > 0 ? true : false;
|
||||
}
|
||||
|
||||
Future<int> insertDestination(Destination dest) async {
|
||||
Database db = await instance.database;
|
||||
int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
|
||||
nextOrder = nextOrder ?? 0;
|
||||
nextOrder = nextOrder + 1;
|
||||
dest.list_order = nextOrder;
|
||||
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
|
||||
next_order = next_order==null ? 0 : next_order;
|
||||
next_order = next_order + 1;
|
||||
dest.list_order = next_order;
|
||||
int res = await db.insert(
|
||||
'destination',
|
||||
dest.toMap(),
|
||||
@ -277,23 +278,23 @@ class DatabaseHelper{
|
||||
var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}");
|
||||
var dest = await db.query('destination', where: "location_id = ${d.location_id}");
|
||||
|
||||
print("--- target in db is $target");
|
||||
print("--- destine in db is $dest");
|
||||
print("--- target in db is ${target}");
|
||||
print("--- destine in db is ${dest}");
|
||||
|
||||
if(target.isNotEmpty){
|
||||
|
||||
List<Destination> targetIndb = target.isNotEmpty
|
||||
List<Destination> target_indb = target.isNotEmpty
|
||||
? target.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
List<Destination> destIndb = dest.isNotEmpty
|
||||
List<Destination> dest_indb = dest.isNotEmpty
|
||||
? dest.map((e) => Destination.fromMap(e)).toList() : [];
|
||||
|
||||
Map<String, dynamic> rowTarget = {
|
||||
Map<String, dynamic> row_target = {
|
||||
"list_order": d.list_order
|
||||
};
|
||||
|
||||
Map<String, dynamic> rowDes = {
|
||||
"list_order": destIndb[0].list_order! + dir
|
||||
Map<String, dynamic> row_des = {
|
||||
"list_order": dest_indb[0].list_order! + dir
|
||||
};
|
||||
|
||||
// print("--- target destination is ${target_indb[0].location_id}");
|
||||
@ -301,16 +302,16 @@ class DatabaseHelper{
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
rowTarget,
|
||||
row_target,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [targetIndb[0].location_id]
|
||||
whereArgs: [target_indb[0]!.location_id]
|
||||
);
|
||||
|
||||
await db.update(
|
||||
"destination",
|
||||
rowDes,
|
||||
row_des,
|
||||
where: 'location_id = ?',
|
||||
whereArgs: [destIndb[0].location_id]
|
||||
whereArgs: [dest_indb[0]!.location_id]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
170
lib/utils/db_helper.dart
Normal file
170
lib/utils/db_helper.dart
Normal file
@ -0,0 +1,170 @@
|
||||
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]
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/model/location_response.dart';
|
||||
|
||||
class TextUtils{
|
||||
|
||||
@ -18,22 +19,25 @@ class TextUtils{
|
||||
}
|
||||
|
||||
|
||||
static String getDisplayText(Destination dp){
|
||||
static String getDisplayText(Feature 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.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.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, '')})";
|
||||
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, '')}";
|
||||
|
||||
@ -13,7 +13,7 @@ class BaseLayer extends StatelessWidget {
|
||||
FMTCTileProviderSettings(
|
||||
behavior: CacheBehavior.values
|
||||
.byName('cacheFirst'),
|
||||
cachedValidDuration: const Duration(
|
||||
cachedValidDuration: Duration(
|
||||
days: 14
|
||||
),
|
||||
),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,4 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
@ -12,11 +13,9 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
BottomSheetWidget({Key? key}) : super(key: key);
|
||||
|
||||
Image getImage(GeoJsonFeature? gf){
|
||||
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(
|
||||
@ -38,7 +37,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 5.0,),
|
||||
SizedBox(height: 5.0,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -48,18 +47,18 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: const EdgeInsets.all(14),
|
||||
shape: const CircleBorder(),
|
||||
padding: EdgeInsets.all(14),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() =>
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
@ -73,12 +72,12 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: const EdgeInsets.all(14),
|
||||
shape: const CircleBorder(),
|
||||
padding: EdgeInsets.all(14),
|
||||
shape: CircleBorder(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -106,59 +105,59 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("address".tr, style: const TextStyle(fontWeight: FontWeight.bold),)),
|
||||
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
|
||||
),
|
||||
const SizedBox(width: 12.0,),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0.0, height: 0,),
|
||||
): Container(width: 0.0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["phone"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("telephone".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
|
||||
const SizedBox(width: 12.0,),
|
||||
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0, height: 0,),
|
||||
): Container(width: 0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["email"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("email".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
|
||||
const SizedBox(width: 12.0,),
|
||||
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0, height: 0,),
|
||||
): Container(width: 0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["webcontents"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -166,8 +165,8 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text(
|
||||
"web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
|
||||
const SizedBox(width: 12.0,),
|
||||
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
@ -176,40 +175,40 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||
},
|
||||
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,),
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0.0, height: 0.0,),
|
||||
): Container(width: 0.0, height: 0.0,),
|
||||
indexController.currentFeature[0].properties!["videos"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("video".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
|
||||
const SizedBox(width: 12.0,),
|
||||
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
|
||||
SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
style: TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0.0, height: 0.0,),
|
||||
): Container(width: 0.0, height: 0.0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20.0,),
|
||||
SizedBox(height: 20.0,),
|
||||
Obx(() =>
|
||||
indexController.currentAction.isNotEmpty ?
|
||||
Row(
|
||||
@ -233,7 +232,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
indexController.currentAction[0][0]["wanttogo"] = true;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
@ -247,7 +246,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
indexController.currentAction[0][0]["wanttogo"] = false;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
@ -268,7 +267,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
indexController.currentAction[0][0]["like"] = true;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
@ -282,7 +281,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
indexController.currentAction[0][0]["like"] = false;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
@ -303,7 +302,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
|
||||
|
||||
:
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
Container(width: 0, height: 0,),
|
||||
indexController.rog_mode.value == 1 ?
|
||||
indexController.currentAction[0][0]["checkin"] == false ?
|
||||
Column(
|
||||
@ -312,7 +311,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: const Text("Image"), onPressed: (){
|
||||
child: Text("Image"), onPressed: (){
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
_picker.pickImage(source: ImageSource.camera).then((value){
|
||||
print("----- image---- ${value!.path}");
|
||||
@ -328,7 +327,7 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
indexController.currentAction[0][0]["checkin"] = true;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
@ -345,18 +344,18 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
indexController.currentAction[0][0]["checkin"] = false;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.favorite, color: Colors.red)
|
||||
|
||||
,
|
||||
):
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
Container(width: 0, height: 0,),
|
||||
],
|
||||
): Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -365,11 +364,11 @@ class BottomSheetWidget extends StatelessWidget {
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
child: const Flexible(child: Text("その他のオプションについてはログインしてください")))
|
||||
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
|
||||
],
|
||||
),
|
||||
),
|
||||
const Row(
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(height: 60.0,),
|
||||
],
|
||||
|
||||
@ -15,7 +15,7 @@ class BreadCrumbWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("------ map controller is $mapController------------");
|
||||
print("------ map controller is ${mapController}------------");
|
||||
return
|
||||
Obx(()=>
|
||||
indexController.perfectures.isNotEmpty && mapController != null ?
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/location_service.dart';
|
||||
|
||||
class CatWidget extends StatefulWidget {
|
||||
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
@ -6,47 +7,45 @@ import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:sqflite/sqlite_api.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
class DestinationWidget extends StatelessWidget {
|
||||
DestinationWidget({Key? key}) : super(key: key);
|
||||
DestinationWidget({ Key? key }) : super(key: key);
|
||||
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||
|
||||
Image getImage(int index) {
|
||||
if (destinationController.destinations[index].photos == null ||
|
||||
destinationController.destinations[index].photos == "") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
print(
|
||||
"------- image is ${destinationController.destinations[index].photos!}------");
|
||||
Image getImage(int index){
|
||||
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
print("------- image is ${destinationController.destinations[index].photos!}------");
|
||||
String _photo = destinationController.destinations[index].photos!;
|
||||
if (_photo.contains('http')) {
|
||||
return Image(
|
||||
image:
|
||||
NetworkImage(destinationController.destinations[index].photos!),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
} else {
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
|
||||
return Image(
|
||||
image: NetworkImage('$serverUrl/media/compressed/' +
|
||||
if(_photo.contains('http')){
|
||||
return Image(image: NetworkImage(
|
||||
destinationController.destinations[index].photos!),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
else {
|
||||
String server_url = ConstValues.currentServer();
|
||||
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
|
||||
return Image(image: NetworkImage(
|
||||
'${server_url}/media/compressed/' + destinationController.destinations[index].photos!),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,10 +63,10 @@ class DestinationWidget extends StatelessWidget {
|
||||
// }
|
||||
|
||||
void doDelete() {
|
||||
for (var element in destinationController.currentSelectedDestinations) {
|
||||
destinationController.currentSelectedDestinations.forEach((element) {
|
||||
destinationController.deleteDestination(element);
|
||||
destinationController.resetRogaining();
|
||||
}
|
||||
});
|
||||
// destinationController.destination_index_data.forEach((element) {
|
||||
// //print(element["index"]);
|
||||
// destinationController.deleteDestination(element["index"]);
|
||||
@ -76,40 +75,40 @@ class DestinationWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
void moveUp() {
|
||||
Destination? d;
|
||||
for (Destination ad in destinationController.destinations) {
|
||||
if (ad.selected == true) {
|
||||
Destination? d = null;
|
||||
for(Destination ad in destinationController.destinations){
|
||||
if(ad.selected == true){
|
||||
d = ad;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (d != null) {
|
||||
if(d != null){
|
||||
print("--- selected destination is ${d.list_order}");
|
||||
destinationController.makeOrder(d, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void moveDown() {
|
||||
Destination? d;
|
||||
for (Destination ad in destinationController.destinations) {
|
||||
if (ad.selected == true) {
|
||||
Destination? d = null;
|
||||
for(Destination ad in destinationController.destinations){
|
||||
if(ad.selected == true){
|
||||
d = ad;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (d != null) {
|
||||
if(d != null){
|
||||
print("--- selected destination is ${d.list_order}");
|
||||
destinationController.makeOrder(d, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void clearall() {
|
||||
void clearall(){
|
||||
Get.defaultDialog(
|
||||
title: "are_you_sure_want_to_delete_all".tr,
|
||||
middleText: "all_added_destination_will_be_deleted".tr,
|
||||
backgroundColor: Colors.blue.shade300,
|
||||
titleStyle: const TextStyle(color: Colors.white),
|
||||
middleTextStyle: const TextStyle(color: Colors.white),
|
||||
titleStyle: TextStyle(color: Colors.white),
|
||||
middleTextStyle: TextStyle(color: Colors.white),
|
||||
textConfirm: "confirm".tr,
|
||||
textCancel: "cancel".tr,
|
||||
cancelTextColor: Colors.white,
|
||||
@ -117,15 +116,16 @@ class DestinationWidget extends StatelessWidget {
|
||||
buttonColor: Colors.white,
|
||||
barrierDismissible: false,
|
||||
radius: 10,
|
||||
content: const Column(
|
||||
children: [],
|
||||
content: Column(
|
||||
children: [
|
||||
],
|
||||
),
|
||||
onConfirm: () {
|
||||
onConfirm: (){
|
||||
destinationController.deleteAllDestinations();
|
||||
Get.back();
|
||||
Get.snackbar(
|
||||
"deleted".tr, "all_destinations_are_deleted_successfully".tr);
|
||||
});
|
||||
Get.snackbar("deleted".tr, "all_destinations_are_deleted_successfully".tr);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void interChange() {
|
||||
@ -138,34 +138,33 @@ class DestinationWidget extends StatelessWidget {
|
||||
// });
|
||||
}
|
||||
|
||||
Future getIsLocationAvilable(int locationId) async {
|
||||
Future getIsLocationAvilable(int location_id) async {
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
return await db.isAlreadyAvailable(locationId);
|
||||
return await db.isAlreadyAvailable(location_id);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(
|
||||
"------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
|
||||
return Obx(() => Stack(
|
||||
print("------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
|
||||
return
|
||||
Obx(() =>
|
||||
Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 45.0),
|
||||
padding: const EdgeInsets.only(top:45.0),
|
||||
child: ListView.builder(
|
||||
itemCount: destinationController.destinationCount.value,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return TimelineTile(
|
||||
return
|
||||
TimelineTile(
|
||||
alignment: TimelineAlign.manual,
|
||||
lineXY: 0.2,
|
||||
isFirst: index == 0 ? true : false,
|
||||
indicatorStyle: IndicatorStyle(
|
||||
indicator: CircleAvatar(
|
||||
child: Text(
|
||||
destinationController.destinations[index].list_order
|
||||
.toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
child: Text(destinationController.destinations[index].list_order.toString(), style: TextStyle(color: Colors.white),),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
),
|
||||
@ -178,72 +177,50 @@ class DestinationWidget extends StatelessWidget {
|
||||
child: ListTile(
|
||||
onTap: () async {
|
||||
{
|
||||
Destination? fs =
|
||||
destinationController.destinations[index];
|
||||
print("----fsf-----$index");
|
||||
if (indexController
|
||||
.currentDestinationFeature.isNotEmpty) {
|
||||
indexController.currentDestinationFeature
|
||||
.clear();
|
||||
Destination? fs = destinationController.destinations[index];
|
||||
print("----fsf-----${index}");
|
||||
if(fs != null){
|
||||
|
||||
if(indexController.currentDestinationFeature.isNotEmpty) {
|
||||
indexController.currentDestinationFeature.clear();
|
||||
}
|
||||
indexController.currentDestinationFeature
|
||||
.add(fs);
|
||||
print(
|
||||
"--- ndexController.currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} ----");
|
||||
indexController.currentDestinationFeature.add(fs);
|
||||
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
|
||||
//indexController.getAction();
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
showModalBottomSheet(context: context, isScrollControlled: true,
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
builder: ((context) => BottomSheetNew()));
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
}
|
||||
};
|
||||
},
|
||||
onLongPress: () {
|
||||
destinationController.toggleSelection(
|
||||
destinationController.destinations[index]);
|
||||
onLongPress: (){
|
||||
destinationController.toggleSelection(destinationController.destinations[index]);
|
||||
},
|
||||
selectedTileColor: Colors.amberAccent,
|
||||
selected: destinationController
|
||||
.destinations[index].selected!,
|
||||
selected:destinationController.destinations[index].selected!,
|
||||
leading: getImage(index),
|
||||
title: Text(destinationController
|
||||
.destinations[index].name!),
|
||||
subtitle: Text(destinationController
|
||||
.destinations[index].category!),
|
||||
title: Text(destinationController.destinations[index].name!),
|
||||
subtitle: Text(destinationController.destinations[index].category!),
|
||||
),
|
||||
),
|
||||
),
|
||||
startChild: index > 0 &&
|
||||
destinationController.matrix["routes"][0]
|
||||
["legs"] !=
|
||||
null
|
||||
? Column(
|
||||
startChild:
|
||||
index > 0 && destinationController.matrix["routes"][0]["legs"] != null ?
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(destinationController.matrix["routes"][0]
|
||||
["legs"][index - 1]["distance"] !=
|
||||
null
|
||||
? destinationController.matrix["routes"][0]
|
||||
["legs"][index - 1]["distance"]
|
||||
["text"]
|
||||
.toString()
|
||||
: ''),
|
||||
Text(destinationController.matrix["routes"][0]
|
||||
["legs"][index - 1]["duration"] !=
|
||||
null
|
||||
? destinationController.matrix["routes"][0]
|
||||
["legs"][index - 1]["duration"]
|
||||
["text"]
|
||||
.toString()
|
||||
: '')
|
||||
Text(destinationController.matrix["routes"][0]["legs"][index -1]["distance"] != null ? destinationController.matrix["routes"][0]["legs"][index-1]["distance"]["text"].toString(): ''),
|
||||
Text(destinationController.matrix["routes"][0]["legs"][index -1]["duration"] != null ? destinationController.matrix["routes"][0]["legs"][index-1]["duration"]["text"].toString() : '')
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
):
|
||||
Container()
|
||||
,
|
||||
);
|
||||
}),
|
||||
|
||||
}
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
@ -252,7 +229,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
color: Colors.grey.withOpacity(0.3),
|
||||
spreadRadius: 5,
|
||||
blurRadius: 3,
|
||||
offset: const Offset(0, 7), // changes position of shadow
|
||||
offset: Offset(0, 7), // changes position of shadow
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -262,31 +239,22 @@ class DestinationWidget extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_forever),
|
||||
icon:Icon(Icons.delete_forever),
|
||||
//onPressed: (){doDelete();},
|
||||
onPressed: clearall,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.cancel),
|
||||
icon:Icon(Icons.cancel),
|
||||
//onPressed: (){doDelete();},
|
||||
onPressed: destinationController
|
||||
.currentSelectedDestinations.isNotEmpty
|
||||
? doDelete
|
||||
: null,
|
||||
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.move_up),
|
||||
onPressed: destinationController
|
||||
.currentSelectedDestinations.isNotEmpty
|
||||
? moveUp
|
||||
: null,
|
||||
icon:Icon(Icons.move_up),
|
||||
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveUp : null,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.move_down),
|
||||
onPressed: destinationController
|
||||
.currentSelectedDestinations.isNotEmpty
|
||||
? moveDown
|
||||
: null,
|
||||
icon:Icon(Icons.move_down),
|
||||
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveDown : null,
|
||||
),
|
||||
// IconButton(
|
||||
// icon:Icon(Icons.sync),
|
||||
@ -296,6 +264,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -4,106 +4,54 @@ 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/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class ListWidget extends StatefulWidget {
|
||||
const ListWidget({Key? key}) : super(key: key);
|
||||
class ListWidget extends StatelessWidget {
|
||||
ListWidget({ Key? key }) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ListWidget> createState() => _ListWidgetState();
|
||||
}
|
||||
|
||||
class _ListWidgetState extends State<ListWidget> {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
|
||||
Image getImage(int index) {
|
||||
if (indexController.locations[0].collection[index].properties!["photos"] ==
|
||||
null ||
|
||||
indexController.locations[0].collection[index].properties!["photos"] ==
|
||||
"") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
print("==== photo index is $index ===");
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
GeoJsonFeature<dynamic> gf =
|
||||
indexController.locations[0].collection[index];
|
||||
String _photo = gf.properties!["photos"];
|
||||
Image getImage(int index){
|
||||
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
print("==== photo index is ${index} ===");
|
||||
String server_url = ConstValues.currentServer();
|
||||
GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index];
|
||||
String _photo = gf!.properties!["photos"];
|
||||
return Image(
|
||||
image: NetworkImage('$serverUrl/media/compressed/' + _photo),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
image: NetworkImage(
|
||||
'${server_url}/media/compressed/' + _photo
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void changeCurrentFeature(GeoJsonFeature fs) {
|
||||
if (indexController.currentFeature.isNotEmpty) {
|
||||
void changeCurrentFeature(GeoJsonFeature fs){
|
||||
if(indexController.currentFeature.length > 0){
|
||||
indexController.currentFeature.clear();
|
||||
}
|
||||
indexController.currentFeature.add(fs);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Destination createDestination(GeoJsonFeature feature) {
|
||||
final props = feature.properties;
|
||||
GeoJsonMultiPoint _pt = feature.geometry;
|
||||
|
||||
return Destination(
|
||||
cp: props!['cp'],
|
||||
lat: _pt.geoSerie!.geoPoints.first.latitude,
|
||||
lon: _pt.geoSerie!.geoPoints.first.longitude,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> matrixDistance(int i) async {
|
||||
// Create two destinations directly from indexController.locations[0].collection
|
||||
Destination desCurr = Destination(
|
||||
lat: indexController.current_lat, lon: indexController.current_lon);
|
||||
//Destination dest1 = createDestination(indexController.locations[0].collection[0]);
|
||||
Destination dest2 =
|
||||
createDestination(indexController.locations[0].collection[i]);
|
||||
|
||||
// Get the distance between these two destinations
|
||||
final res = await MatrixService.getDestinations([desCurr, dest2]);
|
||||
|
||||
return res["routes"][0]["legs"][0]["distance"]["text"];
|
||||
//print("matrix result is ${i} : ${res["routes"][0]["legs"][0]["distance"]["text"]} ");
|
||||
}
|
||||
|
||||
Future<void> _pullRefresh() async {
|
||||
print("pull to refesh");
|
||||
indexController.locations[0].collection.sort((a, b) =>
|
||||
(a.properties!['cp'] as Comparable)
|
||||
.compareTo(b.properties!['cp'] as Comparable));
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
() => indexController.locations.isNotEmpty
|
||||
? RefreshIndicator(
|
||||
onRefresh: _pullRefresh,
|
||||
child: ListView.builder(
|
||||
return Obx(() =>
|
||||
indexController.locations.length > 0 ?
|
||||
ListView.builder(
|
||||
itemCount: indexController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index) {
|
||||
itemBuilder: (_, index){
|
||||
bool _is_found = false;
|
||||
for (Destination d in destinationController.destinations) {
|
||||
if (indexController.locations[0].collection[index]
|
||||
.properties!['location_id'] ==
|
||||
d.location_id) {
|
||||
for(Destination d in destinationController.destinations){
|
||||
if(indexController.locations[0].collection[index].properties!['location_id'] == d.location_id){
|
||||
_is_found = true;
|
||||
break;
|
||||
}
|
||||
@ -111,78 +59,26 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
selected: _is_found,
|
||||
|
||||
selectedTileColor: Colors.yellow.shade200,
|
||||
onTap: () {
|
||||
GeoJsonFeature gf =
|
||||
indexController.locations[0].collection[index];
|
||||
onTap: (){
|
||||
GeoJsonFeature gf = indexController.locations[0].collection[index];
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder: ((context) => BottomSheetNew()));
|
||||
builder:((context) => BottomSheetNew())
|
||||
);
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: indexController.locations[0].collection[index]
|
||||
.properties!['location_name'] !=
|
||||
null
|
||||
? Text(indexController.locations[0]
|
||||
.collection[index].properties!['location_name']
|
||||
.toString())
|
||||
: const Text(""),
|
||||
subtitle: indexController.locations[0].collection[index]
|
||||
.properties!['category'] !=
|
||||
null
|
||||
? Text(indexController.locations[0]
|
||||
.collection[index].properties!['category'])
|
||||
: const Text(""),
|
||||
trailing: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
indexController.locations[0].collection[index]
|
||||
.properties!['sub_loc_id'] !=
|
||||
null
|
||||
? Text(indexController
|
||||
.locations[0]
|
||||
.collection[index]
|
||||
.properties!['sub_loc_id'])
|
||||
: const Text(""),
|
||||
SizedBox(
|
||||
width: 100,
|
||||
child: FutureBuilder<String>(
|
||||
future: matrixDistance(index),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return const Text("-");
|
||||
} else {
|
||||
return Text(
|
||||
snapshot.data ?? '',
|
||||
style: const TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.bold),
|
||||
);
|
||||
}
|
||||
},
|
||||
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
|
||||
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
|
||||
trailing: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : Text(""),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const SizedBox(
|
||||
width: 0,
|
||||
height: 0,
|
||||
),
|
||||
) : Container(width: 0, height: 0,),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -3,26 +3,27 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
|
||||
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/text_util.dart';
|
||||
import 'package:rogapp/widgets/base_layer_widget.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
|
||||
class MapWidget extends StatelessWidget {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
|
||||
MapWidget({Key? key}) : super(key: key);
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
MapWidget({ Key? key}) : super(key: key);
|
||||
|
||||
StreamSubscription? subscription;
|
||||
|
||||
Widget getMarkerShape(GeoJsonFeature i, BuildContext context) {
|
||||
Widget getMarkerShape(GeoJsonFeature i, BuildContext context){
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
//print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
@ -31,28 +32,28 @@ class MapWidget extends StatelessWidget {
|
||||
children: [
|
||||
InkWell(
|
||||
onTap: () {
|
||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(
|
||||
p.geoSerie!.geoPoints[0].latitude,
|
||||
p.geoSerie!.geoPoints[0].longitude);
|
||||
print("------- fs $fs------");
|
||||
if (fs != null) {
|
||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
|
||||
print("------- fs ${fs}------");
|
||||
if(fs != null){
|
||||
indexController.currentFeature.clear();
|
||||
indexController.currentFeature.add(fs);
|
||||
//print("----- fs is ${fs.properties!['photos']}");
|
||||
indexController.getAction();
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
builder: ((context) => BottomSheetNew())
|
||||
builder:((context) => BottomSheetNew())
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
).whenComplete(() {
|
||||
).whenComplete((){
|
||||
destinationController.skip_gps = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
child: Container(
|
||||
height: 32,
|
||||
@ -61,146 +62,103 @@ class MapWidget extends StatelessWidget {
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.transparent,
|
||||
border: Border.all(
|
||||
color: i.properties!['buy_point'] > 0
|
||||
? Colors.blue
|
||||
: Colors.red,
|
||||
color: i.properties!['buy_point'] > 0 ? Colors.blue : Colors.red,
|
||||
width: 3,
|
||||
style: BorderStyle.solid)),
|
||||
style: BorderStyle.solid
|
||||
)
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.circle,
|
||||
size: 6.0,
|
||||
),
|
||||
i.properties!['cp'] == -1
|
||||
? Transform.rotate(
|
||||
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: const Icon(
|
||||
Icons.play_arrow_outlined,
|
||||
color: Colors.red,
|
||||
size: 70,
|
||||
))
|
||||
: Container(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
|
||||
Container(color: Colors.transparent,),
|
||||
],
|
||||
)),
|
||||
)
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: Text(TextUtils.getDisplayTextFeture(i),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
))),
|
||||
),
|
||||
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
List<LatLng>? getPoints() {
|
||||
print("##### --- route point ${indexController.routePoints.length}");
|
||||
List<LatLng> pts = [];
|
||||
for (PointLatLng p in indexController.routePoints) {
|
||||
LatLng l = LatLng(p.latitude, p.longitude);
|
||||
pts.add(l);
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(
|
||||
"---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||
|
||||
print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||
|
||||
final PopupController _popupController = PopupController();
|
||||
return Stack(
|
||||
children: [
|
||||
Obx(() => indexController.is_loading == true
|
||||
? const Padding(
|
||||
padding: EdgeInsets.only(top: 60.0),
|
||||
Obx(() =>
|
||||
indexController.is_loading == true ? Padding(
|
||||
padding: const EdgeInsets.only(top: 60.0),
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: FlutterMap(
|
||||
):
|
||||
FlutterMap(
|
||||
mapController: indexController.mapController,
|
||||
options: MapOptions(
|
||||
maxZoom: 18.4,
|
||||
onMapReady: () {
|
||||
maxZoom:18.4,
|
||||
onMapReady: (){
|
||||
indexController.is_mapController_loaded.value = true;
|
||||
subscription = indexController.mapController.mapEventStream
|
||||
.listen((MapEvent mapEvent) {
|
||||
subscription = indexController.mapController.mapEventStream.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// do something
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd &&
|
||||
indexController.currentUser.isEmpty) {
|
||||
if (mapEvent is MapEventMoveEnd && indexController.currentUser. length <= 0) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
indexController.loadLocationsBound();
|
||||
//indexController.rogMapController!.move(c.center, c.zoom);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
//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)
|
||||
]),
|
||||
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
|
||||
zoom: 1,
|
||||
interactiveFlags:
|
||||
InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
|
||||
onPositionChanged: (MapPosition pos, isvalue) {},
|
||||
onTap: (_, __) => _popupController
|
||||
onPositionChanged: (MapPosition pos, isvalue){
|
||||
|
||||
},
|
||||
onTap: (_, __) =>
|
||||
_popupController
|
||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||
),
|
||||
children: [
|
||||
const BaseLayer(),
|
||||
Obx(
|
||||
() => indexController.routePointLenght > 0
|
||||
? PolylineLayer(
|
||||
polylines: [
|
||||
Polyline(
|
||||
points: getPoints()!,
|
||||
strokeWidth: 6.0,
|
||||
color: Colors.indigo),
|
||||
],
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
BaseLayer(),
|
||||
CurrentLocationLayer(),
|
||||
indexController.locations.isNotEmpty &&
|
||||
indexController.locations[0].collection.isNotEmpty
|
||||
? MarkerLayer(
|
||||
markers:
|
||||
indexController.locations[0].collection.map((i) {
|
||||
indexController.locations.isNotEmpty && indexController.locations[0].collection.isNotEmpty ?
|
||||
MarkerLayer(
|
||||
markers:indexController.locations[0].collection.map((i) {
|
||||
print("i si ${i.properties!['location_id']}");
|
||||
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
GeoJsonMultiPoint p =
|
||||
i.geometry as GeoJsonMultiPoint;
|
||||
print(
|
||||
"lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
return Marker(
|
||||
anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
|
||||
height: 32.0,
|
||||
width: 120.0,
|
||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude,
|
||||
p.geoSerie!.geoPoints[0].longitude),
|
||||
builder: (ctx) {
|
||||
point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
|
||||
builder: (ctx){
|
||||
return getMarkerShape(i, context);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
)
|
||||
: const Center(child: CircularProgressIndicator()),
|
||||
:
|
||||
Center(child: CircularProgressIndicator())
|
||||
,
|
||||
],
|
||||
))
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/cat_widget.dart';
|
||||
|
||||
|
||||
class PerfectureWidget extends StatefulWidget {
|
||||
@ -165,9 +166,11 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
}
|
||||
setState(() {
|
||||
widget.indexController.locations.clear();
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.areaDropdownValue = newValue;
|
||||
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
|
||||
}
|
||||
});
|
||||
},
|
||||
items: getCustomArea(),
|
||||
@ -200,7 +203,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
) :
|
||||
const Text(""),
|
||||
//CatWidget(indexController: widget.indexController,),
|
||||
widget.indexController.cats.isNotEmpty ?
|
||||
widget.indexController.cats.length > 0 ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.getCatText(),
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
|
||||
734
pubspec.lock
734
pubspec.lock
File diff suppressed because it is too large
Load Diff
31
pubspec.yaml
31
pubspec.yaml
@ -15,10 +15,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
version: 1.0.16+16
|
||||
version: 1.0.12+12
|
||||
|
||||
environment:
|
||||
sdk: '>=3.1.0 <4.0.0'
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
@ -36,13 +36,13 @@ dependencies:
|
||||
cupertino_icons: ^1.0.2
|
||||
sqflite: ^2.0.1
|
||||
get: ^4.6.5
|
||||
flutter_map: ^4.0.0
|
||||
geolocator: ^9.0.2
|
||||
flutter_map: any
|
||||
geolocator: ^9.0.1
|
||||
permission_handler: ^10.0.0
|
||||
google_api_availability: ^5.0.0
|
||||
google_api_availability: ^3.0.1
|
||||
tuple: ^2.0.0
|
||||
latlong2: ^0.8.1
|
||||
positioned_tap_detector_2: ^1.0.4
|
||||
positioned_tap_detector: ^1.0.3
|
||||
transparent_image: ^2.0.0
|
||||
async: ^2.8.2
|
||||
vector_math: ^2.1.1
|
||||
@ -53,9 +53,9 @@ dependencies:
|
||||
path_provider: ^2.0.8
|
||||
flutter_map_location_marker: any
|
||||
flutter_map_marker_cluster: any
|
||||
material_design_icons_flutter: ^7.0.7296
|
||||
#google_fonts: ^2.1.1
|
||||
image_picker: ^1.0.4
|
||||
material_design_icons_flutter: ^5.0.6595
|
||||
google_fonts: ^2.1.1
|
||||
image_picker: ^0.8.4+4
|
||||
#geojson_vi: ^2.0.7
|
||||
geojson: ^1.0.0
|
||||
url_launcher: ^6.0.20
|
||||
@ -66,17 +66,16 @@ dependencies:
|
||||
flutter_polyline_points: ^1.0.0
|
||||
google_maps_webservice: ^0.0.19
|
||||
flutter_typeahead: ^4.0.0
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
flutter_launcher_icons: ^0.10.0
|
||||
rename: ^2.0.1
|
||||
circular_menu: ^2.0.1
|
||||
camera_camera: ^3.0.0-dev
|
||||
intl: ^0.18.1
|
||||
intl: ^0.17.0
|
||||
modal_bottom_sheet: ^3.0.0-pre
|
||||
connectivity_plus: ^4.0.2
|
||||
flutter_map_tile_caching: ^8.0.1
|
||||
connectivity_plus: ^3.0.2
|
||||
flutter_map_tile_caching: ^6.2.0
|
||||
shared_preferences: ^2.0.15
|
||||
gallery_saver: ^2.3.2
|
||||
|
||||
unicode: ^0.3.0
|
||||
|
||||
flutter_icons:
|
||||
android: true
|
||||
@ -93,7 +92,7 @@ dev_dependencies:
|
||||
# activated in the `analysis_options.yaml` file located at the root of your
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^2.0.3
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
@ -13,7 +13,7 @@ import 'package:rogapp/main.dart';
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget( const MyApp());
|
||||
await tester.pumpWidget( MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
|
||||
BIN
web/favicon.png
BIN
web/favicon.png
Binary file not shown.
|
Before Width: | Height: | Size: 917 B |
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
104
web/index.html
104
web/index.html
@ -1,104 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
If you are serving your web app in a path other than the root, change the
|
||||
href value below to reflect the base path you are serving from.
|
||||
|
||||
The path provided below has to start and end with a slash "/" in order for
|
||||
it to work correctly.
|
||||
|
||||
For more details:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
||||
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="rogapp">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
|
||||
<title>岐阜ナビ</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<!-- This script installs service_worker.js to provide PWA functionality to
|
||||
application. For more information, see:
|
||||
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
||||
<script>
|
||||
var serviceWorkerVersion = null;
|
||||
var scriptLoaded = false;
|
||||
function loadMainDartJs() {
|
||||
if (scriptLoaded) {
|
||||
return;
|
||||
}
|
||||
scriptLoaded = true;
|
||||
var scriptTag = document.createElement('script');
|
||||
scriptTag.src = 'main.dart.js';
|
||||
scriptTag.type = 'application/javascript';
|
||||
document.body.append(scriptTag);
|
||||
}
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
// Service workers are supported. Use them.
|
||||
window.addEventListener('load', function () {
|
||||
// Wait for registration to finish before dropping the <script> tag.
|
||||
// Otherwise, the browser will load the script multiple times,
|
||||
// potentially different versions.
|
||||
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
|
||||
navigator.serviceWorker.register(serviceWorkerUrl)
|
||||
.then((reg) => {
|
||||
function waitForActivation(serviceWorker) {
|
||||
serviceWorker.addEventListener('statechange', () => {
|
||||
if (serviceWorker.state == 'activated') {
|
||||
console.log('Installed new service worker.');
|
||||
loadMainDartJs();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!reg.active && (reg.installing || reg.waiting)) {
|
||||
// No active web worker and we have installed or are installing
|
||||
// one for the first time. Simply wait for it to activate.
|
||||
waitForActivation(reg.installing || reg.waiting);
|
||||
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
|
||||
// When the app updates the serviceWorkerVersion changes, so we
|
||||
// need to ask the service worker to update.
|
||||
console.log('New service worker available.');
|
||||
reg.update();
|
||||
waitForActivation(reg.installing);
|
||||
} else {
|
||||
// Existing service worker is still good.
|
||||
console.log('Loading app from service worker.');
|
||||
loadMainDartJs();
|
||||
}
|
||||
});
|
||||
|
||||
// If service worker doesn't succeed in a reasonable amount of time,
|
||||
// fallback to plaint <script> tag.
|
||||
setTimeout(() => {
|
||||
if (!scriptLoaded) {
|
||||
console.warn(
|
||||
'Failed to load app from service worker. Falling back to plain <script> tag.',
|
||||
);
|
||||
loadMainDartJs();
|
||||
}
|
||||
}, 4000);
|
||||
});
|
||||
} else {
|
||||
// Service workers not supported. Just drop the <script> tag.
|
||||
loadMainDartJs();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,35 +0,0 @@
|
||||
{
|
||||
"name": "rogapp",
|
||||
"short_name": "rogapp",
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"background_color": "#0175C2",
|
||||
"theme_color": "#0175C2",
|
||||
"description": "A new Flutter project.",
|
||||
"orientation": "portrait-primary",
|
||||
"prefer_related_applications": false,
|
||||
"icons": [
|
||||
{
|
||||
"src": "icons/Icon-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "icons/Icon-maskable-512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
17
windows/.gitignore
vendored
17
windows/.gitignore
vendored
@ -1,17 +0,0 @@
|
||||
flutter/ephemeral/
|
||||
|
||||
# Visual Studio user-specific files.
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Visual Studio build-related files.
|
||||
x64/
|
||||
x86/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
@ -1,95 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(rogapp LANGUAGES CXX)
|
||||
|
||||
set(BINARY_NAME "rogapp")
|
||||
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
|
||||
|
||||
# Configure build options.
|
||||
get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(IS_MULTICONFIG)
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
|
||||
CACHE STRING "" FORCE)
|
||||
else()
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE
|
||||
STRING "Flutter build mode" FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
||||
"Debug" "Profile" "Release")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
||||
# Use Unicode for all projects.
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
|
||||
# Compilation settings that should be applied to most targets.
|
||||
function(APPLY_STANDARD_SETTINGS TARGET)
|
||||
target_compile_features(${TARGET} PUBLIC cxx_std_17)
|
||||
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
|
||||
target_compile_options(${TARGET} PRIVATE /EHsc)
|
||||
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
|
||||
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
|
||||
endfunction()
|
||||
|
||||
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
|
||||
|
||||
# Flutter library and tool build rules.
|
||||
add_subdirectory(${FLUTTER_MANAGED_DIR})
|
||||
|
||||
# Application build
|
||||
add_subdirectory("runner")
|
||||
|
||||
# Generated plugin build rules, which manage building the plugins and adding
|
||||
# them to the application.
|
||||
include(flutter/generated_plugins.cmake)
|
||||
|
||||
|
||||
# === Installation ===
|
||||
# Support files are copied into place next to the executable, so that it can
|
||||
# run in place. This is done instead of making a separate bundle (as on Linux)
|
||||
# so that building and running from within Visual Studio will work.
|
||||
set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>")
|
||||
# Make the "install" step default, as it's required to run.
|
||||
set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
|
||||
endif()
|
||||
|
||||
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
|
||||
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
|
||||
if(PLUGIN_BUNDLED_LIBRARIES)
|
||||
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
|
||||
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
# Fully re-copy the assets directory on each build to avoid having stale files
|
||||
# from a previous install.
|
||||
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
|
||||
install(CODE "
|
||||
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
|
||||
" COMPONENT Runtime)
|
||||
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
|
||||
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
|
||||
|
||||
# Install the AOT library on non-Debug builds only.
|
||||
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
|
||||
CONFIGURATIONS Profile;Release
|
||||
COMPONENT Runtime)
|
||||
@ -1,103 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
|
||||
|
||||
# Configuration provided via flutter tool.
|
||||
include(${EPHEMERAL_DIR}/generated_config.cmake)
|
||||
|
||||
# TODO: Move the rest of this into files in ephemeral. See
|
||||
# https://github.com/flutter/flutter/issues/57146.
|
||||
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
|
||||
|
||||
# === Flutter Library ===
|
||||
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
|
||||
|
||||
# Published to parent scope for install step.
|
||||
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
|
||||
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
|
||||
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
|
||||
set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
|
||||
|
||||
list(APPEND FLUTTER_LIBRARY_HEADERS
|
||||
"flutter_export.h"
|
||||
"flutter_windows.h"
|
||||
"flutter_messenger.h"
|
||||
"flutter_plugin_registrar.h"
|
||||
"flutter_texture_registrar.h"
|
||||
)
|
||||
list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
|
||||
add_library(flutter INTERFACE)
|
||||
target_include_directories(flutter INTERFACE
|
||||
"${EPHEMERAL_DIR}"
|
||||
)
|
||||
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
|
||||
add_dependencies(flutter flutter_assemble)
|
||||
|
||||
# === Wrapper ===
|
||||
list(APPEND CPP_WRAPPER_SOURCES_CORE
|
||||
"core_implementations.cc"
|
||||
"standard_codec.cc"
|
||||
)
|
||||
list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
|
||||
list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
|
||||
"plugin_registrar.cc"
|
||||
)
|
||||
list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
|
||||
list(APPEND CPP_WRAPPER_SOURCES_APP
|
||||
"flutter_engine.cc"
|
||||
"flutter_view_controller.cc"
|
||||
)
|
||||
list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
|
||||
|
||||
# Wrapper sources needed for a plugin.
|
||||
add_library(flutter_wrapper_plugin STATIC
|
||||
${CPP_WRAPPER_SOURCES_CORE}
|
||||
${CPP_WRAPPER_SOURCES_PLUGIN}
|
||||
)
|
||||
apply_standard_settings(flutter_wrapper_plugin)
|
||||
set_target_properties(flutter_wrapper_plugin PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties(flutter_wrapper_plugin PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden)
|
||||
target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
|
||||
target_include_directories(flutter_wrapper_plugin PUBLIC
|
||||
"${WRAPPER_ROOT}/include"
|
||||
)
|
||||
add_dependencies(flutter_wrapper_plugin flutter_assemble)
|
||||
|
||||
# Wrapper sources needed for the runner.
|
||||
add_library(flutter_wrapper_app STATIC
|
||||
${CPP_WRAPPER_SOURCES_CORE}
|
||||
${CPP_WRAPPER_SOURCES_APP}
|
||||
)
|
||||
apply_standard_settings(flutter_wrapper_app)
|
||||
target_link_libraries(flutter_wrapper_app PUBLIC flutter)
|
||||
target_include_directories(flutter_wrapper_app PUBLIC
|
||||
"${WRAPPER_ROOT}/include"
|
||||
)
|
||||
add_dependencies(flutter_wrapper_app flutter_assemble)
|
||||
|
||||
# === Flutter tool backend ===
|
||||
# _phony_ is a non-existent file to force this command to run every time,
|
||||
# since currently there's no way to get a full input/output list from the
|
||||
# flutter tool.
|
||||
set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
|
||||
set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
|
||||
add_custom_command(
|
||||
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
|
||||
${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
|
||||
${CPP_WRAPPER_SOURCES_APP}
|
||||
${PHONY_OUTPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
${FLUTTER_TOOL_ENVIRONMENT}
|
||||
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
|
||||
windows-x64 $<CONFIG>
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(flutter_assemble DEPENDS
|
||||
"${FLUTTER_LIBRARY}"
|
||||
${FLUTTER_LIBRARY_HEADERS}
|
||||
${CPP_WRAPPER_SOURCES_CORE}
|
||||
${CPP_WRAPPER_SOURCES_PLUGIN}
|
||||
${CPP_WRAPPER_SOURCES_APP}
|
||||
)
|
||||
@ -1,29 +0,0 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
|
||||
#include <file_selector_windows/file_selector_windows.h>
|
||||
#include <geolocator_windows/geolocator_windows.h>
|
||||
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
||||
FileSelectorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||
GeolocatorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||
IsarFlutterLibsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
//
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
#include <flutter/plugin_registry.h>
|
||||
|
||||
// Registers Flutter plugins.
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry);
|
||||
|
||||
#endif // GENERATED_PLUGIN_REGISTRANT_
|
||||
@ -1,29 +0,0 @@
|
||||
#
|
||||
# Generated file, do not edit.
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
connectivity_plus
|
||||
file_selector_windows
|
||||
geolocator_windows
|
||||
isar_flutter_libs
|
||||
permission_handler_windows
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
@ -1,17 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(runner LANGUAGES CXX)
|
||||
|
||||
add_executable(${BINARY_NAME} WIN32
|
||||
"flutter_window.cpp"
|
||||
"main.cpp"
|
||||
"utils.cpp"
|
||||
"win32_window.cpp"
|
||||
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
|
||||
"Runner.rc"
|
||||
"runner.exe.manifest"
|
||||
)
|
||||
apply_standard_settings(${BINARY_NAME})
|
||||
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
|
||||
target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
|
||||
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
|
||||
add_dependencies(${BINARY_NAME} flutter_assemble)
|
||||
@ -1,121 +0,0 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#pragma code_page(65001)
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_APP_ICON ICON "resources\\app_icon.ico"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
#ifdef FLUTTER_BUILD_NUMBER
|
||||
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
|
||||
#else
|
||||
#define VERSION_AS_NUMBER 1,0,0
|
||||
#endif
|
||||
|
||||
#ifdef FLUTTER_BUILD_NAME
|
||||
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
|
||||
#else
|
||||
#define VERSION_AS_STRING "1.0.0"
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VERSION_AS_NUMBER
|
||||
PRODUCTVERSION VERSION_AS_NUMBER
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "com.example" "\0"
|
||||
VALUE "FileDescription", "rogapp" "\0"
|
||||
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
||||
VALUE "InternalName", "rogapp" "\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0"
|
||||
VALUE "OriginalFilename", "rogapp.exe" "\0"
|
||||
VALUE "ProductName", "rogapp" "\0"
|
||||
VALUE "ProductVersion", VERSION_AS_STRING "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
@ -1,61 +0,0 @@
|
||||
#include "flutter_window.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "flutter/generated_plugin_registrant.h"
|
||||
|
||||
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
|
||||
: project_(project) {}
|
||||
|
||||
FlutterWindow::~FlutterWindow() {}
|
||||
|
||||
bool FlutterWindow::OnCreate() {
|
||||
if (!Win32Window::OnCreate()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RECT frame = GetClientArea();
|
||||
|
||||
// The size here must match the window dimensions to avoid unnecessary surface
|
||||
// creation / destruction in the startup path.
|
||||
flutter_controller_ = std::make_unique<flutter::FlutterViewController>(
|
||||
frame.right - frame.left, frame.bottom - frame.top, project_);
|
||||
// Ensure that basic setup of the controller was successful.
|
||||
if (!flutter_controller_->engine() || !flutter_controller_->view()) {
|
||||
return false;
|
||||
}
|
||||
RegisterPlugins(flutter_controller_->engine());
|
||||
SetChildContent(flutter_controller_->view()->GetNativeWindow());
|
||||
return true;
|
||||
}
|
||||
|
||||
void FlutterWindow::OnDestroy() {
|
||||
if (flutter_controller_) {
|
||||
flutter_controller_ = nullptr;
|
||||
}
|
||||
|
||||
Win32Window::OnDestroy();
|
||||
}
|
||||
|
||||
LRESULT
|
||||
FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
|
||||
WPARAM const wparam,
|
||||
LPARAM const lparam) noexcept {
|
||||
// Give Flutter, including plugins, an opportunity to handle window messages.
|
||||
if (flutter_controller_) {
|
||||
std::optional<LRESULT> result =
|
||||
flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
|
||||
lparam);
|
||||
if (result) {
|
||||
return *result;
|
||||
}
|
||||
}
|
||||
|
||||
switch (message) {
|
||||
case WM_FONTCHANGE:
|
||||
flutter_controller_->engine()->ReloadSystemFonts();
|
||||
break;
|
||||
}
|
||||
|
||||
return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
#ifndef RUNNER_FLUTTER_WINDOW_H_
|
||||
#define RUNNER_FLUTTER_WINDOW_H_
|
||||
|
||||
#include <flutter/dart_project.h>
|
||||
#include <flutter/flutter_view_controller.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "win32_window.h"
|
||||
|
||||
// A window that does nothing but host a Flutter view.
|
||||
class FlutterWindow : public Win32Window {
|
||||
public:
|
||||
// Creates a new FlutterWindow hosting a Flutter view running |project|.
|
||||
explicit FlutterWindow(const flutter::DartProject& project);
|
||||
virtual ~FlutterWindow();
|
||||
|
||||
protected:
|
||||
// Win32Window:
|
||||
bool OnCreate() override;
|
||||
void OnDestroy() override;
|
||||
LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
|
||||
LPARAM const lparam) noexcept override;
|
||||
|
||||
private:
|
||||
// The project to run.
|
||||
flutter::DartProject project_;
|
||||
|
||||
// The Flutter instance hosted by this window.
|
||||
std::unique_ptr<flutter::FlutterViewController> flutter_controller_;
|
||||
};
|
||||
|
||||
#endif // RUNNER_FLUTTER_WINDOW_H_
|
||||
@ -1,43 +0,0 @@
|
||||
#include <flutter/dart_project.h>
|
||||
#include <flutter/flutter_view_controller.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "flutter_window.h"
|
||||
#include "utils.h"
|
||||
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
_In_ wchar_t *command_line, _In_ int show_command) {
|
||||
// Attach to console when present (e.g., 'flutter run') or create a
|
||||
// new console when running with a debugger.
|
||||
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
|
||||
CreateAndAttachConsole();
|
||||
}
|
||||
|
||||
// Initialize COM, so that it is available for use in the library and/or
|
||||
// plugins.
|
||||
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
||||
|
||||
flutter::DartProject project(L"data");
|
||||
|
||||
std::vector<std::string> command_line_arguments =
|
||||
GetCommandLineArguments();
|
||||
|
||||
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
|
||||
|
||||
FlutterWindow window(project);
|
||||
Win32Window::Point origin(10, 10);
|
||||
Win32Window::Size size(1280, 720);
|
||||
if (!window.CreateAndShow(L"rogapp", origin, size)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
window.SetQuitOnClose(true);
|
||||
|
||||
::MSG msg;
|
||||
while (::GetMessage(&msg, nullptr, 0, 0)) {
|
||||
::TranslateMessage(&msg);
|
||||
::DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
::CoUninitialize();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by Runner.rc
|
||||
//
|
||||
#define IDI_APP_ICON 101
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user