update to add resume app from sleep

This commit is contained in:
Mohamed Nouffer
2023-08-16 14:53:32 +05:30
parent 68bf3e9ab3
commit 2ab96cc3d0
51 changed files with 748 additions and 789 deletions

View File

@ -53,13 +53,15 @@ PODS:
- google_maps_flutter_ios (0.0.1): - google_maps_flutter_ios (0.0.1):
- Flutter - Flutter
- GoogleMaps - GoogleMaps
- GoogleMaps (4.1.0): - GoogleMaps (5.2.0):
- GoogleMaps/Maps (= 4.1.0) - GoogleMaps/Maps (= 5.2.0)
- GoogleMaps/Base (4.1.0) - GoogleMaps/Base (5.2.0)
- GoogleMaps/Maps (4.1.0): - GoogleMaps/Maps (5.2.0):
- GoogleMaps/Base - GoogleMaps/Base
- image_picker_ios (0.0.1): - image_picker_ios (0.0.1):
- Flutter - Flutter
- is_lock_screen (2.0.0):
- Flutter
- move_to_background (0.0.1): - move_to_background (0.0.1):
- Flutter - Flutter
- path_provider_ios (0.0.1): - path_provider_ios (0.0.1):
@ -93,6 +95,7 @@ DEPENDENCIES:
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- is_lock_screen (from `.symlinks/plugins/is_lock_screen/ios`)
- move_to_background (from `.symlinks/plugins/move_to_background/ios`) - move_to_background (from `.symlinks/plugins/move_to_background/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
@ -132,6 +135,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios" :path: ".symlinks/plugins/google_maps_flutter_ios/ios"
image_picker_ios: image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
is_lock_screen:
:path: ".symlinks/plugins/is_lock_screen/ios"
move_to_background: move_to_background:
:path: ".symlinks/plugins/move_to_background/ios" :path: ".symlinks/plugins/move_to_background/ios"
path_provider_ios: path_provider_ios:
@ -160,8 +165,9 @@ SPEC CHECKSUMS:
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401 geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9 google_maps_flutter_ios: 66201f392bf62d500f07670a30488a247b9bb5b9
GoogleMaps: 008e2c80e38605b56b560e8deb73d4194ff30bef GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693
image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb
is_lock_screen: 8ae6397a49b2fde58fd80a6ed30fbaf2be9418d6
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce

View File

@ -379,6 +379,7 @@
DEVELOPMENT_TEAM = D5SL68ATB9; DEVELOPMENT_TEAM = D5SL68ATB9;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@ -508,6 +509,7 @@
DEVELOPMENT_TEAM = D5SL68ATB9; DEVELOPMENT_TEAM = D5SL68ATB9;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
@ -531,6 +533,7 @@
DEVELOPMENT_TEAM = D5SL68ATB9; DEVELOPMENT_TEAM = D5SL68ATB9;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",

View File

@ -1,16 +1,12 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart'; import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:rogapp/pages/index/index_binding.dart'; import 'package:rogapp/pages/index/index_binding.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/utils/string_values.dart'; import 'package:rogapp/utils/string_values.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:is_lock_screen/is_lock_screen.dart';
import 'package:path/path.dart' as p;
void main() async { void main() async {
@ -32,12 +28,39 @@ void main() async {
value: 'cacheFirst', value: 'cacheFirst',
); );
runApp(MyApp()); runApp(const MyApp());
} }
class MyApp extends StatelessWidget { class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
// This widget is the root of your application. // This widget is the root of your application.
@override
void initState() {
super.initState();
WidgetsBinding.instance?.addObserver(this);
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) async {
super.didChangeAppLifecycleState(state);
if (state == AppLifecycleState.inactive) {
print('app inactive, is lock screen: ${await isLockScreen()}');
} else if (state == AppLifecycleState.resumed) {
DestinationController destinationController = Get.find<DestinationController>();
destinationController.initGPS();
print('app resumed');
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetMaterialApp( return GetMaterialApp(
@ -49,7 +72,6 @@ class MyApp extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity, visualDensity: VisualDensity.adaptivePlatformDensity,
textTheme: GoogleFonts.muliTextTheme(),
), ),
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
defaultTransition: Transition.cupertino, defaultTransition: Transition.cupertino,

View File

@ -23,7 +23,7 @@ class CameraPage extends StatelessWidget {
return FileImage(destinationController.photos[0]); return FileImage(destinationController.photos[0]);
} }
else{ else{
return AssetImage('assets/images/empty_image.png'); return const AssetImage('assets/images/empty_image.png');
} }
} }
@ -45,12 +45,12 @@ class CameraPage extends StatelessWidget {
settingGoal.value == false ? settingGoal.value == false ?
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.red backgroundColor: Colors.red
), ),
onPressed: () async { onPressed: () async {
settingGoal.value = true; settingGoal.value = true;
try{ try{
int user_id = indexController.currentUser[0]["user"]["id"]; int userId = indexController.currentUser[0]["user"]["id"];
//print("--- Pressed -----"); //print("--- Pressed -----");
String _team = indexController.currentUser[0]["user"]['team_name']; String _team = indexController.currentUser[0]["user"]['team_name'];
//print("--- _team : ${_team}-----"); //print("--- _team : ${_team}-----");
@ -61,7 +61,7 @@ class CameraPage extends StatelessWidget {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now); String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
await ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){ await ExternalService().makeGoal(userId, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
print("---called ext api ${value['status']} ------"); print("---called ext api ${value['status']} ------");
if(value['status'] == 'OK'){ if(value['status'] == 'OK'){
Get.back(); Get.back();
@ -86,7 +86,7 @@ class CameraPage extends StatelessWidget {
) )
: :
Container( Container(
child: Center( child: const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
) )
@ -105,14 +105,14 @@ class CameraPage extends StatelessWidget {
onPressed: (){ onPressed: (){
destinationController.openCamera(context); destinationController.openCamera(context);
}, },
child: destinationController.photos.length > 0 ? Text("再撮影") : Text("撮影") child: destinationController.photos.isNotEmpty ? const Text("再撮影") : const Text("撮影")
) )
), ),
Obx(() => Obx(() =>
destinationController.photos.isNotEmpty ? destinationController.photos.isNotEmpty ?
ElevatedButton( ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.red backgroundColor: Colors.red
), ),
onPressed: (){ onPressed: (){
print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######"); print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
@ -136,7 +136,7 @@ class CameraPage extends StatelessWidget {
// } // }
// }); // });
}, },
child: Text("チェックイン") child: const Text("チェックイン")
): ):
Container() Container()
) )
@ -166,7 +166,7 @@ class CameraPage extends StatelessWidget {
onPressed: (){ onPressed: (){
Navigator.of(context).pop(); Navigator.of(context).pop();
destinationController.skip_10s = true; destinationController.skip_10s = true;
timer = Timer.periodic(Duration(seconds: 10), (Timer t){ timer = Timer.periodic(const Duration(seconds: 10), (Timer t){
destinationController.skip_10s = false; destinationController.skip_10s = false;
}); });
}, },
@ -175,13 +175,13 @@ class CameraPage extends StatelessWidget {
) )
: :
AppBar( AppBar(
title: Text("チェックポイント"), title: const Text("チェックポイント"),
), ),
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Obx(() => child: Obx(() =>
Container( Container(
@ -226,14 +226,14 @@ class StartRogaining extends StatelessWidget {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)), Text("You have not started rogaining yet.".tr, style: const TextStyle(fontSize: 24)),
SizedBox(height: 40.0,), const SizedBox(height: 40.0,),
ElevatedButton( ElevatedButton(
onPressed: (){ onPressed: (){
Get.back(); Get.back();
destinationController.skip_gps = false; destinationController.skip_gps = false;
}, },
child: Text("Back"), child: const Text("Back"),
), ),
], ],
), ),
@ -259,14 +259,14 @@ class NotAtGoal extends StatelessWidget {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text("You have not reached the goal yet.".tr, style: TextStyle(fontSize: 24)), Text("You have not reached the goal yet.".tr, style: const TextStyle(fontSize: 24)),
SizedBox(height: 40.0,), const SizedBox(height: 40.0,),
ElevatedButton( ElevatedButton(
onPressed: (){ onPressed: (){
Get.back(); Get.back();
destinationController.skip_gps = false; destinationController.skip_gps = false;
}, },
child: Text("Back"), child: const Text("Back"),
), ),
], ],
), ),

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
class ChangePasswordPage extends StatelessWidget { class ChangePasswordPage extends StatelessWidget {
ChangePasswordPage({Key? key}) : super(key: key); ChangePasswordPage({Key? key}) : super(key: key);
@ -23,10 +22,10 @@ class ChangePasswordPage extends StatelessWidget {
leading: leading:
IconButton( onPressed: (){ IconButton( onPressed: (){
Navigator.pop(context); Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
), ),
body: body:
Container( SizedBox(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -37,13 +36,13 @@ class ChangePasswordPage extends StatelessWidget {
Column( Column(
children: [ children: [
Container( Container(
child: Text("change_password".tr, style: TextStyle(fontSize: 24.0),), child: Text("change_password".tr, style: const TextStyle(fontSize: 24.0),),
), ),
SizedBox(height: 30,), const SizedBox(height: 30,),
], ],
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 40 horizontal: 40
), ),
child: Column( child: Column(
@ -54,9 +53,9 @@ class ChangePasswordPage extends StatelessWidget {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 40), padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container( child: Container(
padding: EdgeInsets.only(top: 3,left: 3), padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
), ),
@ -71,7 +70,7 @@ class ChangePasswordPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: CircularProgressIndicator(), child: const CircularProgressIndicator(),
) : ) :
Column( Column(
children: [ children: [
@ -83,9 +82,9 @@ class ChangePasswordPage extends StatelessWidget {
Get.snackbar( Get.snackbar(
"no_values".tr, "no_values".tr,
"values_required".tr, "values_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -99,12 +98,12 @@ class ChangePasswordPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("ログイン",style: TextStyle( child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
), ),
SizedBox(height: 10.0,), const SizedBox(height: 10.0,),
], ],
) )
@ -112,7 +111,7 @@ class ChangePasswordPage extends StatelessWidget {
), ),
) )
), ),
SizedBox(height: 20,), const SizedBox(height: 20,),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -132,17 +131,17 @@ class ChangePasswordPage extends StatelessWidget {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(label,style:TextStyle( Text(label,style:const TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black87 color: Colors.black87
),), ),),
SizedBox(height: 5,), const SizedBox(height: 5,),
TextField( TextField(
controller: controller, controller: controller,
obscureText: obsureText, obscureText: obsureText,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: (Colors.grey[400])!, color: (Colors.grey[400])!,
@ -154,7 +153,7 @@ class ChangePasswordPage extends StatelessWidget {
), ),
), ),
), ),
SizedBox(height: 30.0,) const SizedBox(height: 30.0,)
], ],
); );
} }

View File

@ -1,6 +1,5 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
class DestinationBinding extends Bindings { class DestinationBinding extends Bindings {
@override @override

View File

@ -1,6 +1,5 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:camera_camera/camera_camera.dart'; import 'package:camera_camera/camera_camera.dart';
@ -12,25 +11,19 @@ import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/Rogaining.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/camera/camera_page.dart'; import 'package:rogapp/pages/camera/camera_page.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/action_service.dart';
import 'package:rogapp/services/destination_service.dart'; import 'package:rogapp/services/destination_service.dart';
import 'package:rogapp/services/external_service.dart'; import 'package:rogapp/services/external_service.dart';
import 'package:rogapp/services/location_line_service.dart';
import 'package:rogapp/services/location_service.dart'; import 'package:rogapp/services/location_service.dart';
import 'package:rogapp/services/maxtrix_service.dart'; import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/services/perfecture_service.dart'; import 'package:rogapp/services/perfecture_service.dart';
import 'package:rogapp/services/reacking_service.dart';
import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'dart:async'; import 'dart:async';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:sqflite/sqlite_api.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class DestinationController extends GetxController { class DestinationController extends GetxController {
@ -51,7 +44,7 @@ class DestinationController extends GetxController {
var is_at_start = false.obs; var is_at_start = false.obs;
var is_at_goal = false.obs; var is_at_goal = false.obs;
var is_photo_shoot = false.obs; var is_photo_shoot = false.obs;
DateTime last_goal_at = DateTime.now().subtract(Duration(days:1)); DateTime last_goal_at = DateTime.now().subtract(const Duration(days:1));
//List<Rogaining> rogainings = <Rogaining>[].obs; //List<Rogaining> rogainings = <Rogaining>[].obs;
bool checking_in = false; bool checking_in = false;
@ -115,8 +108,8 @@ class DestinationController extends GetxController {
void startTimerLocation(GeoJsonFeature fs, double distance) { void startTimerLocation(GeoJsonFeature fs, double distance) {
print("---- in startTimer ----"); print("---- in startTimer ----");
//skip_gps = true; //skip_gps = true;
double checkin_radious = fs.properties!['checkin_radius'] ?? double.infinity; double checkinRadious = fs.properties!['checkin_radius'] ?? double.infinity;
if(checkin_radious >= distance){ if(checkinRadious >= distance){
indexController.currentFeature.clear(); indexController.currentFeature.clear();
Destination d = festuretoDestination(fs); Destination d = festuretoDestination(fs);
for(Destination de in destinations){ for(Destination de in destinations){
@ -135,14 +128,14 @@ class DestinationController extends GetxController {
print("=== passed dest is ${d.location_id} ${d.checkedin} ===="); print("=== passed dest is ${d.location_id} ${d.checkedin} ====");
skip_gps = true; skip_gps = true;
print("---- in startTimer ----"); print("---- in startTimer ----");
double checkin_radious = d.checkin_radious ?? double.infinity; double checkinRadious = d.checkin_radious ?? double.infinity;
bool auto_checkin = d.auto_checkin == 0 ? false : true; bool autoCheckin = d.auto_checkin == 0 ? false : true;
bool location_already_checked_in = d.checkedin ?? false; bool locationAlreadyCheckedIn = d.checkedin ?? false;
bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false; bool isuserLoggedIn = indexController.currentUser.isNotEmpty ? true : false;
//make current destination //make current destination
print("---- checkin_radious ${checkin_radious} ----"); print("---- checkin_radious $checkinRadious ----");
print("---- distance ${distance} ----"); print("---- distance $distance ----");
if(checkin_radious >= distance){ if(checkinRadious >= distance){
//currentSelectedDestinations.add(d); //currentSelectedDestinations.add(d);
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
indexController.currentDestinationFeature.add(d); indexController.currentDestinationFeature.add(d);
@ -202,9 +195,9 @@ class DestinationController extends GetxController {
} }
print("---- location checkin radious ${d.checkin_radious} ----"); print("---- location checkin radious ${d.checkin_radious} ----");
print("---- already checked in ${location_already_checked_in} ----"); print("---- already checked in $locationAlreadyCheckedIn ----");
if(checkin_radious >= distance && location_already_checked_in == false && is_in_rog.value == true){ if(checkinRadious >= distance && locationAlreadyCheckedIn == false && is_in_rog.value == true){
if(auto_checkin){ if(autoCheckin){
if(!checking_in){ if(!checking_in){
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@"); print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ make checkin ${d.sub_loc_id}@@@@@@@@@@@");
makeCheckin(d, true,""); makeCheckin(d, true,"");
@ -255,11 +248,11 @@ class DestinationController extends GetxController {
} }
} }
print("---- cp --- ${d.cp} -----"); print("---- cp --- ${d.cp} -----");
print("--- at goal ${is_at_goal} ---"); print("--- at goal $is_at_goal ---");
print("--- rog counted ${rogaining_counted} ---"); print("--- rog counted $rogaining_counted ---");
print("--- loc already checked in ${location_already_checked_in} ---"); print("--- loc already checked in $locationAlreadyCheckedIn ---");
print("==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ===="); print("==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ====");
if(isUser_logged_in && d.cp == -1 && location_already_checked_in && skip_10s == false){ if(isuserLoggedIn && d.cp == -1 && locationAlreadyCheckedIn && skip_10s == false){
//check for rogaining //check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){ if(is_at_goal.value == false && rogaining_counted.value){
//goal //goal
@ -290,7 +283,7 @@ class DestinationController extends GetxController {
}); });
} }
} }
print("==== _chekcs ${chekcs} ===="); print("==== _chekcs $chekcs ====");
if(chekcs == 0){ if(chekcs == 0){
skip_gps = false; skip_gps = false;
} }
@ -316,7 +309,7 @@ class DestinationController extends GetxController {
int? _latgoal = await db.latestGoal(); int? _latgoal = await db.latestGoal();
if(_latgoal != null){ if(_latgoal != null){
last_goal_at = DateTime.fromMicrosecondsSinceEpoch(_latgoal); last_goal_at = DateTime.fromMicrosecondsSinceEpoch(_latgoal);
print("===== last goal : ${last_goal_at} ====="); print("===== last goal : $last_goal_at =====");
} }
@ -339,7 +332,7 @@ class DestinationController extends GetxController {
onFile: (file) { onFile: (file) {
photos.add(file); photos.add(file);
Navigator.pop(context); Navigator.pop(context);
print("----image file is : ${file}----"); print("----image file is : $file----");
//setState(() {}); //setState(() {});
}, },
))); )));
@ -362,11 +355,12 @@ class DestinationController extends GetxController {
return d; return d;
} }
} }
return null;
} }
void checkForCheckin(double la, double ln){ void checkForCheckin(double la, double ln){
print("--- skip_gps ---- ${skip_gps}----"); print("--- skip_gps ---- $skip_gps----");
for(final d in destinations){ for(final d in destinations){
@ -376,7 +370,7 @@ class DestinationController extends GetxController {
double lon = d.lon!; double lon = d.lon!;
LatLng p = LatLng(lat, lon); LatLng p = LatLng(lat, lon);
getDestinationForLatLong(lat, lon).then((value){ getDestinationForLatLong(lat, lon).then((value){
var distance = Distance(); var distance = const Distance();
double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln)); double dist = distance.as(LengthUnit.Meter, LatLng(lat, lon), LatLng(la, ln));
//double checkin_radious = value!.checkin_radious ?? double.infinity; //double checkin_radious = value!.checkin_radious ?? double.infinity;
//bool auto_checkin = value.auto_checkin == 0 ? false : true; //bool auto_checkin = value.auto_checkin == 0 ? false : true;
@ -405,23 +399,23 @@ class DestinationController extends GetxController {
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint; GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
double lat_fs = pt.latitude; double latFs = pt.latitude;
double lon_fs = pt.longitude; double lonFs = pt.longitude;
LatLng p_fs = LatLng(lat_fs, lon_fs); LatLng pFs = LatLng(latFs, lonFs);
var distance_fs = Distance(); var distanceFs = const Distance();
double dist_fs = distance_fs.as(LengthUnit.Meter, LatLng(lat_fs, lon_fs), LatLng(la, ln)); double distFs = distanceFs.as(LengthUnit.Meter, LatLng(latFs, lonFs), LatLng(la, ln));
if(dist_fs <= 250 && skip_gps == false){ if(distFs <= 250 && skip_gps == false){
//near a location //near a location
print("---- before call startTimerLocation ----"); print("---- before call startTimerLocation ----");
startTimerLocation(fs, dist_fs); startTimerLocation(fs, distFs);
} }
} }
} }
void addToRogaining(double lat, double lon, int destination_id) async { void addToRogaining(double lat, double lon, int destinationId) async {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
List<Destination> d = await db.getDestinationById(destination_id); List<Destination> d = await db.getDestinationById(destinationId);
if(d.isEmpty){ if(d.isEmpty){
Destination df = festuretoDestination(indexController.currentFeature[0]); Destination df = festuretoDestination(indexController.currentFeature[0]);
print("--- made checkin ${df.location_id} ----"); print("--- made checkin ${df.location_id} ----");
@ -443,10 +437,10 @@ class DestinationController extends GetxController {
PopulateDestinations(); PopulateDestinations();
/// post to NATNAT /// post to NATNAT
if(indexController.currentUser.length > 0){ if(indexController.currentUser.isNotEmpty){
double cp_num = destination.cp!; double cpNum = destination.cp!;
int user_id = indexController.currentUser[0]["user"]["id"]; int userId = indexController.currentUser[0]["user"]["id"];
//print("--- Pressed -----"); //print("--- Pressed -----");
String _team = indexController.currentUser[0]["user"]['team_name']; String _team = indexController.currentUser[0]["user"]['team_name'];
//print("--- _team : ${_team}-----"); //print("--- _team : ${_team}-----");
@ -457,9 +451,9 @@ class DestinationController extends GetxController {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now); String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
print("------ checkin event ${_event_code} ------"); print("------ checkin event $_event_code ------");
ExternalService().makeCheckpoint(user_id, _token, formattedDate, _team,cp_num.round(), _event_code, imageurl).then((value){ ExternalService().makeCheckpoint(userId, _token, formattedDate, _team,cpNum.round(), _event_code, imageurl).then((value){
print("------Ext service check point ${value} ------"); print("------Ext service check point $value ------");
}); });
} }
@ -496,7 +490,7 @@ class DestinationController extends GetxController {
showBackgroundLocationIndicator: true showBackgroundLocationIndicator: true
); );
} else { } else {
locationSettings = LocationSettings( locationSettings = const LocationSettings(
accuracy: LocationAccuracy.high, accuracy: LocationAccuracy.high,
distanceFilter: 0, distanceFilter: 0,
); );
@ -513,17 +507,17 @@ class DestinationController extends GetxController {
indexController.current_lat = position != null ? position.latitude : 0; indexController.current_lat = position != null ? position.latitude : 0;
current_lon = position != null ? position.longitude : 0; current_lon = position != null ? position.longitude : 0;
print("==== gps skip is : ${skip_gps.toString()}, selected is ${is_gps_selected} , ${current_lat}"); print("==== gps skip is : ${skip_gps.toString()}, selected is $is_gps_selected , $current_lat");
if(is_gps_selected.value){ if(is_gps_selected.value){
double czoom = indexController.rogMapController!.zoom; double czoom = indexController.rogMapController.zoom;
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom); indexController.rogMapController.move(LatLng(position!.latitude, position.longitude), czoom);
//String user_id = indexController.currentUser[0]["user"]["id"].toString(); //String user_id = indexController.currentUser[0]["user"]["id"].toString();
//TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){ //TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
//print("---- postion is ${position.latitude}, ${position.longitude}"); //print("---- postion is ${position.latitude}, ${position.longitude}");
gps.clear(); gps.clear();
gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --"); gps.add("-- lat : ${position.latitude}, lon : ${position.longitude} --");
checkForCheckin(position!.latitude, position.longitude); checkForCheckin(position.latitude, position.longitude);
print("--- call check checkin"); print("--- call check checkin");
print("---- skip gps is ${skip_gps.toString()} ----"); print("---- skip gps is ${skip_gps.toString()} ----");
//}); //});
@ -552,7 +546,7 @@ class DestinationController extends GetxController {
@override @override
void onReady() { void onReady() {
Get.toNamed(AppPages.LOGIN)!.then((value){ Get.toNamed(AppPages.LOGIN)!.then((value){
if(indexController.currentUser.length > 0) { if(indexController.currentUser.isNotEmpty) {
fixMapBound(); fixMapBound();
} }
else { else {
@ -560,7 +554,7 @@ class DestinationController extends GetxController {
PerfectureService.getSubExt("9").then((value){ PerfectureService.getSubExt("9").then((value){
if(value != null){ if(value != null){
LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2]));
indexController.mapController!.fitBounds(bnds); //.centerZoomFitBounds(bnds); indexController.mapController.fitBounds(bnds); //.centerZoomFitBounds(bnds);
} }
}); });
} }
@ -573,10 +567,10 @@ class DestinationController extends GetxController {
indexController.switchPage(AppPages.INITIAL); indexController.switchPage(AppPages.INITIAL);
LocationService.getLocationsExt(_token).then((value) { LocationService.getLocationsExt(_token).then((value) {
if(value != null){ if(value != null){
print("--- loc ext is - ${value} ----"); print("--- loc ext is - $value ----");
LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2])); LatLngBounds bnds = LatLngBounds(LatLng(value[1], value[0]), LatLng(value[3], value[2]));
print("--- bnds is - ${bnds} ----"); print("--- bnds is - $bnds ----");
indexController.mapController!.fitBounds( indexController.mapController.fitBounds(
bnds, bnds,
); );
indexController.currentBound.clear(); indexController.currentBound.clear();
@ -587,7 +581,7 @@ class DestinationController extends GetxController {
} }
void connectionChanged(String val) { void connectionChanged(String val) {
print('----- %%%%%%%%%%%%%%%%%%%%% ----- ${val}'); print('----- %%%%%%%%%%%%%%%%%%%%% ----- $val');
Map<String, dynamic> _res = {}; Map<String, dynamic> _res = {};
if(val == "wifi" || val == "mobile"){ if(val == "wifi" || val == "mobile"){
String _token = indexController.currentUser[0]["token"]; String _token = indexController.currentUser[0]["token"];
@ -598,11 +592,11 @@ class DestinationController extends GetxController {
_res = await ExternalService().StartRogaining(); _res = await ExternalService().StartRogaining();
} }
else if(e.rog_action_type == 1){ else if(e.rog_action_type == 1){
var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
_res = await ExternalService().makeCheckpoint(e.user_id!, _token, getFormatedTime(datetime), e.team_name!, e.cp_number!, e.event_code!, e.image!); _res = await ExternalService().makeCheckpoint(e.user_id!, _token, getFormatedTime(datetime), e.team_name!, e.cp_number!, e.event_code!, e.image!);
} }
else if(e.rog_action_type == 2){ else if(e.rog_action_type == 2){
var datetime = new DateTime.fromMicrosecondsSinceEpoch(e.checkintime!); var datetime = DateTime.fromMicrosecondsSinceEpoch(e.checkintime!);
_res = await ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!); _res = await ExternalService().makeGoal(e.user_id!, _token, e.team_name!, e.image!, getFormatedTime(datetime), e.event_code!);
} }
@ -626,8 +620,8 @@ class DestinationController extends GetxController {
} }
Destination? destinationById(int id){ Destination? destinationById(int id){
Destination? d = null; Destination? d;
print("--- target des - ${id} ----"); print("--- target des - $id ----");
for(Destination ss in destinations){ for(Destination ss in destinations){
print("--- des - ${ss.location_id} ----"); print("--- des - ${ss.location_id} ----");
if(ss.location_id == id){ if(ss.location_id == id){
@ -678,7 +672,7 @@ class DestinationController extends GetxController {
} }
else { else {
db.insertDestination(dest).then((value){ db.insertDestination(dest).then((value){
print("----- destination controller added as new ${value}--- :::::"); print("----- destination controller added as new $value--- :::::");
PopulateDestinations(); PopulateDestinations();
}); });
} }
@ -710,7 +704,7 @@ class DestinationController extends GetxController {
context: context, context: context,
barrierDismissible: false, barrierDismissible: false,
builder: (BuildContext context) { builder: (BuildContext context) {
return Center( return const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
); );
}); });
@ -719,7 +713,7 @@ class DestinationController extends GetxController {
void destinationMatrixFromCurrentPoint(List<Destination> points){ void destinationMatrixFromCurrentPoint(List<Destination> points){
buildShowDialog(Get.context!); buildShowDialog(Get.context!);
MatrixService.getDestinations(points).then((mat){ MatrixService.getDestinations(points).then((mat){
print(" matrix is ------- ${mat}"); print(" matrix is ------- $mat");
matrix = mat; matrix = mat;
try{ try{
@ -755,7 +749,7 @@ class DestinationController extends GetxController {
destinations.add(d); destinations.add(d);
} }
// destinationCount.value = 0; // destinationCount.value = 0;
print("------ destination controller destinationcount-------- ${destinationCount}-------- :::::"); print("------ destination controller destinationcount-------- $destinationCount-------- :::::");
// MatrixService.getDestinations(value).then((mat){ // MatrixService.getDestinations(value).then((mat){

View File

@ -1,20 +1,14 @@
import 'dart:developer';
import 'dart:io';
import 'package:camera_camera/camera_camera.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/camera/camera_page.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/destination_map/destination_map_page.dart'; import 'package:rogapp/pages/destination_map/destination_map_page.dart';
import 'package:rogapp/pages/drawer/drawer_page.dart'; import 'package:rogapp/pages/drawer/drawer_page.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/external_service.dart';
import 'package:rogapp/widgets/destination_widget.dart'; import 'package:rogapp/widgets/destination_widget.dart';
import 'package:timeline_tile/timeline_tile.dart';
class DestnationPage extends StatelessWidget { class DestnationPage extends StatelessWidget {
DestnationPage({Key? key}) : super(key: key); DestnationPage({Key? key}) : super(key: key);
@ -32,13 +26,13 @@ class DestnationPage extends StatelessWidget {
permission = await Geolocator.requestPermission(); permission = await Geolocator.requestPermission();
} }
Position position = await Geolocator.getCurrentPosition( Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high); desiredAccuracy: LocationAccuracy.high, forceAndroidLocationManager: true);
indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14); indexController.rogMapController.move(LatLng(position.latitude, position.longitude), 14);
} }
Image getImage(int index){ Image getImage(int index){
if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){ if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
return Image(image: NetworkImage(destinationController.destinations[index].photos!)); return Image(image: NetworkImage(destinationController.destinations[index].photos!));
@ -48,21 +42,18 @@ class DestnationPage extends StatelessWidget {
Widget getRoutingImage(int route){ Widget getRoutingImage(int route){
switch (route) { switch (route) {
case 0: case 0:
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,); return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
case 1: case 1:
return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,); return const Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,);
case 2: case 2:
return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,); return const Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,);
default: default:
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,); return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
} }
} }
@override @override
Widget build(BuildContext context) { 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( return WillPopScope(
onWillPop: () async { onWillPop: () async {
indexController.switchPage(AppPages.INITIAL); indexController.switchPage(AppPages.INITIAL);
@ -85,12 +76,12 @@ class DestnationPage extends StatelessWidget {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(top:30.0, bottom: 30), padding: const EdgeInsets.only(top:30.0, bottom: 30),
child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),), child: Center(child: Text("select_travel_mode".tr, style: const TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
), ),
ListTile( ListTile(
selected: destinationController.travelMode == 0 ? true : false, selected: destinationController.travelMode == 0 ? true : false,
selectedTileColor: Colors.amber.shade200, selectedTileColor: Colors.amber.shade200,
leading: Image(image: AssetImage('assets/images/p4_9_man.png'),), leading: const Image(image: AssetImage('assets/images/p4_9_man.png'),),
title: Text("walking".tr), title: Text("walking".tr),
onTap:(){ onTap:(){
destinationController.travelMode.value = 0; destinationController.travelMode.value = 0;
@ -101,7 +92,7 @@ class DestnationPage extends StatelessWidget {
ListTile( ListTile(
selected: destinationController.travelMode == 1 ? true : false, selected: destinationController.travelMode == 1 ? true : false,
selectedTileColor: Colors.amber.shade200, selectedTileColor: Colors.amber.shade200,
leading: Image(image: AssetImage('assets/images/p4_8_car.png'),), leading: const Image(image: AssetImage('assets/images/p4_8_car.png'),),
title: Text("driving".tr), title: Text("driving".tr),
onTap:(){ onTap:(){
destinationController.travelMode.value = 1; destinationController.travelMode.value = 1;
@ -149,9 +140,9 @@ class DestnationPage extends StatelessWidget {
tooltip: 'Increment', tooltip: 'Increment',
child: Obx(() => child: Obx(() =>
indexController.desination_mode == 1 ? indexController.desination_mode == 1 ?
Image(image: AssetImage('assets/images/list2.png')) const Image(image: AssetImage('assets/images/list2.png'))
: :
Image(image: AssetImage('assets/images/map.png')) const Image(image: AssetImage('assets/images/map.png'))
), ),
elevation: 4.0, elevation: 4.0,
), ),
@ -170,12 +161,12 @@ class DestnationPage extends StatelessWidget {
destinationController.is_at_goal == true ? destinationController.is_at_goal == true ?
IconButton( IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);}, onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.assistant_photo), icon: const Icon(Icons.assistant_photo),
) )
: :
IconButton( IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);}, onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.accessibility), icon: const Icon(Icons.accessibility),
), ),
), ),
// Obx(() => // Obx(() =>
@ -185,7 +176,7 @@ class DestnationPage extends StatelessWidget {
ToggleButtons( ToggleButtons(
disabledColor: Colors.grey.shade200, disabledColor: Colors.grey.shade200,
selectedColor: Colors.red, selectedColor: Colors.red,
children: <Widget>[ children: const <Widget>[
Icon(Icons.explore, size: 35.0, Icon(Icons.explore, size: 35.0,
)], )],
onPressed: (int index) { onPressed: (int index) {

View File

@ -5,21 +5,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/plugin_api.dart'; import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart'; import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart'; import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/destination_service.dart';
import 'package:rogapp/utils/text_util.dart'; import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart'; import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:rogapp/widgets/bread_crum_widget.dart';
class DestinationMapPage extends StatelessWidget { class DestinationMapPage extends StatelessWidget {
@ -46,7 +40,7 @@ class DestinationMapPage extends StatelessWidget {
int index = -1; int index = -1;
for (int i = 0; i < destinationController.destinations.length; i++) { for (int i = 0; i < destinationController.destinations.length; i++) {
Destination d = destinationController.destinations[i]; Destination d = destinationController.destinations[i];
print("^^^^ ${d} ^^^^"); print("^^^^ $d ^^^^");
Marker m = Marker( Marker m = Marker(
point: LatLng(d.lat!, d.lon!), point: LatLng(d.lat!, d.lon!),
anchorPos: AnchorPos.align(AnchorAlign.center), anchorPos: AnchorPos.align(AnchorAlign.center),
@ -55,8 +49,7 @@ class DestinationMapPage extends StatelessWidget {
return InkWell( return InkWell(
onTap: (){ onTap: (){
print("-- Destination is --- ${d.name} ------"); print("-- Destination is --- ${d.name} ------");
if(d != null){ if(indexController.currentDestinationFeature.isNotEmpty) {
if(indexController.currentDestinationFeature.length > 0) {
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
} }
indexController.currentDestinationFeature.add(d); indexController.currentDestinationFeature.add(d);
@ -68,7 +61,6 @@ class DestinationMapPage extends StatelessWidget {
print("---- set skip gps to false -----"); print("---- set skip gps to false -----");
destinationController.skip_gps = false; destinationController.skip_gps = false;
}); });
}
}, },
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -79,19 +71,19 @@ class DestinationMapPage extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.red, color: Colors.red,
shape: BoxShape.circle, shape: BoxShape.circle,
border: new Border.all( border: Border.all(
color: Colors.white, color: Colors.white,
width: d.checkin_radious != null ? d.checkin_radious! : 1, width: d.checkin_radious != null ? d.checkin_radious! : 1,
), ),
), ),
child: new Center( child: Center(
child: new Text( child: Text(
(i + 1).toString(), (i + 1).toString(),
style: TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
), ),
), ),
Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)), Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: const TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
], ],
), ),
); );
@ -132,28 +124,28 @@ class DestinationMapPage extends StatelessWidget {
options: MapOptions( options: MapOptions(
onMapReady: (){ onMapReady: (){
indexController.is_rog_mapcontroller_loaded.value = true; indexController.is_rog_mapcontroller_loaded.value = true;
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) { subscription = indexController.rogMapController.mapEventStream.listen((MapEvent mapEvent) {
if (mapEvent is MapEventMoveStart) { if (mapEvent is MapEventMoveStart) {
} }
if (mapEvent is MapEventMoveEnd) { if (mapEvent is MapEventMoveEnd) {
//destinationController.is_gps_selected.value = true; //destinationController.is_gps_selected.value = true;
//indexController.mapController!.move(c.center, c.zoom); //indexController.mapController!.move(c.center, c.zoom);
LatLngBounds bounds = indexController.rogMapController!.bounds!; LatLngBounds bounds = indexController.rogMapController.bounds!;
indexController.currentBound.clear(); indexController.currentBound.clear();
indexController.currentBound.add(bounds); indexController.currentBound.add(bounds);
if(indexController.currentUser.length <= 0){ if(indexController.currentUser.isEmpty){
indexController.loadLocationsBound(); indexController.loadLocationsBound();
} }
} }
}); });
} , } ,
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1, zoom: 1,
maxZoom: 42, maxZoom: 42,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
), ),
children: [ children: [
BaseLayer(), const BaseLayer(),
Obx(() => Obx(() =>
indexController.routePointLenght > 0 ? indexController.routePointLenght > 0 ?
PolylineLayer( PolylineLayer(

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/auth_service.dart'; import 'package:rogapp/services/auth_service.dart';
@ -33,16 +32,16 @@ class DrawerPage extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: child:
indexController.currentUser.length == 0 ? indexController.currentUser.isEmpty ?
Flexible(child: Text("drawer_title".tr, style: TextStyle(color: Colors.black, fontSize: 20),)) Flexible(child: Text("drawer_title".tr, style: const TextStyle(color: Colors.black, fontSize: 20),))
: :
Text(indexController.currentUser[0]['user']['email'], style: TextStyle(color: Colors.black, fontSize: 20),), Text(indexController.currentUser[0]['user']['email'], style: const TextStyle(color: Colors.black, fontSize: 20),),
), ),
) )
), ),
), ),
Obx(() => Obx(() =>
indexController.currentUser.length == 0 ? indexController.currentUser.isEmpty ?
ListTile( ListTile(
leading: const Icon(Icons.login), leading: const Icon(Icons.login),
title: Text("login".tr), title: Text("login".tr),
@ -59,7 +58,7 @@ class DrawerPage extends StatelessWidget {
}, },
) )
), ),
indexController.currentUser.length > 0 ? indexController.currentUser.isNotEmpty ?
ListTile( ListTile(
leading: const Icon(Icons.password), leading: const Icon(Icons.password),
title: Text("change_password".tr), title: Text("change_password".tr),
@ -67,8 +66,8 @@ class DrawerPage extends StatelessWidget {
Get.toNamed(AppPages.CHANGE_PASSWORD); Get.toNamed(AppPages.CHANGE_PASSWORD);
}, },
) : ) :
Container(width: 0, height: 0,), const SizedBox(width: 0, height: 0,),
indexController.currentUser.length == 0 ? indexController.currentUser.isEmpty ?
ListTile( ListTile(
leading: const Icon(Icons.person), leading: const Icon(Icons.person),
title: Text("sign_up".tr), title: Text("sign_up".tr),
@ -76,8 +75,8 @@ class DrawerPage extends StatelessWidget {
Get.toNamed(AppPages.REGISTER); Get.toNamed(AppPages.REGISTER);
}, },
) : ) :
Container(width: 0, height: 0,), const SizedBox(width: 0, height: 0,),
indexController.currentUser.length > 0 ? indexController.currentUser.isNotEmpty ?
ListTile( ListTile(
leading: const Icon(Icons.delete_forever), leading: const Icon(Icons.delete_forever),
title: Text("delete_account".tr), title: Text("delete_account".tr),
@ -92,7 +91,7 @@ class DrawerPage extends StatelessWidget {
}); });
}, },
) : ) :
Container(width: 0, height: 0,), const SizedBox(width: 0, height: 0,),
// ListTile( // ListTile(
// leading: const Icon(Icons.person), // leading: const Icon(Icons.person),
// title: Text("profile".tr), // title: Text("profile".tr),
@ -108,7 +107,7 @@ class DrawerPage extends StatelessWidget {
// title: Text("point_rank".tr), // title: Text("point_rank".tr),
// onTap: (){}, // onTap: (){},
// ), // ),
indexController.currentUser.length > 0 ? indexController.currentUser.isNotEmpty ?
ListTile( ListTile(
leading: const Icon(Icons.featured_video), leading: const Icon(Icons.featured_video),
title: Text("rog_web".tr), title: Text("rog_web".tr),
@ -116,7 +115,7 @@ class DrawerPage extends StatelessWidget {
_launchURL("https://www.gifuai.net/?page_id=17397"); _launchURL("https://www.gifuai.net/?page_id=17397");
}, },
) : ) :
Container(width: 0, height: 0,), const SizedBox(width: 0, height: 0,),
ListTile( ListTile(
leading: const Icon(Icons.privacy_tip), leading: const Icon(Icons.privacy_tip),
title: Text("privacy".tr), title: Text("privacy".tr),

View File

@ -3,6 +3,8 @@ import 'package:get/get.dart';
import 'package:rogapp/pages/search/search_page.dart'; import 'package:rogapp/pages/search/search_page.dart';
class HomePage extends GetView{ class HomePage extends GetView{
const HomePage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(

View File

@ -1,7 +1,5 @@
import 'package:flutter_map/plugin_api.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
class IndexBinding extends Bindings { class IndexBinding extends Bindings {

View File

@ -124,7 +124,7 @@ class IndexController extends GetxController {
void onInit() { void onInit() {
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)")); _ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
if(perfectures.length == 0){ if(perfectures.isEmpty){
PerfectureService.loadPerfectures().then((value){ PerfectureService.loadPerfectures().then((value){
perfectures.add(value); perfectures.add(value);
loadAreaFor("9"); loadAreaFor("9");
@ -193,7 +193,7 @@ List<LatLng> getLocationsList(){
void login(String email, String password, BuildContext context){ void login(String email, String password, BuildContext context){
AuthService.login(email, password).then((value){ AuthService.login(email, password).then((value){
print("------- logged in user details ######## ${value} ###### --------"); print("------- logged in user details ######## $value ###### --------");
if(value.isNotEmpty){ if(value.isNotEmpty){
currentUser.clear(); currentUser.clear();
currentUser.add(value); currentUser.add(value);
@ -206,7 +206,7 @@ void login(String email, String password, BuildContext context){
getAction(); getAction();
} }
if(currentUser.length > 0){ if(currentUser.isNotEmpty){
rog_mode.value = 0 ; rog_mode.value = 0 ;
} }
else{ else{
@ -225,9 +225,9 @@ void login(String email, String password, BuildContext context){
Get.snackbar( Get.snackbar(
"Failed", "Failed",
"User login failed, please try again.", "User login failed, please try again.",
icon: Icon(Icons.error, size: 40.0, color: Colors.blue), icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -240,7 +240,7 @@ void login(String email, String password, BuildContext context){
String _token = currentUser[0]['token']; String _token = currentUser[0]['token'];
//print("------- change password ######## ${currentUser[0]['token']} ###### --------"); //print("------- change password ######## ${currentUser[0]['token']} ###### --------");
AuthService.changePassword(oldpassword, newpassword, _token).then((value){ AuthService.changePassword(oldpassword, newpassword, _token).then((value){
print("------- change password ######## ${value} ###### --------"); print("------- change password ######## $value ###### --------");
if(value.isNotEmpty){ if(value.isNotEmpty){
is_loading.value = false; is_loading.value = false;
Navigator.pop(context); Navigator.pop(context);
@ -254,9 +254,9 @@ void login(String email, String password, BuildContext context){
Get.snackbar( Get.snackbar(
'failed'.tr, 'failed'.tr,
'password_change_failed_please_try_again'.tr, 'password_change_failed_please_try_again'.tr,
icon: Icon(Icons.error, size: 40.0, color: Colors.blue), icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -271,9 +271,7 @@ void login(String email, String password, BuildContext context){
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.deleteAllDestinations().then((value){ db.deleteAllDestinations().then((value){
DestinationController destinationController = Get.find<DestinationController>(); DestinationController destinationController = Get.find<DestinationController>();
if(destinationController != null){
destinationController.PopulateDestinations(); destinationController.PopulateDestinations();
}
}); });
currentUser.clear(); currentUser.clear();
cats.clear(); cats.clear();
@ -293,9 +291,9 @@ void login(String email, String password, BuildContext context){
Get.snackbar( Get.snackbar(
'failed'.tr, 'failed'.tr,
'user_registration_failed_please_try_again'.tr, 'user_registration_failed_please_try_again'.tr,
icon: Icon(Icons.error, size: 40.0, color: Colors.blue), icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -304,13 +302,13 @@ void login(String email, String password, BuildContext context){
} }
void makeAction(BuildContext context){ void makeAction(BuildContext context){
int user_id = currentUser[0]["user"]["id"] as int; int userId = currentUser[0]["user"]["id"] as int;
int location_id = currentFeature[0].properties!["location_id"] as int; int locationId = currentFeature[0].properties!["location_id"] as int;
bool wanttogo = currentAction[0][0]["wanttogo"]; bool wanttogo = currentAction[0][0]["wanttogo"];
bool like = currentAction[0][0]["like"]; bool like = currentAction[0][0]["like"];
bool checkin = currentAction[0][0]["checkin"]; bool checkin = currentAction[0][0]["checkin"];
if(user_id > 0){ if(userId > 0){
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){ ActionService.makeAction(userId, locationId, wanttogo, like, checkin).then((value){
}); });
} }
@ -318,7 +316,7 @@ void login(String email, String password, BuildContext context){
String getCatText(){ String getCatText(){
String _cat = 'all'.tr; String _cat = 'all'.tr;
if(currentUser.length > 0){ if(currentUser.isNotEmpty){
Map<String, dynamic> _urs = currentUser[0]; Map<String, dynamic> _urs = currentUser[0];
print('-- is_rogaining :-- ${_urs['user']['is_rogaining']} ------'); print('-- is_rogaining :-- ${_urs['user']['is_rogaining']} ------');
if(_urs['user']['is_rogaining'] == true){ if(_urs['user']['is_rogaining'] == true){
@ -333,8 +331,8 @@ void login(String email, String password, BuildContext context){
void loadCatsv2(){ void loadCatsv2(){
dynamic initVal = {'category':getCatText()}; dynamic initVal = {'category':getCatText()};
LatLngBounds bounds = mapController!.bounds!; LatLngBounds bounds = mapController.bounds!;
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ if(bounds.southWest != null && bounds.northEast != 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) { 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.clear();
cats.add(initVal); cats.add(initVal);
@ -349,8 +347,8 @@ void login(String email, String password, BuildContext context){
void loadCatForCity(String city){ void loadCatForCity(String city){
dynamic initVal = {'category':getCatText()}; dynamic initVal = {'category':getCatText()};
LatLngBounds bounds = mapController!.bounds!; LatLngBounds bounds = mapController.bounds!;
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ if(bounds.southWest != null && bounds.northEast != null ){
CatService.loadCatByCity(city).then((value) { CatService.loadCatByCity(city).then((value) {
cats.clear(); cats.clear();
cats.add(initVal); cats.add(initVal);
@ -395,12 +393,12 @@ void login(String email, String password, BuildContext context){
} }
void loadUserDetails(){ void loadUserDetails(){
if(currentUser.length > 0){ if(currentUser.isNotEmpty){
int user_id = currentUser[0]["user"]["id"] as int; int userId = currentUser[0]["user"]["id"] as int;
AuthService.UserDetails(user_id).then((value){ AuthService.UserDetails(userId).then((value){
print("--------- user details ----- ${value}"); print("--------- user details ----- $value");
if(value != null && value.isNotEmpty){ if(value != null && value.isNotEmpty){
bool paid = value![0]["paid"] as bool; bool paid = value[0]["paid"] as bool;
if(paid){ if(paid){
loadCustomAreas(); loadCustomAreas();
} }
@ -413,7 +411,7 @@ void login(String email, String password, BuildContext context){
void loadCustomAreas(){ void loadCustomAreas(){
customAreas.clear(); customAreas.clear();
PerfectureService.loadCustomAreas().then((value){ PerfectureService.loadCustomAreas().then((value){
print("--- loading custom areas ${value}"); print("--- loading custom areas $value");
customAreas.add(value); customAreas.add(value);
}); });
} }
@ -431,7 +429,7 @@ void login(String email, String password, BuildContext context){
String getSubInitialVal(){ String getSubInitialVal(){
int min = 0; int min = 0;
if(subPerfs.length > 0){ if(subPerfs.isNotEmpty){
min = int.parse(subPerfs[0][0]['id'].toString()); min = int.parse(subPerfs[0][0]['id'].toString());
for(var sub in subPerfs[0]){ for(var sub in subPerfs[0]){
int x = int.parse(sub['id'].toString()); // as int; int x = int.parse(sub['id'].toString()); // as int;
@ -471,16 +469,16 @@ void login(String email, String password, BuildContext context){
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){ if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
cat = ""; cat = "";
} }
print("----- ${customarea}"); print("----- $customarea");
LocationService.loadCustomLocations(customarea, cat).then((value){ LocationService.loadCustomLocations(customarea, cat).then((value){
locations.clear(); locations.clear();
locations.add(value!); locations.add(value!);
List<LatLng> locs = getLocationsList(); List<LatLng> locs = getLocationsList();
LatLngBounds bounds = boundsFromLatLngList(locs); LatLngBounds bounds = boundsFromLatLngList(locs);
mapController!.fitBounds(bounds); mapController.fitBounds(bounds);
setBound(bounds); setBound(bounds);
Future.delayed(Duration(microseconds: 400), () { Future.delayed(const Duration(microseconds: 400), () {
mapController!.fitBounds(bounds); mapController.fitBounds(bounds);
}); });
}); });
@ -495,33 +493,33 @@ void login(String email, String password, BuildContext context){
if(currentCat.isNotEmpty && currentCat[0] == "-all-"){ if(currentCat.isNotEmpty && currentCat[0] == "-all-"){
cat = ""; cat = "";
} }
LatLngBounds bounds = mapController!.bounds!; LatLngBounds bounds = mapController.bounds!;
currentBound.clear(); currentBound.clear();
currentBound.add(bounds); currentBound.add(bounds);
//print(currentCat); //print(currentCat);
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){ if(bounds.southWest != null && bounds.northEast != null ){
LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){ LocationService.loadLocationsBound(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude, cat).then((value){
//print("---value length ------ ${value!.collection.length}"); //print("---value length ------ ${value!.collection.length}");
if(value == null){ if(value == null){
return; return;
} }
if(value != null && value.collection.isEmpty){ if(value.collection.isEmpty){
if(showPopup == false) { if(showPopup == false) {
return; return;
} }
Get.snackbar( Get.snackbar(
"Too many Points", "Too many Points",
"please zoom in", "please zoom in",
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
showPopup = false; showPopup = false;
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",)); //Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
} }
if(value != null && value.collection.isNotEmpty){ if(value.collection.isNotEmpty){
//print("---- added---"); //print("---- added---");
locations.add(value); locations.add(value);
loadCatsv2(); loadCatsv2();
@ -542,7 +540,7 @@ void login(String email, String password, BuildContext context){
LatLng lat1 = LatLng(value![1], value[0]); LatLng lat1 = LatLng(value![1], value[0]);
LatLng lat2 = LatLng(value[3], value[2]); LatLng lat2 = LatLng(value[3], value[2]);
LatLngBounds bound = LatLngBounds(lat1, lat2); LatLngBounds bound = LatLngBounds(lat1, lat2);
mapController!.fitBounds(bound); mapController.fitBounds(bound);
setBound(bound); setBound(bound);
}); });
@ -556,7 +554,7 @@ void login(String email, String password, BuildContext context){
LatLng lat1 = LatLng(value![1], value[0]); LatLng lat1 = LatLng(value![1], value[0]);
LatLng lat2 = LatLng(value[3], value[2]); LatLng lat2 = LatLng(value[3], value[2]);
LatLngBounds bound = LatLngBounds(lat1, lat2); LatLngBounds bound = LatLngBounds(lat1, lat2);
mapController!.fitBounds(bound); mapController.fitBounds(bound);
setBound(bound); setBound(bound);
}); });
@ -586,7 +584,7 @@ void login(String email, String password, BuildContext context){
GeoJsonFeature? getFeatureForLatLong(double lat, double long){ GeoJsonFeature? getFeatureForLatLong(double lat, double long){
if(locations.length > 0){ if(locations.isNotEmpty){
for(GeoJsonFeature i in locations[0].collection){ for(GeoJsonFeature i in locations[0].collection){
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint; GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){ if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){
@ -594,25 +592,26 @@ void login(String email, String password, BuildContext context){
} }
} }
} }
return null;
} }
void getAction(){ void getAction(){
//print(currentUser[0]["user"]["id"]); //print(currentUser[0]["user"]["id"]);
//print(currentFeature[0].properties!["location_id"]); //print(currentFeature[0].properties!["location_id"]);
if(currentUser.length == 0){ if(currentUser.isEmpty){
return; return;
} }
int user_id = currentUser[0]["user"]["id"] as int; int userId = currentUser[0]["user"]["id"] as int;
print("---- loc id ${currentFeature[0].properties}"); print("---- loc id ${currentFeature[0].properties}");
int location_id = currentFeature[0].properties!["location_id"] as int; int locationId = currentFeature[0].properties!["location_id"] as int;
ActionService.userAction(user_id, location_id).then((value){ ActionService.userAction(userId, locationId).then((value){
print("------${value}"); print("------$value");
if(value != null && value.length > 0){ if(value != null && value.isNotEmpty){
currentAction.clear(); currentAction.clear();
currentAction.add(value); currentAction.add(value);
print("------${currentAction[0]}"); print("------${currentAction[0]}");
}else{ }else{
List<dynamic> initval = [{"user": user_id, "location": location_id, "wanttogo": false, "like": false, "checkin": false}]; List<dynamic> initval = [{"user": userId, "location": locationId, "wanttogo": false, "like": false, "checkin": false}];
currentAction.clear(); currentAction.clear();
currentAction.add(initval); currentAction.add(initval);
} }
@ -632,15 +631,15 @@ void login(String email, String password, BuildContext context){
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){ if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
if(currentFeature.length > 0){ if(currentFeature.isNotEmpty){
currentFeature.clear(); currentFeature.clear();
} }
if(i >= locations[0].collection.length - 1 ){ if(i >= locations[0].collection.length - 1 ){
currentFeature.add(locations[0].collection[0] as GeoJsonFeature); currentFeature.add(locations[0].collection[0]);
getAction(); getAction();
} }
else{ else{
currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature); currentFeature.add(locations[0].collection[i + 1]);
getAction(); getAction();
} }
} }
@ -665,15 +664,15 @@ void login(String email, String password, BuildContext context){
if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){ if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
if(currentFeature.length > 0){ if(currentFeature.isNotEmpty){
currentFeature.clear(); currentFeature.clear();
} }
if(i == 0 ){ if(i == 0 ){
currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature); currentFeature.add(locations[0].collection[locations[0].collection.length -1]);
getAction(); getAction();
} }
else{ else{
currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature); currentFeature.add(locations[0].collection[i - 1]);
getAction(); getAction();
} }
} }

View File

@ -1,20 +1,13 @@
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/drawer/drawer_page.dart'; import 'package:rogapp/pages/drawer/drawer_page.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/bread_crum_widget.dart';
import 'package:rogapp/widgets/cat_widget.dart';
import 'package:rogapp/widgets/list_widget.dart'; import 'package:rogapp/widgets/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart'; import 'package:rogapp/widgets/map_widget.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
class IndexPage extends GetView<IndexController> { class IndexPage extends GetView<IndexController> {
IndexPage({Key? key}) : super(key: key); IndexPage({Key? key}) : super(key: key);
@ -43,7 +36,7 @@ class IndexPage extends GetView<IndexController> {
onPressed: (){ onPressed: (){
destinationController.fixMapBound(); destinationController.fixMapBound();
}, },
icon: Icon(Icons.refresh) icon: const Icon(Icons.refresh)
), ),
InkWell( InkWell(
onTap: (){ onTap: (){
@ -76,7 +69,7 @@ class IndexPage extends GetView<IndexController> {
Padding( Padding(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell( child: InkWell(
child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,), child: const Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,),
onTap: (){ onTap: (){
//indexController.switchPage(AppPages.TRAVEL); //indexController.switchPage(AppPages.TRAVEL);
}, },
@ -85,7 +78,7 @@ class IndexPage extends GetView<IndexController> {
Padding( Padding(
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell( child: InkWell(
child: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,), child: const Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,),
onTap: (){ onTap: (){
//indexController.switchPage(AppPages.TRAVEL); //indexController.switchPage(AppPages.TRAVEL);
}, },
@ -108,9 +101,9 @@ class IndexPage extends GetView<IndexController> {
tooltip: 'Increment', tooltip: 'Increment',
child: Obx(() => child: Obx(() =>
indexController.mode == 0 ? indexController.mode == 0 ?
Image(image: AssetImage('assets/images/list2.png')) const Image(image: AssetImage('assets/images/list2.png'))
: :
Image(image: AssetImage('assets/images/map.png')), const Image(image: AssetImage('assets/images/map.png')),
), ),
elevation: 4.0, elevation: 4.0,
), ),
@ -168,7 +161,7 @@ class IndexPage extends GetView<IndexController> {
child: Obx(() => child: Obx(() =>
indexController.mode == 0 ? indexController.mode == 0 ?
MapWidget() : MapWidget() :
ListWidget(), const ListWidget(),
) )
) )

View File

@ -17,18 +17,18 @@ class _LandingPageState extends State<LandingPage> {
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30), padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( const Text(
"こんにちは!", "こんにちは!",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
), ),
SizedBox(height: 30,), const SizedBox(height: 30,),
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます", Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
@ -38,11 +38,11 @@ class _LandingPageState extends State<LandingPage> {
), ),
Container( Container(
height: MediaQuery.of(context).size.height/3, height: MediaQuery.of(context).size.height/3,
decoration: BoxDecoration( decoration: const BoxDecoration(
image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg')) image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg'))
), ),
), ),
SizedBox(height: 20.0,), const SizedBox(height: 20.0,),
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height:60, height:60,
@ -51,18 +51,18 @@ class _LandingPageState extends State<LandingPage> {
}, },
color: Colors.indigoAccent[400], color: Colors.indigoAccent[400],
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: BorderSide( side: const BorderSide(
color: Colors.black, color: Colors.black,
), ),
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("ログイン",style: TextStyle( child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
), ),
SizedBox(height: 15.0,), const SizedBox(height: 15.0,),
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
@ -74,7 +74,7 @@ class _LandingPageState extends State<LandingPage> {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("サインアップ",style: TextStyle( child: const Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16, fontWeight: FontWeight.w600,fontSize: 16,
),), ),),

View File

@ -7,8 +7,8 @@ class LoadingPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
margin: EdgeInsets.only(top: 20), margin: const EdgeInsets.only(top: 20),
child: CircularProgressIndicator( child: const CircularProgressIndicator(
value: 0.8, value: 0.8,
) )
); );

View File

@ -11,6 +11,8 @@ class LoginPage extends StatelessWidget {
TextEditingController emailController = TextEditingController(); TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController(); TextEditingController passwordController = TextEditingController();
LoginPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -22,11 +24,11 @@ class LoginPage extends StatelessWidget {
leading: leading:
IconButton( onPressed: (){ IconButton( onPressed: (){
Navigator.pop(context); Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
), ),
body: body:
indexController.currentUser.length == 0 ? indexController.currentUser.isEmpty ?
Container( SizedBox(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -37,16 +39,16 @@ class LoginPage extends StatelessWidget {
children: [ children: [
Container( Container(
height: MediaQuery.of(context).size.height/6, height: MediaQuery.of(context).size.height/6,
decoration: BoxDecoration( decoration: const BoxDecoration(
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg')) image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
), ),
), ),
SizedBox(height: 5,), const SizedBox(height: 5,),
], ],
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 40 horizontal: 40
), ),
child: Column( child: Column(
@ -57,9 +59,9 @@ class LoginPage extends StatelessWidget {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 40), padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container( child: Container(
padding: EdgeInsets.only(top: 3,left: 3), padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
), ),
@ -74,7 +76,7 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: CircularProgressIndicator(), child: const CircularProgressIndicator(),
) : ) :
Column( Column(
children: [ children: [
@ -86,9 +88,9 @@ class LoginPage extends StatelessWidget {
Get.snackbar( Get.snackbar(
"no_values".tr, "no_values".tr,
"email_and_password_required".tr, "email_and_password_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -101,12 +103,12 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("ログイン",style: TextStyle( child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
), ),
SizedBox(height: 5.0,), const SizedBox(height: 5.0,),
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height:40, height:40,
@ -117,12 +119,12 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("sign_up".tr,style: TextStyle( child: Text("sign_up".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
), ),
SizedBox(height: 2.0,), const SizedBox(height: 2.0,),
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height:40, height:40,
@ -133,7 +135,7 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("cancel".tr,style: TextStyle( child: Text("cancel".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
@ -144,14 +146,14 @@ class LoginPage extends StatelessWidget {
), ),
) )
), ),
SizedBox(height: 5,), const SizedBox(height: 5,),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Flexible( Flexible(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle( child: Text("rogaining_user_need_tosign_up".tr, style: const TextStyle(
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
),), ),),
), ),
@ -164,7 +166,7 @@ class LoginPage extends StatelessWidget {
Flexible( Flexible(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text("app_developed_by_gifu_dx".tr, style: TextStyle( child: Text("app_developed_by_gifu_dx".tr, style: const TextStyle(
overflow: TextOverflow.ellipsis, fontSize: 10.0 overflow: TextOverflow.ellipsis, fontSize: 10.0
),), ),),
), ),
@ -182,7 +184,7 @@ class LoginPage extends StatelessWidget {
onPressed: (){ onPressed: (){
indexController.currentUser.clear(); indexController.currentUser.clear();
}, },
child: Text("Already Logged in, Click to logout"), child: const Text("Already Logged in, Click to logout"),
), ),
) )
, ,
@ -194,17 +196,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(label,style:TextStyle( Text(label,style:const TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black87 color: Colors.black87
),), ),),
SizedBox(height: 5,), const SizedBox(height: 5,),
TextField( TextField(
controller: controller, controller: controller,
obscureText: obsureText, obscureText: obsureText,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: (Colors.grey[400])!, color: (Colors.grey[400])!,
@ -216,7 +218,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
), ),
), ),
), ),
SizedBox(height: 30.0,) const SizedBox(height: 30.0,)
], ],
); );
} }

View File

@ -22,11 +22,11 @@ class LoginPopupPage extends StatelessWidget {
leading: leading:
IconButton( onPressed: (){ IconButton( onPressed: (){
Navigator.pop(context); Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
), ),
body: body:
indexController.currentUser.length == 0 ? indexController.currentUser.isEmpty ?
Container( SizedBox(
width: double.infinity, width: double.infinity,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -37,16 +37,16 @@ class LoginPopupPage extends StatelessWidget {
children: [ children: [
Container( Container(
height: MediaQuery.of(context).size.height/5, height: MediaQuery.of(context).size.height/5,
decoration: BoxDecoration( decoration: const BoxDecoration(
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg')) image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
), ),
), ),
SizedBox(height: 5,), const SizedBox(height: 5,),
], ],
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 40 horizontal: 40
), ),
child: Column( child: Column(
@ -57,9 +57,9 @@ class LoginPopupPage extends StatelessWidget {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 40), padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container( child: Container(
padding: EdgeInsets.only(top: 3,left: 3), padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
), ),
@ -74,7 +74,7 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: CircularProgressIndicator(), child: const CircularProgressIndicator(),
) : ) :
Column( Column(
children: [ children: [
@ -86,9 +86,9 @@ class LoginPopupPage extends StatelessWidget {
Get.snackbar( Get.snackbar(
"no_values".tr, "no_values".tr,
"email_and_password_required".tr, "email_and_password_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -101,12 +101,12 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("ログイン",style: TextStyle( child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
), ),
SizedBox(height: 19.0,), const SizedBox(height: 19.0,),
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height:50, height:50,
@ -117,12 +117,12 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("sign_up".tr,style: TextStyle( child: Text("sign_up".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
), ),
SizedBox(height: 19.0,), const SizedBox(height: 19.0,),
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height:50, height:50,
@ -133,7 +133,7 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("cancel".tr,style: TextStyle( child: Text("cancel".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70 fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
), ),
), ),
@ -144,14 +144,14 @@ class LoginPopupPage extends StatelessWidget {
), ),
) )
), ),
SizedBox(height: 20,), const SizedBox(height: 20,),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Flexible( Flexible(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle( child: Text("rogaining_user_need_tosign_up".tr, style: const TextStyle(
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
),), ),),
), ),
@ -169,7 +169,7 @@ class LoginPopupPage extends StatelessWidget {
onPressed: (){ onPressed: (){
indexController.currentUser.clear(); indexController.currentUser.clear();
}, },
child: Text("Already Logged in, Click to logout"), child: const Text("Already Logged in, Click to logout"),
), ),
) )
, ,
@ -181,17 +181,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(label,style:TextStyle( Text(label,style:const TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black87 color: Colors.black87
),), ),),
SizedBox(height: 5,), const SizedBox(height: 5,),
TextField( TextField(
controller: controller, controller: controller,
obscureText: obsureText, obscureText: obsureText,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: (Colors.grey[400])!, color: (Colors.grey[400])!,
@ -203,7 +203,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
), ),
), ),
), ),
SizedBox(height: 30.0,) const SizedBox(height: 30.0,)
], ],
); );
} }

View File

@ -11,7 +11,7 @@ class MainPerfPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text("Select Main Perfecture"), title: const Text("Select Main Perfecture"),
), ),
body: ListView.builder( body: ListView.builder(
itemCount: indexController.perfectures.length, itemCount: indexController.perfectures.length,
@ -19,7 +19,7 @@ class MainPerfPage extends StatelessWidget {
return ListTile( return ListTile(
onTap: (){ onTap: (){
indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString(); indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!); indexController.populateForPerf(indexController.dropdownValue, indexController.mapController);
Get.back(); Get.back();
}, },
title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()), title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),

View File

@ -5,7 +5,7 @@ import 'package:rogapp/routes/app_pages.dart';
import 'dart:io'; import 'dart:io';
class PermissionHandlerScreen extends StatefulWidget { class PermissionHandlerScreen extends StatefulWidget {
PermissionHandlerScreen({Key? key}) : super(key: key); const PermissionHandlerScreen({Key? key}) : super(key: key);
@override @override
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState(); State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
@ -20,10 +20,10 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
barrierDismissible: false, // user must tap button! barrierDismissible: false, // user must tap button!
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text('ロケーション許可'), title: Text('ロケーション許可'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: const <Widget>[ children: <Widget>[
Text( 'このアプリでは、位置情報の収集を行います。'), Text( 'このアプリでは、位置情報の収集を行います。'),
Text( 'このアプリでは、開始時点で位置情報を収集します。'), Text( 'このアプリでは、開始時点で位置情報を収集します。'),
], ],
@ -58,7 +58,6 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
permissionServiceCall() async { permissionServiceCall() async {
await permissionServices().then( await permissionServices().then(
(value) { (value) {
if (value != null) {
if (value[Permission.location]!.isGranted ) { if (value[Permission.location]!.isGranted ) {
/* ========= New Screen Added ============= */ /* ========= New Screen Added ============= */
@ -72,7 +71,6 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
else{ else{
_showMyDialog(); _showMyDialog();
} }
}
}, },
); );
} }
@ -153,7 +151,7 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
}); });
return Scaffold( return Scaffold(
body: Container( body: Container(
child: Text(""), child: const Text(""),
), ),
); );
} }
@ -162,10 +160,10 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) => AlertDialog(
title: const Text('無効'), title: Text('無効'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: const <Widget>[ children: <Widget>[
Text( '位置情報が無効になっています'), Text( '位置情報が無効になっています'),
Text('このアプリケーションへの位置情報アクセスが無効になっています。続行するには設定>プライバシーとセキュリティ>位置情報サービス>岐阜ナビ で有効にしてください。'), Text('このアプリケーションへの位置情報アクセスが無効になっています。続行するには設定>プライバシーとセキュリティ>位置情報サービス>岐阜ナビ で有効にしてください。'),
], ],
@ -189,10 +187,10 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
showDialog( showDialog(
context: context, context: context,
builder: (_) => AlertDialog( builder: (_) => AlertDialog(
title: const Text('ロケーション許可'), title: Text('ロケーション許可'),
content: SingleChildScrollView( content: SingleChildScrollView(
child: ListBody( child: ListBody(
children: const <Widget>[ children: <Widget>[
Text( 'このアプリでは、位置情報の収集を行います。'), Text( 'このアプリでは、位置情報の収集を行います。'),
Text('岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'), Text('岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'),
], ],

View File

@ -1,7 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
class ProgressPage extends StatelessWidget { class ProgressPage extends StatelessWidget {
const ProgressPage({Key? key}) : super(key: key); const ProgressPage({Key? key}) : super(key: key);
@ -10,7 +7,7 @@ class ProgressPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
color: Colors.transparent, color: Colors.transparent,
child: Center( child: const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
), ),
); );

View File

@ -13,6 +13,8 @@ class RegisterPage extends StatelessWidget {
TextEditingController passwordController = TextEditingController(); TextEditingController passwordController = TextEditingController();
TextEditingController confirmPasswordController = TextEditingController(); TextEditingController confirmPasswordController = TextEditingController();
RegisterPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -24,11 +26,11 @@ class RegisterPage extends StatelessWidget {
leading: leading:
IconButton( onPressed: (){ IconButton( onPressed: (){
Navigator.pop(context); Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)), },icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
), ),
body: SafeArea( body: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: SizedBox(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
width: double.infinity, width: double.infinity,
child: Column( child: Column(
@ -39,20 +41,20 @@ class RegisterPage extends StatelessWidget {
Column( Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
Text ("サインアップ", style: TextStyle( const Text ("サインアップ", style: TextStyle(
fontSize: 30, fontSize: 30,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
),), ),),
SizedBox(height: 20,), const SizedBox(height: 20,),
Text("アカウントを作成し、無料です",style: TextStyle( Text("アカウントを作成し、無料です",style: TextStyle(
fontSize: 15, fontSize: 15,
color: Colors.grey[700], color: Colors.grey[700],
),), ),),
SizedBox(height: 30,) const SizedBox(height: 30,)
], ],
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 40 horizontal: 40
), ),
child: Column( child: Column(
@ -64,12 +66,12 @@ class RegisterPage extends StatelessWidget {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 40), padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container( child: Container(
padding: EdgeInsets.only(top: 3,left: 3), padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
border: Border( border: const Border(
bottom: BorderSide(color: Colors.black), bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black), top: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black), right: BorderSide(color: Colors.black),
@ -84,9 +86,9 @@ class RegisterPage extends StatelessWidget {
Get.snackbar( Get.snackbar(
"No match", "No match",
"Passwords does not match", "Passwords does not match",
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -95,9 +97,9 @@ class RegisterPage extends StatelessWidget {
Get.snackbar( Get.snackbar(
"no_values".tr, "no_values".tr,
"email_and_password_required".tr, "email_and_password_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue), icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800), duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow, backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png")) //icon:Image(image:AssetImage("assets/images/dora.png"))
); );
@ -110,23 +112,23 @@ class RegisterPage extends StatelessWidget {
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40) borderRadius: BorderRadius.circular(40)
), ),
child: Text("sign_up".tr,style: TextStyle( child: Text("sign_up".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16, fontWeight: FontWeight.w600,fontSize: 16,
),), ),),
), ),
), ),
), ),
SizedBox(height: 20,), const SizedBox(height: 20,),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Flexible(child: Text("すでにアカウントをお持ちですか?")), const Flexible(child: Text("すでにアカウントをお持ちですか?")),
TextButton( TextButton(
onPressed: (){ onPressed: (){
Get.toNamed(AppPages.LOGIN); Get.toNamed(AppPages.LOGIN);
}, },
child: Text("ログイン",style: TextStyle( child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 18 fontSize: 18
),), ),),
@ -149,17 +151,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(label,style:TextStyle( Text(label,style:const TextStyle(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Colors.black87 color: Colors.black87
),), ),),
SizedBox(height: 5,), const SizedBox(height: 5,),
TextField( TextField(
controller: controller, controller: controller,
obscureText: obsureText, obscureText: obsureText,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10), contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: (Colors.grey[400])!, color: (Colors.grey[400])!,
@ -171,7 +173,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
), ),
), ),
), ),
SizedBox(height: 30,) const SizedBox(height: 30,)
], ],
); );

View File

@ -1,8 +1,5 @@
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
class SearchBarController extends GetxController { class SearchBarController extends GetxController {

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
@ -15,7 +14,7 @@ class SearchPage extends StatelessWidget {
Image getImage(int index){ Image getImage(int index){
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){ if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
return Image( return Image(
@ -52,11 +51,11 @@ class SearchPage extends StatelessWidget {
fontSize: 15.0, fontSize: 15.0,
), ),
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder(), border: const OutlineInputBorder(),
hintText: "検索", hintText: "検索",
prefixIcon: Icon(Icons.search), prefixIcon: const Icon(Icons.search),
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon(Icons.clear), icon: const Icon(Icons.clear),
onPressed: () { onPressed: () {
// clear the text field // clear the text field
}, },
@ -70,7 +69,7 @@ class SearchPage extends StatelessWidget {
itemBuilder: (context, GeoJsonFeature suggestion){ itemBuilder: (context, GeoJsonFeature suggestion){
return ListTile( return ListTile(
title: Text(suggestion.properties!["location_name"]), title: Text(suggestion.properties!["location_name"]),
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""), subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : const Text(""),
//leading: getImage(index), //leading: getImage(index),
); );
}, },

View File

@ -11,7 +11,7 @@ class SubPerfPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text("Select Sub Perfecture"), title: const Text("Select Sub Perfecture"),
), ),
body: ListView.builder( body: ListView.builder(
itemCount: indexController.subPerfs.length, itemCount: indexController.subPerfs.length,

View File

@ -72,7 +72,7 @@ class AppPages {
), ),
GetPage( GetPage(
name: Routes.LANDING, name: Routes.LANDING,
page: () => LandingPage(), page: () => const LandingPage(),
//binding: SpaBinding(), //binding: SpaBinding(),
), ),
GetPage( GetPage(
@ -92,7 +92,7 @@ class AppPages {
), ),
GetPage( GetPage(
name: Routes.LOADING, name: Routes.LOADING,
page: () => LoadingPage(), page: () => const LoadingPage(),
//binding: DestinationBinding(), //binding: DestinationBinding(),
), ),
GetPage( GetPage(
@ -102,12 +102,12 @@ class AppPages {
), ),
GetPage( GetPage(
name: Routes.HOME, name: Routes.HOME,
page: () => HomePage(), page: () => const HomePage(),
binding: HomeBinding(), binding: HomeBinding(),
), ),
GetPage( GetPage(
name: Routes.PERMISSION, name: Routes.PERMISSION,
page: () => PermissionHandlerScreen(), page: () => const PermissionHandlerScreen(),
), ),
GetPage( GetPage(
name: Routes.SEARCH, name: Routes.SEARCH,
@ -124,11 +124,11 @@ class AppPages {
), ),
GetPage( GetPage(
name: Routes.CITY, name: Routes.CITY,
page: () => CityPage(), page: () => const CityPage(),
), ),
GetPage( GetPage(
name: Routes.CATEOGORY, name: Routes.CATEOGORY,
page: () => CategoryPage(), page: () => const CategoryPage(),
), ),
GetPage( GetPage(
name: Routes.CHANGE_PASSWORD, name: Routes.CHANGE_PASSWORD,
@ -140,7 +140,7 @@ class AppPages {
), ),
GetPage( GetPage(
name: Routes.PROGRESS, name: Routes.PROGRESS,
page: () => ProgressPage(), page: () => const ProgressPage(),
) )
]; ];
} }

View File

@ -5,14 +5,14 @@ import 'package:rogapp/utils/const.dart';
class ActionService{ class ActionService{
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async { static Future<Map<String, dynamic>> makeAction(int userId, int locationId, bool wanttogo, bool like, bool checkin) async {
print("----- action is ---- ${like}-- ${wanttogo}-- ${checkin}"); print("----- action is ---- $like-- $wanttogo-- $checkin");
Map<String, dynamic> cats = {}; Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}"; String url = "$serverUrl/api/makeaction/?user_id=$userId&location_id=$locationId&wanttogo=$wanttogo&like=$like&checkin=$checkin";
//String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}"; //String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
print('++++++++${url}'); print('++++++++$url');
print("url is ------ ${url}"); print("url is ------ $url");
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -27,11 +27,11 @@ class ActionService{
} }
static Future<List<dynamic>?> userAction(int user_id, int location_id) async { static Future<List<dynamic>?> userAction(int userId, int locationId) async {
List<dynamic> cats = []; List<dynamic> cats = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}'; String url = '$serverUrl/api/useraction/?user_id=$userId&location_id=$locationId';
print('++++++++${url}'); print('++++++++$url');
//String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}'; //String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{

View File

@ -8,14 +8,14 @@ class AuthService{
static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async { static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async {
Map<String, dynamic> changePassword = {}; Map<String, dynamic> changePassword = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/change-password/'; String url = '$serverUrl/api/change-password/';
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.put( final http.Response response = await http.put(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}' 'Authorization': 'Token $token'
}, },
body: jsonEncode(<String, String>{ body: jsonEncode(<String, String>{
'old_password': oldpassword, 'old_password': oldpassword,
@ -31,11 +31,11 @@ class AuthService{
static Future<Map<String, dynamic>> login(String email, String password) async { 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 = {}; Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/login/'; String url = '$serverUrl/api/login/';
print('++++++++${url}'); print('++++++++$url');
//String url = 'http://localhost:8100/api/login/'; //String url = 'http://localhost:8100/api/login/';
final http.Response response = await http.post( final http.Response response = await http.post(
Uri.parse(url), Uri.parse(url),
@ -57,9 +57,9 @@ class AuthService{
static Future<Map<String, dynamic>> register(String email, String password) async { static Future<Map<String, dynamic>> register(String email, String password) async {
Map<String, dynamic> cats = {}; Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/register/'; String url = '$serverUrl/api/register/';
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.post( final http.Response response = await http.post(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -79,14 +79,14 @@ class AuthService{
static Future<Map<String, dynamic>> deleteUser(String token) async { static Future<Map<String, dynamic>> deleteUser(String token) async {
Map<String, dynamic> cats = {}; Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/delete-account/'; String url = '$serverUrl/api/delete-account/';
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}' 'Authorization': 'Token $token'
} }
); );
@ -99,10 +99,10 @@ class AuthService{
static Future<List<dynamic>?> UserDetails(int userid) async { static Future<List<dynamic>?> UserDetails(int userid) async {
List<dynamic> cats = []; List<dynamic> cats = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/userdetials?user_id=${userid}'; String url = '$serverUrl/api/userdetials?user_id=$userid';
print('++++++++${url}'); print('++++++++$url');
print("---- UserDetails url is ${url}"); print("---- UserDetails url is $url");
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import '../utils/const.dart'; import '../utils/const.dart';
@ -9,9 +8,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 { static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
List<dynamic> cats = []; List<dynamic> cats = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}'; String url = '$serverUrl/api/cats/?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -28,9 +27,9 @@ class CatService{
static Future<List<dynamic>?> loadCatByCity(String cityname)async { static Future<List<dynamic>?> loadCatByCity(String cityname)async {
List<dynamic> cats = []; List<dynamic> cats = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/catbycity/?${cityname}'; String url = '$serverUrl/api/catbycity/?$cityname';
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -11,11 +11,11 @@ import '../utils/const.dart';
class DestinationService{ class DestinationService{
static Future<List<dynamic>> getDestinations(int user_id) async { static Future<List<dynamic>> getDestinations(int userId) async {
List<dynamic> cats = []; List<dynamic> cats = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = "${server_url}/api/destinations/?user_id=${user_id}"; String url = "$serverUrl/api/destinations/?user_id=$userId";
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -29,11 +29,11 @@ class DestinationService{
return cats; return cats;
} }
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async { static Future<Map<String, dynamic>> deleteDestination(int destId) async {
Map<String, dynamic> cats = {}; Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}"; String url = "$serverUrl/api/delete_destination/?dest_id=$destId";
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -44,15 +44,15 @@ class DestinationService{
if (response.statusCode == 200) { if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes)); cats = json.decode(utf8.decode(response.bodyBytes));
} }
print("####### ---- ${cats}"); print("####### ---- $cats");
return cats; return cats;
} }
static Future<int> updateOrder(int action_id, int order, String dir) async { static Future<int> updateOrder(int actionId, int order, String dir) async {
int cats = 0; int cats = 0;
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}"; String url = "$serverUrl/api/updateorder/?user_action_id=$actionId&order=$order&dir=$dir";
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -69,7 +69,7 @@ class DestinationService{
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations, Map<String, dynamic> mtx) async{ static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations, Map<String, dynamic> mtx) async{
PolylinePoints polylinePoints = PolylinePoints(); PolylinePoints polylinePoints = PolylinePoints();
if(destinations.length <= 0){ if(destinations.isEmpty){
return []; return [];
} }
@ -90,7 +90,7 @@ class DestinationService{
int j = 0; int j = 0;
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: false); PolylineWayPoint pwp = PolylineWayPoint(location: "$la,$ln", stopOver: false);
//print("----- UUUUUU ${pwp}"); //print("----- UUUUUU ${pwp}");
@ -101,13 +101,13 @@ class DestinationService{
} }
final DestinationController destinationController = Get.find<DestinationController>(); final DestinationController destinationController = Get.find<DestinationController>();
int trav_mode = destinationController.travelMode.value; int travMode = destinationController.travelMode.value;
String _mode = "WALKING"; String _mode = "WALKING";
if(trav_mode == 1){ if(travMode == 1){
//_mode = TravelMode.driving; //_mode = TravelMode.driving;
_mode = "DRIVING"; _mode = "DRIVING";
} }
else if(trav_mode == 2) { else if(travMode == 2) {
//_mode = TravelMode.transit; //_mode = TravelMode.transit;
_mode = "TRANSIT"; _mode = "TRANSIT";
} }

View File

@ -2,12 +2,10 @@ import 'dart:io';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/model/rog.dart'; import 'package:rogapp/model/rog.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/database_helper.dart';
import 'package:sqflite/sqlite_api.dart';
import 'dart:convert'; import 'dart:convert';
import '../utils/const.dart'; import '../utils/const.dart';
@ -35,7 +33,7 @@ class ExternalService {
Map<String, dynamic> _res = {}; Map<String, dynamic> _res = {};
int user_id = indexController.currentUser[0]["user"]["id"]; int userId = indexController.currentUser[0]["user"]["id"];
//print("--- Pressed -----"); //print("--- Pressed -----");
String _team = indexController.currentUser[0]["user"]['team_name']; String _team = indexController.currentUser[0]["user"]['team_name'];
//print("--- _team : ${_team}-----"); //print("--- _team : ${_team}-----");
@ -47,7 +45,7 @@ class ExternalService {
id:1, id:1,
team_name: _team, team_name: _team,
event_code : _event_code, event_code : _event_code,
user_id: user_id, user_id: userId,
cp_number: -1, cp_number: -1,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: null, image: null,
@ -57,7 +55,7 @@ class ExternalService {
} }
else { else {
String url = 'https://rogaining.sumasen.net/gifuroge/start_from_rogapp'; String url = 'https://rogaining.sumasen.net/gifuroge/start_from_rogapp';
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.post( final http.Response response = await http.post(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -73,17 +71,17 @@ class ExternalService {
if (response.statusCode == 200) { if (response.statusCode == 200) {
_res = json.decode(utf8.decode(response.bodyBytes)); _res = json.decode(utf8.decode(response.bodyBytes));
print('----_res : ${_res} ----'); print('----_res : $_res ----');
} }
} }
return _res; return _res;
} }
Future<Map<String, dynamic>> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async { Future<Map<String, dynamic>> makeCheckpoint(int userId, String token, String checkinTime, String teamname, int cp, String eventcode, String imageurl) async {
//print("--cpcp-- ${cp}"); //print("--cpcp-- ${cp}");
Map<String, dynamic> _res = {}; Map<String, dynamic> _res = {};
String url = 'https://rogaining.sumasen.net/gifuroge/checkin_from_rogapp'; String url = 'https://rogaining.sumasen.net/gifuroge/checkin_from_rogapp';
print('++++++++${url}'); print('++++++++$url');
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
if(imageurl != null){ if(imageurl != null){
@ -94,7 +92,7 @@ class ExternalService {
id:1, id:1,
team_name: teamname, team_name: teamname,
event_code : eventcode, event_code : eventcode,
user_id: user_id, user_id: userId,
cp_number: cp, cp_number: cp,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: imageurl, image: imageurl,
@ -103,31 +101,31 @@ class ExternalService {
db.insertRogaining(_rog); db.insertRogaining(_rog);
} }
else { else {
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url1 = "${server_url}/api/checkinimage/"; String url1 = "$serverUrl/api/checkinimage/";
final im1Bytes = File(imageurl!).readAsBytesSync(); final im1Bytes = File(imageurl).readAsBytesSync();
String im1_64 = base64Encode(im1Bytes); String im1_64 = base64Encode(im1Bytes);
final http.Response response = await http.post( final http.Response response = await http.post(
Uri.parse(url1), Uri.parse(url1),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}' 'Authorization': 'Token $token'
}, },
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
body: jsonEncode(<String, String>{ body: jsonEncode(<String, String>{
'user' : user_id.toString(), 'user' : userId.toString(),
'team_name': teamname, 'team_name': teamname,
'event_code': eventcode, 'event_code': eventcode,
'checkinimage' : im1_64, 'checkinimage' : im1_64,
'checkintime' : checkin_time, 'checkintime' : checkinTime,
'cp_number' : cp.toString() 'cp_number' : cp.toString()
}), }),
); );
_res = json.decode(utf8.decode(response.bodyBytes)); _res = json.decode(utf8.decode(response.bodyBytes));
print("-----@@@@@ ${_res} -----"); print("-----@@@@@ $_res -----");
if(response.statusCode == 201){ if(response.statusCode == 201){
//print('---- toekn is ${token} -----'); //print('---- toekn is ${token} -----');
@ -149,11 +147,11 @@ class ExternalService {
'event_code': eventcode, 'event_code': eventcode,
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') 'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
}); });
print("--json-- ${vv}"); print("--json-- $vv");
print("--- checnin response ${response2.statusCode}----"); print("--- checnin response ${response2.statusCode}----");
if (response2.statusCode == 200) { if (response2.statusCode == 200) {
_res = json.decode(utf8.decode(response2.bodyBytes)); _res = json.decode(utf8.decode(response2.bodyBytes));
print('----checkin res _res : ${_res} ----'); print('----checkin res _res : $_res ----');
} }
} }
} }
@ -165,7 +163,7 @@ class ExternalService {
id:1, id:1,
team_name: teamname, team_name: teamname,
event_code : eventcode, event_code : eventcode,
user_id: user_id, user_id: userId,
cp_number: cp, cp_number: cp,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: null, image: null,
@ -192,11 +190,11 @@ class ExternalService {
'event_code': eventcode, 'event_code': eventcode,
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') 'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
}); });
print("--json-- ${vvv}"); print("--json-- $vvv");
print("--- checnin response ${response3.statusCode}----"); print("--- checnin response ${response3.statusCode}----");
if (response3.statusCode == 200) { if (response3.statusCode == 200) {
_res = json.decode(utf8.decode(response3.bodyBytes)); _res = json.decode(utf8.decode(response3.bodyBytes));
print('----checkin res _res : ${_res} ----'); print('----checkin res _res : $_res ----');
} }
} }
} }
@ -204,7 +202,7 @@ class ExternalService {
} }
Future<Map<String, dynamic>> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async { Future<Map<String, dynamic>> makeGoal(int userId, String token, String teamname, String image, String goalTime, String eventcode) async {
Map<String, dynamic> _res2 = {}; Map<String, dynamic> _res2 = {};
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
@ -216,7 +214,7 @@ class ExternalService {
id:1, id:1,
team_name: teamname, team_name: teamname,
event_code : eventcode, event_code : eventcode,
user_id: user_id, user_id: userId,
cp_number: -1, cp_number: -1,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch, checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: image, image: image,
@ -225,33 +223,33 @@ class ExternalService {
db.insertRogaining(_rog); db.insertRogaining(_rog);
// } // }
// else{ // else{
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url1 = "${server_url}/api/goalimage/"; String url1 = "$serverUrl/api/goalimage/";
final im1Bytes = File(image!).readAsBytesSync(); final im1Bytes = File(image).readAsBytesSync();
String im1_64 = base64Encode(im1Bytes); String im1_64 = base64Encode(im1Bytes);
final http.Response response = await http.post( final http.Response response = await http.post(
Uri.parse(url1), Uri.parse(url1),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}' 'Authorization': 'Token $token'
}, },
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number' // 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
body: jsonEncode(<String, String>{ body: jsonEncode(<String, String>{
'user' : user_id.toString(), 'user' : userId.toString(),
'team_name': teamname, 'team_name': teamname,
'event_code': eventcode, 'event_code': eventcode,
'goaltime' : goal_time, 'goaltime' : goalTime,
'goalimage' : im1_64, 'goalimage' : im1_64,
'cp_number' : "-1" 'cp_number' : "-1"
}), }),
); );
String url = 'https://rogaining.sumasen.net/gifuroge/goal_from_rogapp'; String url = 'https://rogaining.sumasen.net/gifuroge/goal_from_rogapp';
print('++++++++${url}'); print('++++++++$url');
if (response.statusCode == 201) { if (response.statusCode == 201) {
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes)); Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
print('----_res : ${_res} ----'); print('----_res : $_res ----');
print('---- image url ${_res["goalimage"]} ----'); print('---- image url ${_res["goalimage"]} ----');
final http.Response response2 = await http.post( final http.Response response2 = await http.post(
Uri.parse(url), Uri.parse(url),
@ -261,7 +259,7 @@ class ExternalService {
body: jsonEncode(<String, String>{ body: jsonEncode(<String, String>{
'team_name': teamname, 'team_name': teamname,
'event_code': eventcode, 'event_code': eventcode,
'goal_time' : goal_time, 'goal_time' : goalTime,
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') 'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
} }
), ),
@ -269,12 +267,12 @@ class ExternalService {
String rec = jsonEncode(<String, String>{ String rec = jsonEncode(<String, String>{
'team_name': teamname, 'team_name': teamname,
'event_code': eventcode, 'event_code': eventcode,
'goal_time' : goal_time, 'goal_time' : goalTime,
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net') 'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
} }
); );
print("-- json -- ${rec}"); print("-- json -- $rec");
print('----- response2 is ${response2} --------'); print('----- response2 is $response2 --------');
if (response2.statusCode == 200) { if (response2.statusCode == 200) {
_res2 = json.decode(utf8.decode(response2.bodyBytes)); _res2 = json.decode(utf8.decode(response2.bodyBytes));
} }
@ -287,8 +285,8 @@ class ExternalService {
static Future<Map<String, dynamic>> usersEventCode(String teamcode, String password) async { static Future<Map<String, dynamic>> usersEventCode(String teamcode, String password) async {
Map<String, dynamic> _res = {}; Map<String, dynamic> _res = {};
String url = "https://rogaining.sumasen.net/gifuroge/check_event_code?zekken_number=${teamcode}&password=${password}"; String url = "https://rogaining.sumasen.net/gifuroge/check_event_code?zekken_number=$teamcode&password=$password";
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{

View File

@ -8,9 +8,9 @@ class LocationLineService{
static Future<GeoJsonFeature?> loadLocationLines() async { static Future<GeoJsonFeature?> loadLocationLines() async {
final geo = GeoJson(); final geo = GeoJson();
GeoJsonFeature? fs; GeoJsonFeature? fs;
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/location_line/'; String url = '$serverUrl/api/location_line/';
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -9,9 +9,9 @@ class LocationPolygonervice{
final geo = GeoJson(); final geo = GeoJson();
GeoJsonFeature? fs; GeoJsonFeature? fs;
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/location_polygon/'; String url = '$serverUrl/api/location_polygon/';
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -37,17 +37,17 @@ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async { static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
String url = ""; String url = "";
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){ if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture + '&cat=' + cat; url = '$serverUrl/api/inperf/?rog=$r&perf=' + perfecture + '&cat=' + cat;
} }
else { else {
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat; url = '$serverUrl/api/inperf/?perf=' + perfecture + '&cat=' + cat;
} }
} }
else{ else{
@ -55,13 +55,13 @@ class LocationService{
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture; url = '$serverUrl/api/inperf/?rog=$r&perf=' + perfecture;
} }
else { else {
url = '${server_url}/api/inperf/?perf=' + perfecture; url = '$serverUrl/api/inperf/?perf=' + perfecture;
} }
} }
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -78,13 +78,13 @@ class LocationService{
static Future<List<dynamic>?> getLocationsExt(String token) async { static Future<List<dynamic>?> getLocationsExt(String token) async {
List<dynamic> ext = []; List<dynamic> ext = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/locsext/'; String url = '$serverUrl/api/locsext/';
print('++++++++${url}'); print('++++++++$url');
final response = await http.post(Uri.parse(url), final response = await http.post(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}' 'Authorization': 'Token $token'
}, },
body: jsonEncode(<String, String>{ body: jsonEncode(<String, String>{
'token': token, 'token': token,
@ -102,16 +102,16 @@ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async { static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
String url = ""; String url = "";
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){ if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture + '&cat=' + cat; url = '$serverUrl/api/insubperf?rog=$r&subperf=' + subperfecture + '&cat=' + cat;
} }
else{ else{
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat; url = '$serverUrl/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
} }
} }
else{ else{
@ -119,13 +119,13 @@ class LocationService{
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture; url = '$serverUrl/api/insubperf?rog=$r&subperf=' + subperfecture;
} }
else{ else{
url = '${server_url}/api/insubperf?subperf=' + subperfecture; url = '$serverUrl/api/insubperf?subperf=' + subperfecture;
} }
} }
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -145,16 +145,16 @@ class LocationService{
print("-------- in location for bound -------------"); print("-------- in location for bound -------------");
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
String url = ""; String url = "";
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){ if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat; url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4' '&cat=' + cat;
} }
else{ else{
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat; url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4' '&cat=' + cat;
} }
} }
else{ else{
@ -162,14 +162,14 @@ class LocationService{
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
print("-------- requested user group ${grp} -------------"); 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}'; url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
} }
else{ else{
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}'; url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
} }
} }
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -200,17 +200,17 @@ class LocationService{
if(cat == "-all-"){ if(cat == "-all-"){
cat = ""; cat = "";
} }
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
print("loadCustomLocations url is ----- ${cat}"); print("loadCustomLocations url is ----- $cat");
if(cat.isNotEmpty){ if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){ if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/custom_area/?rog=${r}&&cat=' + cat; url = '$serverUrl/api/custom_area/?rog=$r&&cat=' + cat;
} }
else{ else{
url = '${server_url}/api/custom_area/?&cat=' + cat; url = '$serverUrl/api/custom_area/?&cat=' + cat;
} }
} }
else{ else{
@ -218,13 +218,13 @@ class LocationService{
bool _rog = indexController.currentUser[0]['user']['is_rogaining']; bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False'; String r = _rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code']; var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/customarea?rog=${r}&name=${name}'; url = '$serverUrl/api/customarea?rog=$r&name=$name';
} }
else{ else{
url = '${server_url}/api/customarea?name=${name}'; url = '$serverUrl/api/customarea?name=$name';
} }
} }
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -18,7 +18,7 @@ class MatrixService{
int i = 0; int i = 0;
for(Destination d in destinations){ for(Destination d in destinations){
print("---- getting matrix for ${d} ------------"); print("---- getting matrix for $d ------------");
if(i==0){ if(i==0){
origin = "${d.lat}, ${d.lon}"; origin = "${d.lat}, ${d.lon}";
@ -37,7 +37,7 @@ class MatrixService{
i++; i++;
} }
locs = "optimize:false|${locs}"; locs = "optimize:false|$locs";
String _mode = "walking"; String _mode = "walking";
switch (destinationController.travelMode.value) { switch (destinationController.travelMode.value) {
@ -53,8 +53,8 @@ class MatrixService{
} }
Map<String, dynamic> cats = {}; Map<String, dynamic> cats = {};
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE"; String url = "https://maps.googleapis.com/maps/api/directions/json?destination=$destination&mode=$_mode&waypoints=$locs&origin=$origin&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
print('++++++++${url}'); print('++++++++$url');
final http.Response response = await http.get( final http.Response response = await http.get(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{

View File

@ -7,9 +7,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadPerfectures() async { static Future<List<dynamic>?> loadPerfectures() async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/perf_main/'; String url = '$serverUrl/api/perf_main/';
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -25,9 +25,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadSubPerfectures(String area) async { static Future<List<dynamic>?> loadSubPerfectures(String area) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/subperfinmain/?area=' + area; String url = '$serverUrl/api/subperfinmain/?area=' + area;
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -44,9 +44,9 @@ class PerfectureService{
static Future<List<dynamic>?> getMainPerfExt(String id) async { static Future<List<dynamic>?> getMainPerfExt(String id) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/mainperfext/?perf=' + id; String url = '$serverUrl/api/mainperfext/?perf=' + id;
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -62,9 +62,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadGifuAreas(String perf) async { static Future<List<dynamic>?> loadGifuAreas(String perf) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/allgifuareas/?perf=' + perf; String url = '$serverUrl/api/allgifuareas/?perf=' + perf;
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -80,9 +80,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadCustomAreas() async { static Future<List<dynamic>?> loadCustomAreas() async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/customareanames'; String url = '$serverUrl/api/customareanames';
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -99,9 +99,9 @@ class PerfectureService{
static Future<List<dynamic>?> getSubExt(String id) async { static Future<List<dynamic>?> getSubExt(String id) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/perfext/?sub_perf=' + id; String url = '$serverUrl/api/perfext/?sub_perf=' + id;
print('++++++++${url}'); print('++++++++$url');
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -1,26 +1,25 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:rogapp/utils/const.dart'; import 'package:rogapp/utils/const.dart';
class TrackingService { class TrackingService {
static Future<Map<String, dynamic>> addTrack(String user_id, double lat, double lon) async { static Future<Map<String, dynamic>> addTrack(String userId, double lat, double lon) async {
Map<String, dynamic> cats = {}; Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
String url = '${server_url}/api/track/'; String url = '$serverUrl/api/track/';
print('++++++++${url}'); print('++++++++$url');
final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}'; final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}';
final http.Response response = await http.post( final http.Response response = await http.post(
Uri.parse(url), Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
}, },
body: jsonEncode(<String, String>{ body: jsonEncode(<String, String>{
'user_id': user_id, 'user_id': userId,
'geom': geom 'geom': geom
}), }),
); );

View File

@ -1,6 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:rogapp/model/Rogaining.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
import 'package:sqflite/sqflite.dart'; import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart'; import 'package:path/path.dart';
@ -86,14 +85,14 @@ class DatabaseHelper{
var rog = await db.query('rog'); var rog = await db.query('rog');
List<Rog> roglist = rog.isNotEmpty ? List<Rog> roglist = rog.isNotEmpty ?
rog.map((e) => Rog.fromMap(e)).toList() : []; rog.map((e) => Rog.fromMap(e)).toList() : [];
print("--------- ${rog}"); print("--------- $rog");
return roglist; return roglist;
} }
Future<List<Rog>> getRogainingByLatLon(double lat, double lon) async { Future<List<Rog>> getRogainingByLatLon(double lat, double lon) async {
Database db = await instance.database; Database db = await instance.database;
var rog = await db.query('rog', where: "lat = ${lat} and lon= ${lon}"); var rog = await db.query('rog', where: "lat = $lat and lon= $lon");
List<Rog> roglist = rog.isNotEmpty List<Rog> roglist = rog.isNotEmpty
? rog.map((e) => Rog.fromMap(e)).toList() : []; ? rog.map((e) => Rog.fromMap(e)).toList() : [];
return roglist; return roglist;
@ -101,12 +100,12 @@ class DatabaseHelper{
Future clearSelection() async { Future clearSelection() async {
Database db = await instance.database; Database db = await instance.database;
Map<String, dynamic> row_clear = { Map<String, dynamic> rowClear = {
"selected": false "selected": false
}; };
return await db.update( return await db.update(
"destination", "destination",
row_clear rowClear
); );
} }
@ -114,7 +113,7 @@ class DatabaseHelper{
Database db = await instance.database; Database db = await instance.database;
bool val = !dest.selected!; bool val = !dest.selected!;
Map<String, dynamic> row_target = { Map<String, dynamic> rowTarget = {
"selected": val "selected": val
}; };
@ -122,7 +121,7 @@ class DatabaseHelper{
return await db.update( return await db.update(
"destination", "destination",
row_target, rowTarget,
where: 'location_id = ?', where: 'location_id = ?',
whereArgs: [dest.location_id!] whereArgs: [dest.location_id!]
); );
@ -130,7 +129,7 @@ class DatabaseHelper{
Future<int> deleteRogaining(int id) async { Future<int> deleteRogaining(int id) async {
Database db = await instance.database; Database db = await instance.database;
var rog = await db.delete('rog', where: "id = ${id}"); var rog = await db.delete('rog', where: "id = $id");
int ret = rog > 0 ? rog : -1; int ret = rog > 0 ? rog : -1;
return ret; return ret;
@ -145,8 +144,8 @@ class DatabaseHelper{
Future<bool>isRogAlreadyAvailable(int id) async{ Future<bool>isRogAlreadyAvailable(int id) async{
Database db = await instance.database; Database db = await instance.database;
var rog = await db.query('rog', where: "id = ${id}"); var rog = await db.query('rog', where: "id = $id");
return rog.length > 0 ? true : false; return rog.isNotEmpty ? true : false;
} }
Future<int?>latestGoal() async{ Future<int?>latestGoal() async{
@ -157,16 +156,16 @@ class DatabaseHelper{
Future<int> insertRogaining(Rog rog) async { Future<int> insertRogaining(Rog rog) async {
Database db = await instance.database; Database db = await instance.database;
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog')); int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
next_order = next_order==null ? 0 : next_order; nextOrder = nextOrder ?? 0;
next_order = next_order + 1; nextOrder = nextOrder + 1;
rog.id = next_order; rog.id = nextOrder;
int res = await db.insert( int res = await db.insert(
'rog', 'rog',
rog.toMap(), rog.toMap(),
conflictAlgorithm: ConflictAlgorithm.replace, conflictAlgorithm: ConflictAlgorithm.replace,
); );
print("------ database helper insert ${res}-----------::::::::"); print("------ database helper insert $res-----------::::::::");
return res; return res;
} }
@ -176,13 +175,13 @@ class DatabaseHelper{
var dest = await db.query('destination', orderBy: 'list_order'); var dest = await db.query('destination', orderBy: 'list_order');
List<Destination> destList = dest.isNotEmpty ? List<Destination> destList = dest.isNotEmpty ?
dest.map((e) => Destination.fromMap(e)).toList() : []; dest.map((e) => Destination.fromMap(e)).toList() : [];
print("--------- ${destList}"); print("--------- $destList");
return destList; return destList;
} }
Future<List<Destination>> getDestinationById(int id) async { Future<List<Destination>> getDestinationById(int id) async {
Database db = await instance.database; Database db = await instance.database;
var rog = await db.query('destination', where: "location_id = ${id}"); var rog = await db.query('destination', where: "location_id = $id");
List<Destination> deslist = rog.isNotEmpty List<Destination> deslist = rog.isNotEmpty
? rog.map((e) => Destination.fromMap(e)).toList() : []; ? rog.map((e) => Destination.fromMap(e)).toList() : [];
return deslist; return deslist;
@ -191,15 +190,15 @@ class DatabaseHelper{
Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async { Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async {
Database db = await instance.database; Database db = await instance.database;
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}", orderBy: 'list_order'); var dest = await db.query('destination', where: "lat = $lat and lon= $lon", orderBy: 'list_order');
List<Destination> destList = dest.isNotEmpty List<Destination> destList = dest.isNotEmpty
? dest.map((e) => Destination.fromMap(e)).toList() : []; ? dest.map((e) => Destination.fromMap(e)).toList() : [];
return destList; return destList;
} }
Future<int> deleteDestination(int location_id) async { Future<int> deleteDestination(int locationId) async {
Database db = await instance.database; Database db = await instance.database;
var dest = await db.delete('destination', where: "location_id = ${location_id}"); var dest = await db.delete('destination', where: "location_id = $locationId");
int ret = dest > 0 ? dest : -1; int ret = dest > 0 ? dest : -1;
//after deleting set correct order //after deleting set correct order
@ -212,19 +211,19 @@ class DatabaseHelper{
Database db = await instance.database; Database db = await instance.database;
var byOrder = await db.query('destination', orderBy: 'list_order'); var byOrder = await db.query('destination', orderBy: 'list_order');
List<Destination> des_db = byOrder.isNotEmpty List<Destination> desDb = byOrder.isNotEmpty
? byOrder.map((e) => Destination.fromMap(e)).toList() : []; ? byOrder.map((e) => Destination.fromMap(e)).toList() : [];
int order = 1; int order = 1;
for( Destination d in des_db){ for( Destination d in desDb){
Map<String, dynamic> row_target = { Map<String, dynamic> rowTarget = {
"list_order": order "list_order": order
}; };
await db.update( await db.update(
"destination", "destination",
row_target, rowTarget,
where: 'location_id = ?', where: 'location_id = ?',
whereArgs: [d.location_id] whereArgs: [d.location_id]
); );
@ -238,18 +237,18 @@ class DatabaseHelper{
await db.delete('destination'); await db.delete('destination');
} }
Future<bool>isAlreadyAvailable(int location_id) async{ Future<bool>isAlreadyAvailable(int locationId) async{
Database db = await instance.database; Database db = await instance.database;
var dest = await db.query('destination', where: "location_id = ${location_id}"); var dest = await db.query('destination', where: "location_id = $locationId");
return dest.length > 0 ? true : false; return dest.isNotEmpty ? true : false;
} }
Future<int> insertDestination(Destination dest) async { Future<int> insertDestination(Destination dest) async {
Database db = await instance.database; Database db = await instance.database;
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination')); int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
next_order = next_order==null ? 0 : next_order; nextOrder = nextOrder ?? 0;
next_order = next_order + 1; nextOrder = nextOrder + 1;
dest.list_order = next_order; dest.list_order = nextOrder;
int res = await db.insert( int res = await db.insert(
'destination', 'destination',
dest.toMap(), dest.toMap(),
@ -278,23 +277,23 @@ class DatabaseHelper{
var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}"); 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}"); var dest = await db.query('destination', where: "location_id = ${d.location_id}");
print("--- target in db is ${target}"); print("--- target in db is $target");
print("--- destine in db is ${dest}"); print("--- destine in db is $dest");
if(target.isNotEmpty){ if(target.isNotEmpty){
List<Destination> target_indb = target.isNotEmpty List<Destination> targetIndb = target.isNotEmpty
? target.map((e) => Destination.fromMap(e)).toList() : []; ? target.map((e) => Destination.fromMap(e)).toList() : [];
List<Destination> dest_indb = dest.isNotEmpty List<Destination> destIndb = dest.isNotEmpty
? dest.map((e) => Destination.fromMap(e)).toList() : []; ? dest.map((e) => Destination.fromMap(e)).toList() : [];
Map<String, dynamic> row_target = { Map<String, dynamic> rowTarget = {
"list_order": d.list_order "list_order": d.list_order
}; };
Map<String, dynamic> row_des = { Map<String, dynamic> rowDes = {
"list_order": dest_indb[0].list_order! + dir "list_order": destIndb[0].list_order! + dir
}; };
// print("--- target destination is ${target_indb[0].location_id}"); // print("--- target destination is ${target_indb[0].location_id}");
@ -302,16 +301,16 @@ class DatabaseHelper{
await db.update( await db.update(
"destination", "destination",
row_target, rowTarget,
where: 'location_id = ?', where: 'location_id = ?',
whereArgs: [target_indb[0]!.location_id] whereArgs: [targetIndb[0].location_id]
); );
await db.update( await db.update(
"destination", "destination",
row_des, rowDes,
where: 'location_id = ?', where: 'location_id = ?',
whereArgs: [dest_indb[0]!.location_id] whereArgs: [destIndb[0].location_id]
); );
} }
} }

View File

@ -22,7 +22,7 @@ class TextUtils{
RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
String txt = ""; String txt = "";
if(dp.cp! > 0){ if(dp.cp! > 0){
txt = "${dp.cp.toString().replaceAll(regex, '')}"; txt = dp.cp.toString().replaceAll(regex, '');
if(dp.checkin_point != null && dp.checkin_point! > 0){ if(dp.checkin_point != null && dp.checkin_point! > 0){
txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}"; txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}";
} }

View File

@ -13,7 +13,7 @@ class BaseLayer extends StatelessWidget {
FMTCTileProviderSettings( FMTCTileProviderSettings(
behavior: CacheBehavior.values behavior: CacheBehavior.values
.byName('cacheFirst'), .byName('cacheFirst'),
cachedValidDuration: Duration( cachedValidDuration: const Duration(
days: 14 days: 14
), ),
), ),

View File

@ -1,15 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:latlong2/latlong.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/camera/camera_page.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
@ -28,11 +22,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Image getImage(){ Image getImage(){
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
if(indexController.rog_mode == 1){ if(indexController.rog_mode == 1){
//print("----- rogaining mode 1"); //print("----- rogaining mode 1");
if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){ if(indexController.currentDestinationFeature.isEmpty || indexController.currentDestinationFeature[0].photos! == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
//print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@"); //print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@");
@ -48,7 +42,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
} }
else { else {
return Image(image: NetworkImage( return Image(image: NetworkImage(
'${server_url}/media/compressed/' + indexController.currentDestinationFeature[0].photos!, '$serverUrl/media/compressed/' + indexController.currentDestinationFeature[0].photos!,
), ),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png"); return Image.asset("assets/images/empty_image.png");
@ -59,11 +53,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
} }
else{ else{
GeoJsonFeature<dynamic> gf = indexController.currentFeature[0]; GeoJsonFeature<dynamic> gf = indexController.currentFeature[0];
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ if(gf.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
String _photo = gf!.properties!["photos"]; String _photo = gf.properties!["photos"];
if(_photo.contains('http')){ if(_photo.contains('http')){
return Image(image: NetworkImage( return Image(image: NetworkImage(
gf.properties!["photos"], gf.properties!["photos"],
@ -75,7 +69,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
} }
else { else {
return Image(image: NetworkImage( return Image(image: NetworkImage(
'${server_url}/media/compressed/' + gf.properties!["photos"], '$serverUrl/media/compressed/' + gf.properties!["photos"],
), ),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png"); return Image.asset("assets/images/empty_image.png");
@ -94,7 +88,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
bool isInDestination(String locationid){ bool isInDestination(String locationid){
int lid = int.parse(locationid); int lid = int.parse(locationid);
if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){ if(destinationController.destinations.where((element) => element.location_id == lid).isNotEmpty){
return true; return true;
} }
else{ else{
@ -130,25 +124,25 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}, },
color: Colors.blue, color: Colors.blue,
textColor: Colors.white, textColor: Colors.white,
child: Icon( child: const Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
size: 14, size: 14,
), ),
padding: EdgeInsets.all(16), padding: const EdgeInsets.all(16),
shape: CircleBorder(), shape: const CircleBorder(),
), ),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Obx(() => child: Obx(() =>
indexController.currentUser.length > 0 ? indexController.currentUser.isNotEmpty ?
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle( Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: const TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
) )
: :
Text("${indexController.currentDestinationFeature[0].name!}", style: TextStyle( Text(indexController.currentDestinationFeature[0].name!, style: const TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -257,33 +251,33 @@ class BottomSheetNew extends GetView<BottomSheetController> {
indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ? indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ?
getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '') getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '')
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
), ),
Obx(() => Obx(() =>
indexController.currentDestinationFeature[0].phone != null && indexController.currentDestinationFeature[0].phone!.isNotEmpty ? indexController.currentDestinationFeature[0].phone != null && indexController.currentDestinationFeature[0].phone!.isNotEmpty ?
getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '') getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '')
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
), ),
Obx(() => Obx(() =>
indexController.currentDestinationFeature[0].email != null && indexController.currentDestinationFeature[0].email!.isNotEmpty ? indexController.currentDestinationFeature[0].email != null && indexController.currentDestinationFeature[0].email!.isNotEmpty ?
getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '') getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '')
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
), ),
Obx(() => Obx(() =>
indexController.currentDestinationFeature[0].webcontents != null && indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ? indexController.currentDestinationFeature[0].webcontents != null && indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ?
getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true) getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true)
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
), ),
Obx(() => Obx(() =>
indexController.currentDestinationFeature[0].videos != null && indexController.currentDestinationFeature[0].videos!.isNotEmpty ? indexController.currentDestinationFeature[0].videos != null && indexController.currentDestinationFeature[0].videos!.isNotEmpty ?
getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true) getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true)
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
), ),
SizedBox(height: 20.0,), const SizedBox(height: 20.0,),
// Obx(() => // Obx(() =>
// //wantToGo(context), // //wantToGo(context),
@ -297,7 +291,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
// ), // ),
// ), // ),
SizedBox(height: 60.0,) const SizedBox(height: 60.0,)
], ],
), ),
); );
@ -321,19 +315,19 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}, },
color: Colors.blue, color: Colors.blue,
textColor: Colors.white, textColor: Colors.white,
child: Icon( child: const Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
//Icons.arrow_back_ios, //Icons.arrow_back_ios,
size: 14, size: 14,
), ),
padding: EdgeInsets.all(16), padding: const EdgeInsets.all(16),
shape: CircleBorder(), shape: const CircleBorder(),
), ),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Obx(() => child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -423,7 +417,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ?
Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"])) Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"]))
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
], ],
), ),
), ),
@ -432,8 +426,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Get.back(); Get.back();
print("---- go to ----"); print("---- go to ----");
GeoJsonFeature<GeoJsonMultiPoint> mp = indexController.currentFeature[0] as GeoJsonFeature<GeoJsonMultiPoint>; GeoJsonFeature<GeoJsonMultiPoint> mp = indexController.currentFeature[0] as GeoJsonFeature<GeoJsonMultiPoint>;
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest); Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest, forceAndroidLocationManager: true);
print("------- position -------- ${position}"); print("------- position -------- $position");
Destination ds = Destination( Destination ds = Destination(
lat: position.latitude, lat: position.latitude,
lon: position.longitude lon: position.longitude
@ -447,20 +441,20 @@ class BottomSheetNew extends GetView<BottomSheetController> {
destinationController.destinationMatrixFromCurrentPoint([ds, tp]); destinationController.destinationMatrixFromCurrentPoint([ds, tp]);
}, },
child:Text("ここへ行く")), child:const Text("ここへ行く")),
], ],
), ),
SizedBox(height: 8.0,), const SizedBox(height: 8.0,),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon(Icons.roundabout_left), const Icon(Icons.roundabout_left),
SizedBox(width: 8.0,), const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ?
getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '') getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '')
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
], ],
), ),
), ),
@ -468,12 +462,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon(Icons.phone), const Icon(Icons.phone),
SizedBox(width: 8.0,), const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ?
getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '') getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '')
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
], ],
), ),
), ),
@ -481,12 +475,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon(Icons.email), const Icon(Icons.email),
SizedBox(width: 8.0,), const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ?
getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '') getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '')
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
], ],
), ),
), ),
@ -494,12 +488,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon(Icons.language), const Icon(Icons.language),
SizedBox(width: 8.0,), const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ?
getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true) getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true)
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
], ],
), ),
), ),
@ -507,11 +501,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
SizedBox(width: 8.0,), const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["remark"] != null && (indexController.currentFeature[0].properties!["remark"] as String).isNotEmpty ? indexController.currentFeature[0].properties!["remark"] != null && (indexController.currentFeature[0].properties!["remark"] as String).isNotEmpty ?
getDetails(context, "remarks".tr, indexController.currentFeature[0].properties!["remark"] ?? '', isurl: false) getDetails(context, "remarks".tr, indexController.currentFeature[0].properties!["remark"] ?? '', isurl: false)
: :
Container(width: 0.0, height: 0,), const SizedBox(width: 0.0, height: 0,),
], ],
), ),
), ),
@ -520,7 +514,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
), ),
) )
), ),
SizedBox(height: 60.0,) const SizedBox(height: 60.0,)
], ],
), ),
); );
@ -645,23 +639,20 @@ class BottomSheetNew extends GetView<BottomSheetController> {
// // }, // // },
// // ): // // ):
// // Container(), // // Container(),
SizedBox(width: 8.0,) , const SizedBox(width: 8.0,) ,
Obx((() => Obx((() =>
indexController.rog_mode == 1 ? indexController.rog_mode == 1 ?
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
Destination dest = indexController.currentDestinationFeature[0]!; Destination dest = indexController.currentDestinationFeature[0];
//print("------ curent destination is ${dest!.checkedIn}-------"); //print("------ curent destination is ${dest!.checkedIn}-------");
if(dest != null){
//print("------ curent destination is ${dest!.checkedin}-------::::::::::");
destinationController.makeCheckin(dest, !dest.checkedin!, ""); destinationController.makeCheckin(dest, !dest.checkedin!, "");
}
}, },
child: indexController.currentDestinationFeature[0].checkedin == false ? child: indexController.currentDestinationFeature[0].checkedin == false ?
Text("チェックイン") const Text("チェックイン")
: :
Text("チェックアウト") const Text("チェックアウト")
): ):
Container() Container()
@ -690,7 +681,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
ElevatedButton( ElevatedButton(
child: Text("Image"), onPressed: (){ child: const Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){ _picker.pickImage(source: ImageSource.camera).then((value){
//print("----- image---- ${value!.path}"); //print("----- image---- ${value!.path}");
@ -729,7 +720,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
indexController.makeAction(context); indexController.makeAction(context);
}, },
child: Icon( child: const Icon(
Icons.favorite, color: Colors.red) Icons.favorite, color: Colors.red)
, ,
@ -747,7 +738,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text(label), Text(label),
SizedBox(width: 10.0,), const SizedBox(width: 10.0,),
InkWell( InkWell(
onTap: (){ onTap: (){
if(isurl){ if(isurl){
@ -760,7 +751,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
} }
}, },
child: Container( child: SizedBox(
width: MediaQuery.of(context).size.width - 160, width: MediaQuery.of(context).size.width - 160,
child: Text(text, child: Text(text,
style: TextStyle( style: TextStyle(

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
@ -13,9 +12,11 @@ class BottomSheetWidget extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
BottomSheetWidget({Key? key}) : super(key: key);
Image getImage(GeoJsonFeature? gf){ Image getImage(GeoJsonFeature? gf){
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){ if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
return Image(image: NetworkImage( return Image(image: NetworkImage(
@ -37,7 +38,7 @@ class BottomSheetWidget extends StatelessWidget {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
SizedBox(height: 5.0,), const SizedBox(height: 5.0,),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -47,18 +48,18 @@ class BottomSheetWidget extends StatelessWidget {
}, },
color: Colors.blue, color: Colors.blue,
textColor: Colors.white, textColor: Colors.white,
child: Icon( child: const Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
size: 14, size: 14,
), ),
padding: EdgeInsets.all(14), padding: const EdgeInsets.all(14),
shape: CircleBorder(), shape: const CircleBorder(),
), ),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Obx(() => child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle( Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -72,12 +73,12 @@ class BottomSheetWidget extends StatelessWidget {
}, },
color: Colors.blue, color: Colors.blue,
textColor: Colors.white, textColor: Colors.white,
child: Icon( child: const Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
size: 14, size: 14,
), ),
padding: EdgeInsets.all(14), padding: const EdgeInsets.all(14),
shape: CircleBorder(), shape: const CircleBorder(),
), ),
], ],
), ),
@ -105,59 +106,59 @@ class BottomSheetWidget extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)), child: Text("address".tr, style: const TextStyle(fontWeight: FontWeight.bold),)),
), ),
SizedBox(width: 12.0,), const SizedBox(width: 12.0,),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '', child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
style: TextStyle(color: Colors.blue,), style: const TextStyle(color: Colors.blue,),
softWrap: true, softWrap: true,
overflow: TextOverflow.ellipsis,) overflow: TextOverflow.ellipsis,)
), ),
), ),
) )
], ],
): Container(width: 0.0, height: 0,), ): const SizedBox(width: 0.0, height: 0,),
indexController.currentFeature[0].properties!["phone"] != null ? indexController.currentFeature[0].properties!["phone"] != null ?
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded(child: Container( Expanded(child: Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))), child: Text("telephone".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,), const SizedBox(width: 12.0,),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '', child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
style: TextStyle(color: Colors.blue,), style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,) overflow: TextOverflow.ellipsis,)
), ),
), ),
) )
], ],
): Container(width: 0, height: 0,), ): const SizedBox(width: 0, height: 0,),
indexController.currentFeature[0].properties!["email"] != null ? indexController.currentFeature[0].properties!["email"] != null ?
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded(child: Container( Expanded(child: Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))), child: Text("email".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,), const SizedBox(width: 12.0,),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '', child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
style: TextStyle(color: Colors.blue,), style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,) overflow: TextOverflow.ellipsis,)
), ),
), ),
) )
], ],
): Container(width: 0, height: 0,), ): const SizedBox(width: 0, height: 0,),
indexController.currentFeature[0].properties!["webcontents"] != null ? indexController.currentFeature[0].properties!["webcontents"] != null ?
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -165,8 +166,8 @@ class BottomSheetWidget extends StatelessWidget {
Expanded(child: Container( Expanded(child: Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Text( child: Text(
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))), "web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,), const SizedBox(width: 12.0,),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
@ -175,40 +176,40 @@ class BottomSheetWidget extends StatelessWidget {
_launchURL(indexController.currentFeature[0].properties!["webcontents"]); _launchURL(indexController.currentFeature[0].properties!["webcontents"]);
}, },
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '', child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
style: TextStyle(color: Colors.blue,), style: const TextStyle(color: Colors.blue,),
softWrap: false, softWrap: false,
overflow: TextOverflow.fade,), overflow: TextOverflow.fade,),
)), )),
), ),
) )
], ],
): Container(width: 0.0, height: 0.0,), ): const SizedBox(width: 0.0, height: 0.0,),
indexController.currentFeature[0].properties!["videos"] != null ? indexController.currentFeature[0].properties!["videos"] != null ?
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded(child: Container( Expanded(child: Container(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))), child: Text("video".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,), const SizedBox(width: 12.0,),
Expanded( Expanded(
child: Container( child: Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '', child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
style: TextStyle(color: Colors.blue,), style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,) overflow: TextOverflow.ellipsis,)
), ),
), ),
) )
], ],
): Container(width: 0.0, height: 0.0,), ): const SizedBox(width: 0.0, height: 0.0,),
], ],
), ),
), ),
), ),
], ],
), ),
SizedBox(height: 20.0,), const SizedBox(height: 20.0,),
Obx(() => Obx(() =>
indexController.currentAction.isNotEmpty ? indexController.currentAction.isNotEmpty ?
Row( Row(
@ -232,7 +233,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["wanttogo"] = true; indexController.currentAction[0][0]["wanttogo"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); print("---temp---$temp");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
@ -246,7 +247,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["wanttogo"] = false; indexController.currentAction[0][0]["wanttogo"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); print("---temp---$temp");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
@ -267,7 +268,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["like"] = true; indexController.currentAction[0][0]["like"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); print("---temp---$temp");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
@ -281,7 +282,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["like"] = false; indexController.currentAction[0][0]["like"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); print("---temp---$temp");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
@ -302,7 +303,7 @@ class BottomSheetWidget extends StatelessWidget {
: :
Container(width: 0, height: 0,), const SizedBox(width: 0, height: 0,),
indexController.rog_mode.value == 1 ? indexController.rog_mode.value == 1 ?
indexController.currentAction[0][0]["checkin"] == false ? indexController.currentAction[0][0]["checkin"] == false ?
Column( Column(
@ -311,7 +312,7 @@ class BottomSheetWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
ElevatedButton( ElevatedButton(
child: Text("Image"), onPressed: (){ child: const Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){ _picker.pickImage(source: ImageSource.camera).then((value){
print("----- image---- ${value!.path}"); print("----- image---- ${value!.path}");
@ -327,7 +328,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["checkin"] = true; indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); print("---temp---$temp");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
@ -344,18 +345,18 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["checkin"] = false; indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]); Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear(); indexController.currentAction.clear();
print("---temp---${temp}"); print("---temp---$temp");
indexController.currentAction.add([temp]); indexController.currentAction.add([temp]);
} }
indexController.makeAction(context); indexController.makeAction(context);
}, },
child: Icon( child: const Icon(
Icons.favorite, color: Colors.red) Icons.favorite, color: Colors.red)
, ,
): ):
Container(width: 0, height: 0,), const SizedBox(width: 0, height: 0,),
], ],
): Row( ): Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -364,7 +365,7 @@ class BottomSheetWidget extends StatelessWidget {
onPressed: (){ onPressed: (){
Get.toNamed(AppPages.LOGIN); Get.toNamed(AppPages.LOGIN);
}, },
child: Flexible(child: Text("その他のオプションについてはログインしてください"))) child: const Flexible(child: Text("その他のオプションについてはログインしてください")))
], ],
), ),
), ),

View File

@ -15,7 +15,7 @@ class BreadCrumbWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print("------ map controller is ${mapController}------------"); print("------ map controller is $mapController------------");
return return
Obx(()=> Obx(()=>
indexController.perfectures.isNotEmpty && mapController != null ? indexController.perfectures.isNotEmpty && mapController != null ?

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/location_service.dart';
class CatWidget extends StatefulWidget { class CatWidget extends StatefulWidget {
CatWidget({ Key? key, required this.indexController, }) : super(key: key); CatWidget({ Key? key, required this.indexController, }) : super(key: key);

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
@ -7,8 +6,6 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/const.dart'; import 'package:rogapp/utils/const.dart';
import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:sqflite/sqlite_api.dart';
import 'package:timeline_tile/timeline_tile.dart'; import 'package:timeline_tile/timeline_tile.dart';
class DestinationWidget extends StatelessWidget { class DestinationWidget extends StatelessWidget {
@ -22,7 +19,7 @@ class DestinationWidget extends StatelessWidget {
Image getImage(int index){ Image getImage(int index){
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){ if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
print("------- image is ${destinationController.destinations[index].photos!}------"); print("------- image is ${destinationController.destinations[index].photos!}------");
@ -36,10 +33,10 @@ class DestinationWidget extends StatelessWidget {
); );
} }
else { else {
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ==="); //print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
return Image(image: NetworkImage( return Image(image: NetworkImage(
'${server_url}/media/compressed/' + destinationController.destinations[index].photos!), '$serverUrl/media/compressed/' + destinationController.destinations[index].photos!),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png"); return Image.asset("assets/images/empty_image.png");
}, },
@ -63,10 +60,10 @@ class DestinationWidget extends StatelessWidget {
// } // }
void doDelete() { void doDelete() {
destinationController.currentSelectedDestinations.forEach((element) { for (var element in destinationController.currentSelectedDestinations) {
destinationController.deleteDestination(element); destinationController.deleteDestination(element);
destinationController.resetRogaining(); destinationController.resetRogaining();
}); }
// destinationController.destination_index_data.forEach((element) { // destinationController.destination_index_data.forEach((element) {
// //print(element["index"]); // //print(element["index"]);
// destinationController.deleteDestination(element["index"]); // destinationController.deleteDestination(element["index"]);
@ -75,7 +72,7 @@ class DestinationWidget extends StatelessWidget {
} }
void moveUp() { void moveUp() {
Destination? d = null; Destination? d;
for(Destination ad in destinationController.destinations){ for(Destination ad in destinationController.destinations){
if(ad.selected == true){ if(ad.selected == true){
d = ad; d = ad;
@ -89,7 +86,7 @@ class DestinationWidget extends StatelessWidget {
} }
void moveDown() { void moveDown() {
Destination? d = null; Destination? d;
for(Destination ad in destinationController.destinations){ for(Destination ad in destinationController.destinations){
if(ad.selected == true){ if(ad.selected == true){
d = ad; d = ad;
@ -107,8 +104,8 @@ class DestinationWidget extends StatelessWidget {
title: "are_you_sure_want_to_delete_all".tr, title: "are_you_sure_want_to_delete_all".tr,
middleText: "all_added_destination_will_be_deleted".tr, middleText: "all_added_destination_will_be_deleted".tr,
backgroundColor: Colors.blue.shade300, backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white), titleStyle: const TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white), middleTextStyle: const TextStyle(color: Colors.white),
textConfirm: "confirm".tr, textConfirm: "confirm".tr,
textCancel: "cancel".tr, textCancel: "cancel".tr,
cancelTextColor: Colors.white, cancelTextColor: Colors.white,
@ -138,9 +135,9 @@ class DestinationWidget extends StatelessWidget {
// }); // });
} }
Future getIsLocationAvilable(int location_id) async { Future getIsLocationAvilable(int locationId) async {
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
return await db.isAlreadyAvailable(location_id); return await db.isAlreadyAvailable(locationId);
} }
@override @override
@ -164,7 +161,7 @@ class DestinationWidget extends StatelessWidget {
isFirst: index == 0 ? true : false, isFirst: index == 0 ? true : false,
indicatorStyle: IndicatorStyle( indicatorStyle: IndicatorStyle(
indicator: CircleAvatar( indicator: CircleAvatar(
child: Text(destinationController.destinations[index].list_order.toString(), style: TextStyle(color: Colors.white),), child: Text(destinationController.destinations[index].list_order.toString(), style: const TextStyle(color: Colors.white),),
backgroundColor: Colors.red, backgroundColor: Colors.red,
), ),
), ),
@ -178,9 +175,7 @@ class DestinationWidget extends StatelessWidget {
onTap: () async { onTap: () async {
{ {
Destination? fs = destinationController.destinations[index]; Destination? fs = destinationController.destinations[index];
print("----fsf-----${index}"); print("----fsf-----$index");
if(fs != null){
if(indexController.currentDestinationFeature.isNotEmpty) { if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
} }
@ -193,7 +188,6 @@ class DestinationWidget extends StatelessWidget {
builder:((context) => BottomSheetNew()) builder:((context) => BottomSheetNew())
); );
} }
};
}, },
onLongPress: (){ onLongPress: (){
destinationController.toggleSelection(destinationController.destinations[index]); destinationController.toggleSelection(destinationController.destinations[index]);
@ -229,7 +223,7 @@ class DestinationWidget extends StatelessWidget {
color: Colors.grey.withOpacity(0.3), color: Colors.grey.withOpacity(0.3),
spreadRadius: 5, spreadRadius: 5,
blurRadius: 3, blurRadius: 3,
offset: Offset(0, 7), // changes position of shadow offset: const Offset(0, 7), // changes position of shadow
), ),
], ],
), ),
@ -239,22 +233,22 @@ class DestinationWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
IconButton( IconButton(
icon:Icon(Icons.delete_forever), icon:const Icon(Icons.delete_forever),
//onPressed: (){doDelete();}, //onPressed: (){doDelete();},
onPressed: clearall, onPressed: clearall,
), ),
IconButton( IconButton(
icon:Icon(Icons.cancel), icon:const Icon(Icons.cancel),
//onPressed: (){doDelete();}, //onPressed: (){doDelete();},
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null, onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? doDelete : null,
), ),
IconButton( IconButton(
icon:Icon(Icons.move_up), icon:const Icon(Icons.move_up),
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveUp : null, onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveUp : null,
), ),
IconButton( IconButton(
icon:Icon(Icons.move_down), icon:const Icon(Icons.move_down),
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveDown : null, onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveDown : null,
), ),
// IconButton( // IconButton(
// icon:Icon(Icons.sync), // icon:Icon(Icons.sync),

View File

@ -7,10 +7,9 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/maxtrix_service.dart'; import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/utils/const.dart'; import 'package:rogapp/utils/const.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class ListWidget extends StatefulWidget { class ListWidget extends StatefulWidget {
ListWidget({ Key? key }) : super(key: key); const ListWidget({ Key? key }) : super(key: key);
@override @override
State<ListWidget> createState() => _ListWidgetState(); State<ListWidget> createState() => _ListWidgetState();
@ -23,16 +22,16 @@ class _ListWidgetState extends State<ListWidget> {
Image getImage(int index){ Image getImage(int index){
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){ if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png')); return const Image(image: AssetImage('assets/images/empty_image.png'));
} }
else{ else{
print("==== photo index is ${index} ==="); print("==== photo index is $index ===");
String server_url = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index]; GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index];
String _photo = gf!.properties!["photos"]; String _photo = gf.properties!["photos"];
return Image( return Image(
image: NetworkImage( image: NetworkImage(
'${server_url}/media/compressed/' + _photo '$serverUrl/media/compressed/' + _photo
), ),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) { errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png"); return Image.asset("assets/images/empty_image.png");
@ -42,7 +41,7 @@ class _ListWidgetState extends State<ListWidget> {
} }
void changeCurrentFeature(GeoJsonFeature fs){ void changeCurrentFeature(GeoJsonFeature fs){
if(indexController.currentFeature.length > 0){ if(indexController.currentFeature.isNotEmpty){
indexController.currentFeature.clear(); indexController.currentFeature.clear();
} }
indexController.currentFeature.add(fs); indexController.currentFeature.add(fs);
@ -89,7 +88,7 @@ class _ListWidgetState extends State<ListWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Obx(() => return Obx(() =>
indexController.locations.length > 0 ? indexController.locations.isNotEmpty ?
RefreshIndicator( RefreshIndicator(
onRefresh: _pullRefresh, onRefresh: _pullRefresh,
child: ListView.builder( child: ListView.builder(
@ -119,13 +118,13 @@ class _ListWidgetState extends State<ListWidget> {
); );
}, },
leading: getImage(index), leading: getImage(index),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""), title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : const Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""), subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : const Text(""),
trailing: Column( trailing: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : Text(""), indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""),
Container( SizedBox(
width: 100, width: 100,
child: FutureBuilder<String>( child: FutureBuilder<String>(
future: matrixDistance(index), future: matrixDistance(index),
@ -134,10 +133,10 @@ class _ListWidgetState extends State<ListWidget> {
return const Center(child: CircularProgressIndicator(),); return const Center(child: CircularProgressIndicator(),);
} }
if(snapshot.hasError){ if(snapshot.hasError){
return Text("-"); return const Text("-");
} }
else{ else{
return Text(snapshot.data ?? '', style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),); return Text(snapshot.data ?? '', style: const TextStyle(color: Colors.red, fontWeight: FontWeight.bold),);
} }
}, },
), ),
@ -148,7 +147,7 @@ class _ListWidgetState extends State<ListWidget> {
); );
}, },
), ),
) : Container(width: 0, height: 0,), ) : const SizedBox(width: 0, height: 0,),
); );
} }
} }

View File

@ -6,14 +6,12 @@ import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/text_util.dart'; import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart'; import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class MapWidget extends StatelessWidget { class MapWidget extends StatelessWidget {
@ -34,7 +32,7 @@ class MapWidget extends StatelessWidget {
InkWell( InkWell(
onTap: () { onTap: () {
GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude); GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
print("------- fs ${fs}------"); print("------- fs $fs------");
if(fs != null){ if(fs != null){
indexController.currentFeature.clear(); indexController.currentFeature.clear();
indexController.currentFeature.add(fs); indexController.currentFeature.add(fs);
@ -71,19 +69,19 @@ class MapWidget extends StatelessWidget {
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
Icon(Icons.circle,size: 6.0,), const Icon(Icons.circle,size: 6.0,),
i.properties!['cp'] == -1 ? i.properties!['cp'] == -1 ?
Transform.rotate( Transform.rotate(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
origin: Offset.fromDirection(1, 26), origin: Offset.fromDirection(1, 26),
angle: 270 * pi / 180, angle: 270 * pi / 180,
child: Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)): child: const Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
Container(color: Colors.transparent,), Container(color: Colors.transparent,),
], ],
) )
), ),
), ),
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))), Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
], ],
); );
} }
@ -107,8 +105,8 @@ class MapWidget extends StatelessWidget {
return Stack( return Stack(
children: [ children: [
Obx(() => Obx(() =>
indexController.is_loading == true ? Padding( indexController.is_loading == true ? const Padding(
padding: const EdgeInsets.only(top: 60.0), padding: EdgeInsets.only(top: 60.0),
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
): ):
FlutterMap( FlutterMap(
@ -122,7 +120,7 @@ class MapWidget extends StatelessWidget {
//print(DateTime.now().toString() + ' [MapEventMoveStart] START'); //print(DateTime.now().toString() + ' [MapEventMoveStart] START');
// do something // do something
} }
if (mapEvent is MapEventMoveEnd && indexController.currentUser. length <= 0) { if (mapEvent is MapEventMoveEnd && indexController.currentUser.isEmpty) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] END'); //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
indexController.loadLocationsBound(); indexController.loadLocationsBound();
//indexController.rogMapController!.move(c.center, c.zoom); //indexController.rogMapController!.move(c.center, c.zoom);
@ -131,7 +129,7 @@ class MapWidget extends StatelessWidget {
}, },
//center: LatLng(37.15319600454702, 139.58765950528198), //center: LatLng(37.15319600454702, 139.58765950528198),
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]), bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1, zoom: 1,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag, interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
@ -143,7 +141,7 @@ class MapWidget extends StatelessWidget {
.hideAllPopups(), // Hide popup when the map is tapped. .hideAllPopups(), // Hide popup when the map is tapped.
), ),
children: [ children: [
BaseLayer(), const BaseLayer(),
Obx(() => Obx(() =>
indexController.routePointLenght > 0 ? indexController.routePointLenght > 0 ?
PolylineLayer( PolylineLayer(
@ -180,7 +178,7 @@ class MapWidget extends StatelessWidget {
}).toList(), }).toList(),
) )
: :
Center(child: CircularProgressIndicator()) const Center(child: CircularProgressIndicator())
, ,
], ],
) )

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/cat_widget.dart';
class PerfectureWidget extends StatefulWidget { class PerfectureWidget extends StatefulWidget {
@ -166,11 +165,9 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
} }
setState(() { setState(() {
widget.indexController.locations.clear(); widget.indexController.locations.clear();
if(newValue != null){
widget.indexController.is_loading.value = true; widget.indexController.is_loading.value = true;
widget.indexController.areaDropdownValue = newValue; widget.indexController.areaDropdownValue = newValue;
widget.indexController.populateSubPerForArea(newValue, widget.mapController); widget.indexController.populateSubPerForArea(newValue, widget.mapController);
}
}); });
}, },
items: getCustomArea(), items: getCustomArea(),
@ -203,7 +200,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
) : ) :
const Text(""), const Text(""),
//CatWidget(indexController: widget.indexController,), //CatWidget(indexController: widget.indexController,),
widget.indexController.cats.length > 0 ? widget.indexController.cats.isNotEmpty ?
DropdownButton<String>( DropdownButton<String>(
value: widget.indexController.getCatText(), value: widget.indexController.getCatText(),
icon: const Icon(Icons.arrow_downward), icon: const Icon(Icons.arrow_downward),

View File

@ -229,10 +229,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: file_picker name: file_picker
sha256: d090ae03df98b0247b82e5928f44d1b959867049d18d73635e2e0bc3f49542b9 sha256: b85eb92b175767fdaa0c543bf3b0d1f610fe966412ea72845fe5ba7801e763ff
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.2.5" version: "5.2.10"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -346,26 +346,26 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_map_location_marker name: flutter_map_location_marker
sha256: "56989cd7de32345247c01216440c98d6a9b9d3970e2c5bb92e806bbc9384afad" sha256: c65b31e0759ca36326318a281a76dfb13c782d438b5cf622b11059b752ced1e2
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.0.0+1" version: "5.3.0"
flutter_map_marker_cluster: flutter_map_marker_cluster:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_map_marker_cluster name: flutter_map_marker_cluster
sha256: "793e68ccdb323f0e5059eecf3f8777892a9365186ab57c07ebe82e10ad7737ef" sha256: "63d8658a4d1357679f591308b9567d1d66cb23ba37a2b7792ff48ff009553283"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.2" version: "1.1.0"
flutter_map_marker_popup: flutter_map_marker_popup:
dependency: transitive dependency: transitive
description: description:
name: flutter_map_marker_popup name: flutter_map_marker_popup
sha256: b83e11dd8611f27d02050de3f262fac8eeb888abb5e562113b3be578573914f2 sha256: f5a40d006e07154a213345300217e8f995ddd3cd280dbe8dc8964f47e7d7fe7c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.1" version: "4.0.3"
flutter_map_tile_caching: flutter_map_tile_caching:
dependency: "direct main" dependency: "direct main"
description: description:
@ -436,18 +436,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: geolocator name: geolocator
sha256: "672ba7193539d9092fac6c92d17692df2294c60109929ecb255cd6e52825ec4d" sha256: "5c23f3613f50586c0bbb2b8f970240ae66b3bd992088cf60dd5ee2e6f7dde3a8"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "9.0.1" version: "9.0.2"
geolocator_android: geolocator_android:
dependency: transitive dependency: transitive
description: description:
name: geolocator_android name: geolocator_android
sha256: "977d7b47150b331dad7d7c645b83e9fc52ecfd0436afb27fbf9cbee6dcd4075e" sha256: b06c72853c993ae533f482d81a12805d7a441f5231d9668718bc7131d7464082
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.0" version: "4.2.0"
geolocator_apple: geolocator_apple:
dependency: transitive dependency: transitive
description: description:
@ -504,14 +504,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.1" version: "3.0.1"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
sha256: e70521755a6b08c6bde14ddae27dff5bf21010033888fc61da6c595f8a9f58c1
url: "https://pub.dev"
source: hosted
version: "2.3.3"
google_maps_flutter: google_maps_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -632,6 +624,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.17.0" version: "0.17.0"
is_lock_screen:
dependency: "direct main"
description:
name: is_lock_screen
sha256: "7f45c22b1bb4bd9849aa699bc45b5b9473ada262a4266e1d7d51babdf50c0c83"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
iso: iso:
dependency: transitive dependency: transitive
description: description:
@ -912,16 +912,8 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
positioned_tap_detector:
dependency: "direct main"
description:
name: positioned_tap_detector
sha256: a2e6b0466acfa34ded2d7f4b4ce34d81bac201335f67628bab49a758cc4b94c1
url: "https://pub.dev"
source: hosted
version: "1.0.3"
positioned_tap_detector_2: positioned_tap_detector_2:
dependency: transitive dependency: "direct main"
description: description:
name: positioned_tap_detector_2 name: positioned_tap_detector_2
sha256: "52e06863ad3e1f82b058fd05054fc8c9caeeb3b47d5cea7a24bd9320746059c1" sha256: "52e06863ad3e1f82b058fd05054fc8c9caeeb3b47d5cea7a24bd9320746059c1"
@ -988,10 +980,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: share_plus_platform_interface name: share_plus_platform_interface
sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1" sha256: "0c6e61471bd71b04a138b8b588fa388e66d8b005e6f2deda63371c5c505a0981"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.0" version: "3.2.1"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1153,10 +1145,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: timezone name: timezone
sha256: "24c8fcdd49a805d95777a39064862133ff816ebfffe0ceff110fb5960e557964" sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.9.1" version: "0.9.2"
transparent_image: transparent_image:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -42,7 +42,7 @@ dependencies:
google_api_availability: ^3.0.1 google_api_availability: ^3.0.1
tuple: ^2.0.0 tuple: ^2.0.0
latlong2: ^0.8.1 latlong2: ^0.8.1
positioned_tap_detector: ^1.0.3 positioned_tap_detector_2: ^1.0.4
transparent_image: ^2.0.0 transparent_image: ^2.0.0
async: ^2.8.2 async: ^2.8.2
vector_math: ^2.1.1 vector_math: ^2.1.1
@ -54,7 +54,7 @@ dependencies:
flutter_map_location_marker: any flutter_map_location_marker: any
flutter_map_marker_cluster: any flutter_map_marker_cluster: any
material_design_icons_flutter: ^5.0.6595 material_design_icons_flutter: ^5.0.6595
google_fonts: ^2.1.1 #google_fonts: ^2.1.1
image_picker: ^0.8.4+4 image_picker: ^0.8.4+4
#geojson_vi: ^2.0.7 #geojson_vi: ^2.0.7
geojson: ^1.0.0 geojson: ^1.0.0
@ -75,6 +75,7 @@ dependencies:
connectivity_plus: ^3.0.2 connectivity_plus: ^3.0.2
flutter_map_tile_caching: ^6.2.0 flutter_map_tile_caching: ^6.2.0
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
is_lock_screen: ^2.0.0
flutter_icons: flutter_icons:
android: true android: true

View File

@ -13,7 +13,7 @@ import 'package:rogapp/main.dart';
void main() { void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame. // Build our app and trigger a frame.
await tester.pumpWidget( MyApp()); await tester.pumpWidget( const MyApp());
// Verify that our counter starts at 0. // Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget); expect(find.text('0'), findsOneWidget);