update to server location popup

This commit is contained in:
Mohamed Nouffer
2022-10-30 21:43:29 +05:30
parent 2d9f7a9633
commit d16d97f64f
17 changed files with 700 additions and 241 deletions

91
.gitignore vendored
View File

@ -1,46 +1,45 @@
# Miscellaneous # Miscellaneous
*.class *.class
*.log *.log
*.pyc *.pyc
*.swp *.swp
.DS_Store .DS_Store
.atom/ .atom/
.buildlog/ .buildlog/
.history .history
.svn/ .svn/
# IntelliJ related # IntelliJ related
*.iml *.iml
*.ipr *.ipr
*.iws *.iws
.idea/ .idea/
# The .vscode folder contains launch configuration and tasks you configure in # The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line # VS Code which you may wish to be included in version control, so this line
# is commented out by default. # is commented out by default.
#.vscode/ #.vscode/
# Flutter/Dart/Pub related # Flutter/Dart/Pub related
**/doc/api/ **/doc/api/
**/ios/Flutter/.last_build_id **/ios/Flutter/.last_build_id
.dart_tool/ .dart_tool/
.flutter-plugins .flutter-plugins
.flutter-plugins-dependencies .flutter-plugins-dependencies
.packages .packages
.pub-cache/ .pub-cache/
.pub/ .pub/
/build/ /build/
# Web related # Web related
lib/generated_plugin_registrant.dart
# Symbolication related
# Symbolication related app.*.symbols
app.*.symbols
# Obfuscation related
# Obfuscation related app.*.map.json
app.*.map.json
# Android Studio will place build artifacts here
# Android Studio will place build artifacts here /android/app/debug
/android/app/debug /android/app/profile
/android/app/profile /android/app/release
/android/app/release

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -20,6 +20,7 @@ class MyApp extends StatelessWidget {
return GetMaterialApp( return GetMaterialApp(
translations: StringValues(), translations: StringValues(),
locale: const Locale('ja', 'JP'), locale: const Locale('ja', 'JP'),
//locale: const Locale('en', 'US'),
fallbackLocale: const Locale('en', 'US'), fallbackLocale: const Locale('en', 'US'),
title: 'ROGAINING', title: 'ROGAINING',
theme: ThemeData( theme: ThemeData(

View File

@ -21,6 +21,7 @@ class Destination {
double? cp; double? cp;
double? checkin_point; double? checkin_point;
double? buy_point; double? buy_point;
int? hidden_location;
Destination({ Destination({
this.name, this.name,
@ -42,7 +43,8 @@ class Destination {
this.checkedin, this.checkedin,
this.cp, this.cp,
this.checkin_point, this.checkin_point,
this.buy_point this.buy_point,
this.hidden_location
}); });
factory Destination.fromMap(Map<String, dynamic> json) { factory Destination.fromMap(Map<String, dynamic> json) {
@ -70,7 +72,8 @@ class Destination {
checkedin: checkin, checkedin: checkin,
cp: json['cp'], cp: json['cp'],
checkin_point: json['checkin_point'], checkin_point: json['checkin_point'],
buy_point: json['buy_point'] buy_point: json['buy_point'],
hidden_location: json['hidden_location']
); );
} }
@ -97,7 +100,8 @@ class Destination {
'checkedin': check, 'checkedin': check,
'cp' : cp, 'cp' : cp,
'checkin_point' : checkin_point, 'checkin_point' : checkin_point,
'buy_point' : buy_point 'buy_point' : buy_point,
'hidden_location' : hidden_location
}; };
} }

View File

@ -19,38 +19,9 @@ class CameraPage extends StatelessWidget {
} }
} }
// void finishRog(){ Widget getAction(BuildContext context){
// destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id) if(destinationController.is_at_goal.value && destinationController.is_in_rog.value){
// } return Row(
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("finishing_rogaining".tr),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Center(
child: Obx(() =>
Container(
width: MediaQuery.of(context).size.width,
height: 370,
decoration: BoxDecoration(
image:
DecorationImage(
image: getFinishImage(),
fit: BoxFit.cover
)
),
),
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
ElevatedButton( ElevatedButton(
@ -81,9 +52,12 @@ class CameraPage extends StatelessWidget {
print("---called ext api ${value['status']} ------"); print("---called ext api ${value['status']} ------");
if(value['status'] == 'OK'){ if(value['status'] == 'OK'){
Get.back(); Get.back();
destinationController.skip_gps = false;
Get.snackbar("goal_saved", "goal_added_successfuly"); Get.snackbar("goal_saved", "goal_added_successfuly");
destinationController.resetRogaining();
} }
else{ else{
print("---- status ${value['status']} ---- ");
Get.snackbar("goal_not_added", "please_try_again"); Get.snackbar("goal_not_added", "please_try_again");
} }
}); });
@ -93,9 +67,127 @@ class CameraPage extends StatelessWidget {
Container() Container()
) )
], ],
) );
], }
else{
return ElevatedButton(
child: Text("Checking image"),
onPressed: (){
Get.back();
},
);
}
}
// void finishRog(){
// destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id)
// }
@override
Widget build(BuildContext context) {
if(destinationController.is_at_goal.value){
return Scaffold(
appBar: AppBar(
title: Text("finishing_rogaining".tr),
), ),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: EdgeInsets.all(8.0),
child: Center(
child: Obx(() =>
Container(
width: MediaQuery.of(context).size.width,
height: 370,
decoration: BoxDecoration(
image:
DecorationImage(
image: getFinishImage(),
fit: BoxFit.cover
)
),
),
),
),
),
getAction(context),
],
),
);
}
else if(destinationController.rogaining_counted.value == true) {
return NotAtGoal();
}
else {
return StartRogaining();
}
}
}
class StartRogaining extends StatelessWidget {
StartRogaining({Key? key}) : super(key: key);
DestinationController destinationController = Get.find<DestinationController>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Not started yet".tr,),
),
body: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)),
SizedBox(height: 40.0,),
ElevatedButton(
onPressed: (){
Get.back();
destinationController.skip_gps = false;
},
child: Text("Back"),
),
],
),
),
),
);
}
}
class NotAtGoal extends StatelessWidget {
NotAtGoal({Key? key}) : super(key: key);
DestinationController destinationController = Get.find<DestinationController>();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Not reached the goal yet".tr,),
),
body: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("You have not reached the goal yet.".tr, style: TextStyle(fontSize: 24)),
SizedBox(height: 40.0,),
ElevatedButton(
onPressed: (){
Get.back();
destinationController.skip_gps = false;
},
child: Text("Back"),
),
],
),
),
),
); );
} }
} }

View File

@ -12,6 +12,7 @@ import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/Rogaining.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/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/action_service.dart';
@ -20,6 +21,7 @@ import 'package:rogapp/services/external_service.dart';
import 'package:rogapp/services/maxtrix_service.dart'; import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/services/reacking_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 'dart:async'; import 'dart:async';
import 'package:rogapp/widgets/bottom_sheet_widget.dart'; import 'package:rogapp/widgets/bottom_sheet_widget.dart';
@ -31,17 +33,19 @@ class DestinationController extends GetxController {
var destinationCount = 0.obs; var destinationCount = 0.obs;
List<Destination> destinations = <Destination>[].obs; List<Destination> destinations = <Destination>[].obs;
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
double current_lat = 0.0; double current_lat = 0.0;
double current_lon = 0.0; double current_lon = 0.0;
List<Destination> currentSelectedDestinations = <Destination>[].obs; List<Destination> currentSelectedDestinations = <Destination>[].obs;
var is_in_checkin = false.obs;
var is_in_rog = false.obs; var is_in_rog = false.obs;
List<Rogaining> rogainings = <Rogaining>[].obs; var is_at_start = false.obs;
var is_at_goal = false.obs;
//List<Rogaining> rogainings = <Rogaining>[].obs;
bool checking_in = false; bool checking_in = false;
var isSelected = false.obs; var is_gps_selected = true.obs;
BuildContext? context; BuildContext? context;
List<String> gps = <String>["-- stating --"].obs; List<String> gps = <String>["-- stating --"].obs;
@ -49,6 +53,8 @@ class DestinationController extends GetxController {
var travelMode = 0.obs; var travelMode = 0.obs;
bool skip_gps = false;
Map<String, dynamic> matrix = {}; Map<String, dynamic> matrix = {};
@ -57,34 +63,284 @@ class DestinationController extends GetxController {
final IndexController indexController = Get.find<IndexController>(); final IndexController indexController = Get.find<IndexController>();
Timer? _timer; Timer? _timer;
int _start = 1; int _start = 0;
int _chekcs = 0;
var rogaining_counted = false.obs; var rogaining_counted = false.obs;
void startTimer(Destination d, double distance) { Destination festuretoDestination(GeoJsonFeature fs){
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
//print("----- ${indexController.currentFeature[0].properties} -----");
return Destination(
name: fs.properties!["location_name"],
address: fs.properties!["address"],
phone: fs.properties!["phone"],
email: fs.properties!["email"],
webcontents: fs.properties!["webcontents"],
videos: fs.properties!["videos"],
category: fs.properties!["category"],
series: 1,
lat: pt.latitude,
lon: pt.longitude,
location_id: fs.properties!["location_id"],
list_order: 1,
photos: fs.properties!["photos"],
checkin_radious: fs.properties!["checkin_radius"],
auto_checkin: fs.properties!["auto_checkin"] == true ? 1 : 0,
cp: fs.properties!["cp"],
checkin_point: fs.properties!["checkin_point"],
buy_point: fs.properties!["buy_point"],
selected: false,
checkedin: false,
hidden_location: fs.properties!["hidden_location"] == true ?1 : 0
);
}
void startTimerLocation(GeoJsonFeature fs, double distance) {
print("---- in startTimer ----");
double checkin_radious = fs.properties!['checkin_radius'] ?? double.infinity;
if(checkin_radious >= distance){
indexController.currentDestinationFeature.clear();
Destination d = festuretoDestination(fs);
indexController.currentDestinationFeature.add(d);
print("---- before calling startTimer ----");
startTimer(d, distance);
}
}
void startTimer(Destination d, double distance) async {
skip_gps = true;
print("---- in startTimer ----");
double checkin_radious = d.checkin_radious ?? double.infinity;
bool auto_checkin = d.auto_checkin == 0 ? false : true;
bool location_already_checked_in = d.checkedin ?? false;
bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false;
//make current destination
print("---- checkin_radious ${checkin_radious} ----");
print("---- distance ${distance} ----");
if(checkin_radious >= distance){
//currentSelectedDestinations.add(d);
indexController.currentDestinationFeature.clear();
indexController.currentDestinationFeature.add(d);
print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----");
}
else {
skip_gps = false;
return;
}
DatabaseHelper db = DatabaseHelper.instance;
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
if(ds.isEmpty){
print("----- in location popup cp - ${d.cp}----");
if(d.cp == -1){
_chekcs = 1;
//start
print("---- in start -----");
_chekcs = 1;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_start.value = false;
});
}
else
{
print("----- in location popup checkin cp - ${d.cp}----");
_chekcs = 1;
//is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
}
print("---- location checkin radious ${d.checkin_radious} ----");
print("---- already checked in ${location_already_checked_in} ----");
if(checkin_radious >= distance && location_already_checked_in == false){
if(auto_checkin){
if(!checking_in){
makeCheckin(d, true);
if(d.cp != -1){
rogaining_counted.value =true;
}
skip_gps = false;
}
}
else{
// ask for checkin
if(d.hidden_location != null && d.hidden_location ==true && is_in_rog.value == true){
_chekcs = 1;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => CameraPage())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
else if(is_in_rog.value == true){
_chekcs = 1;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
}
}
if(isUser_logged_in && d.cp == -1 && location_already_checked_in){
//check for rogaining
if(is_at_goal.value == false && rogaining_counted.value){
//goal
print("---- in goal -----");
_chekcs = 1;
is_at_goal.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => CameraPage())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_goal.value = false;
});
}
else if(is_in_rog.value == false){
//start
print("---- in start -----");
_chekcs = 1;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_start.value = false;
});
}
}
print("---- _chekcs ${_chekcs} ----");
if(_chekcs == 0){
skip_gps = false;
}
}
void startTimer2(Destination d, double distance) {
skip_gps = true;
print("---- in startTimer ----");
double checkin_radious = d.checkin_radious ?? double.infinity;
bool auto_checkin = d.auto_checkin == 0 ? false : true;
bool location_already_checked_id = d.checkedin ?? false;
bool isUser_logged_in = indexController.currentUser.length > 0 ? true : false;
//make current destination
print("---- checkin_radious ${checkin_radious} ----");
print("---- distance ${distance} ----");
if(checkin_radious >= distance){
//currentSelectedDestinations.add(d);
indexController.currentDestinationFeature.clear();
indexController.currentDestinationFeature.add(d);
print("---- checked in as ${indexController.currentDestinationFeature[0].checkedin.toString()} ----");
}
const oneSec = const Duration(seconds: 1); const oneSec = const Duration(seconds: 1);
_timer = Timer.periodic( _timer = Timer.periodic(
oneSec, oneSec,
(Timer timer) { (Timer timer) {
if (_start == 0) { if (_start == 0) {
if(is_in_rog.value == false){ //make checkin
is_in_rog.value = true; print("---- location checkin radious ${d.checkin_radious} ----");
addToRogaining(current_lat, current_lon, d.location_id!); print("---- already checked in ${location_already_checked_id} ----");
Get.snackbar("Rogaining Started ", "Rogaining session started"); if(checkin_radious >= distance && location_already_checked_id == false){
if(auto_checkin){
if(!checking_in){
makeCheckin(d, true);
if(d.cp != -1){
rogaining_counted.value =true;
}
skip_gps = false;
}
}
else{
// ask for checkin
_chekcs = 1;
is_in_checkin.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_in_checkin.value = false;
});
}
} }
else{
//finish rogiain if(isUser_logged_in && d.cp == -1 && location_already_checked_id){
if (rogaining_counted.value && distance <=250){ //check for rogaining
Get.toNamed(AppPages.CAMERA_PAGE); if(is_at_goal.value == false && rogaining_counted.value){
//goal
print("---- in goal -----");
_chekcs = 1;
is_at_goal.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_goal.value = false;
});
}
else if(is_in_rog.value == false){
//start
print("---- in start -----");
_chekcs = 1;
is_at_start.value = true;
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
skip_gps = false;
_chekcs = 0;
is_at_start.value = false;
});
} }
} }
timer.cancel(); timer.cancel();
} else { } else {
_start--; _start--;
} }
print("---- _chekcs ${_chekcs} ----");
if(_chekcs == 0){
skip_gps = false;
}
}, },
); );
} }
void resetRogaining(){
is_in_checkin.value = false;
is_in_rog.value = false;
is_at_start.value = false;
is_at_goal.value = false;
_start = 0;
_chekcs = 0;
rogaining_counted.value = false;
}
void openCamera(BuildContext context) { void openCamera(BuildContext context) {
photos.clear(); photos.clear();
Navigator.push( Navigator.push(
@ -110,10 +366,8 @@ class DestinationController extends GetxController {
}); });
} }
Future<Destination?> getDEstinationForLatLong(double lat, double long)async { Future<Destination?> getDestinationForLatLong(double lat, double long)async {
String jjjj = '{"id":1,"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[136.731357,35.370094]]},"properties":{"location_id":915101,"location_name":"柳津","category":"買い物","zip":"〒501-6100","address":"柳津町字仙右城7696-1"}}';
for(final d in destinations){ for(final d in destinations){
if(lat == d.lat && long == d.lon){ if(lat == d.lat && long == d.lon){
return d; return d;
@ -121,90 +375,67 @@ class DestinationController extends GetxController {
} }
} }
// void addToRogaining(Rogaining rog){ void checkForCheckin(double la, double ln){
// DatabaseHelper db = DatabaseHelper.instance;
// db.insertRogaining(rog);
// }
checkForCheckin(double la, double ln){ print("--- skip_gps ---- ${skip_gps}----");
for(final d in destinations){ for(final d in destinations){
print("-----loc_id- ${d.location_id}----"); print("--- check checkin for--loc_id- ${d.location_id}----");
if(!checking_in)
{
checking_in = true;
double lat = d.lat!; double lat = d.lat!;
double lon = d.lon!; double lon = d.lon!;
LatLng p = LatLng(lat, lon); LatLng p = LatLng(lat, lon);
getDEstinationForLatLong(lat, lon).then((value){ getDestinationForLatLong(lat, lon).then((value){
var distance = Distance(); var distance = 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 rad = value!.checkin_radious ?? double.infinity; //double checkin_radious = value!.checkin_radious ?? double.infinity;
bool auto_checkin = value.auto_checkin == 0 ? false : true; //bool auto_checkin = value.auto_checkin == 0 ? false : true;
//bool location_already_checked_id = d.checkedin ?? false;
print("-----rogaining_counted---${rogaining_counted.value}-----"); // print("-----rogaining_counted---${rogaining_counted.value}-----");
print("-----is_in_rog---${is_in_rog}-----"); // print("-----is_in_rog---${is_in_rog}-----");
print("-----dist is ---${dist}-----"); // print("-----dist is ---${dist}-----");
//print("----- ${indexController.currentUser} ----");
if(d.cp != -1 && is_in_rog == true){ if(dist <= 250 && skip_gps == false){
rogaining_counted.value == true; //near a destination
} print("---- time with ${d.location_id} ----");
if(d.cp == -1 && dist <= 250 && rogaining_counted.value == false){
startTimer(d, dist); startTimer(d, dist);
} }
indexController.currentDestinationFeature.add(value);
//indexController.getAction();
if(rad >= dist){
if(auto_checkin){
makeCheckin(value, true);
}
else{
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
// builder:((context) => BottomSheetWidget())
// ).whenComplete((){
// checking_in = false;
// });
}
}
// if(!checking_in){
// checking_in = true;
// if(rad >= dist){
// if(auto_checkin){
// if(indexController.currentAction.isNotEmpty){
// print(indexController.currentAction[0]);
// indexController.currentAction[0][0]["checkin"] = true;
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
// indexController.currentAction.clear();
// print("---temp---${temp}");
// indexController.currentAction.add([temp]);
// }
// indexController.makeAction(Get.context!);
// }
// else{
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
// builder:((context) => BottomSheetWidget())
// ).whenComplete((){
// checking_in = false;
// });
// }
// }
// }
}); });
} }
//check for location in bounds
for(GeoJsonFeature fs in indexController.locations[0].collection){
GeoJsonMultiPoint mp = fs.geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
double lat_fs = pt.latitude;
double lon_fs = pt.longitude;
LatLng p_fs = LatLng(lat_fs, lon_fs);
var distance_fs = Distance();
double dist_fs = distance_fs.as(LengthUnit.Meter, LatLng(lat_fs, lon_fs), LatLng(la, ln));
if(dist_fs <= 250 && skip_gps == false){
//near a location
print("---- before call startTimerLocation ----");
startTimerLocation(fs, dist_fs);
}
} }
} }
void addToRogaining(double lat, double lon, int destination_id){ void addToRogaining(double lat, double lon, int destination_id) async {
DatabaseHelper db = DatabaseHelper.instance;
Destination d = await db.getDestinationById(destination_id);
if(d == null){
Destination df = festuretoDestination(indexController.currentFeature[0]);
makeCheckin(df, true);
}
Rogaining rog = Rogaining( Rogaining rog = Rogaining(
rog_id: null, rog_id: null,
course_id: 1, course_id: 1,
@ -214,7 +445,6 @@ class DestinationController extends GetxController {
lon:lon, lon:lon,
time_stamp: DateTime.now().toUtc().microsecondsSinceEpoch time_stamp: DateTime.now().toUtc().microsecondsSinceEpoch
); );
DatabaseHelper db = DatabaseHelper.instance;
db.insertRogaining(rog).then((value){ db.insertRogaining(rog).then((value){
print("----- inserted value ${value} ---------"); print("----- inserted value ${value} ---------");
}); });
@ -224,15 +454,17 @@ class DestinationController extends GetxController {
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@"); // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
int res = await db.updateAction(destination, action); int res = await db.updateAction(destination, action);
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!); List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@"); if(ddd.isEmpty){
await db.insertDestination(destination);
}
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@"); // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@");
PopulateDestinations();
// print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@"); // print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
// print("---- database update resulr ------ res : ${res}-------"); // print("---- database update resulr ------ res : ${res}-------");
PopulateDestinations();
/// post to NATNAT /// post to NATNAT
if(indexController.currentUser.length > 0){ if(indexController.currentUser.length > 0){
int cp_num = int.parse(destination.cp!.toString()); int cp_num = int.parse(destination.cp!.toString());
@ -252,14 +484,12 @@ class DestinationController extends GetxController {
//print("------ in iniit"); //print("------ in iniit");
if (defaultTargetPlatform == TargetPlatform.android) { if (defaultTargetPlatform == TargetPlatform.android) {
locationSettings = AndroidSettings( locationSettings = AndroidSettings(
accuracy: LocationAccuracy.bestForNavigation, accuracy: LocationAccuracy.bestForNavigation,
distanceFilter: 00, distanceFilter: 00,
forceLocationManager: true, forceLocationManager: true,
intervalDuration: const Duration(seconds: 1), intervalDuration: const Duration(seconds: 10),
//(Optional) Set foreground notification config to keep the app alive //(Optional) Set foreground notification config to keep the app alive
//when going to the background //when going to the background
foregroundNotificationConfig: const ForegroundNotificationConfig( foregroundNotificationConfig: const ForegroundNotificationConfig(
@ -273,7 +503,7 @@ class DestinationController extends GetxController {
locationSettings = AppleSettings( locationSettings = AppleSettings(
accuracy: LocationAccuracy.bestForNavigation, accuracy: LocationAccuracy.bestForNavigation,
activityType: ActivityType.fitness, activityType: ActivityType.fitness,
distanceFilter: 1, distanceFilter: 30,
pauseLocationUpdatesAutomatically: false, pauseLocationUpdatesAutomatically: false,
// Only set to true if our app will be started up in the background. // Only set to true if our app will be started up in the background.
showBackgroundLocationIndicator: true showBackgroundLocationIndicator: true
@ -293,7 +523,7 @@ class DestinationController extends GetxController {
current_lat = position != null ? position.latitude : 0; current_lat = position != null ? position.latitude : 0;
current_lon = position != null ? position.longitude : 0; current_lon = position != null ? position.longitude : 0;
if(isSelected.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();
@ -302,6 +532,8 @@ class DestinationController extends GetxController {
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("---- skip gps is ${skip_gps.toString()} ----");
//}); //});
} }
@ -342,9 +574,9 @@ class DestinationController extends GetxController {
void deleteDestination(Destination d){ void deleteDestination(Destination d){
//int id = destinations[index].location_id!; //int id = destinations[index].location_id!;
//print("---- index ${destinations[index].location_id!}-----"); //print("---- index ${destinations[index].location_id!}-----");
for(Destination ss in currentSelectedDestinations){ for(Destination ss in destinations){
if(ss.location_id == d.location_id){ if(ss.location_id == d.location_id){
currentSelectedDestinations.remove(ss); destinations.remove(ss);
break; break;
} }
} }
@ -365,7 +597,7 @@ class DestinationController extends GetxController {
void addDestinations(Destination dest){ void addDestinations(Destination dest){
print('------ destination controller in add destination ${dest.name} ---- :::::'); print('------ destination controller in add destination ${dest.checkin_radious} ---- :::::');
DatabaseHelper db = DatabaseHelper.instance; DatabaseHelper db = DatabaseHelper.instance;
db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){ db.getDestinationByLatLon(dest.lat!, dest.lon!).then((value){
@ -395,12 +627,12 @@ class DestinationController extends GetxController {
db.getDestinations().then((value){ db.getDestinations().then((value){
destinationCount.value = 0; destinationCount.value = 0;
for(Destination d in value){ for(Destination d in value){
for(Destination s in currentSelectedDestinations){ for(Destination s in destinations){
if(d.location_id == s.location_id){ if(d.location_id == s.location_id){
d.selected = !d.selected!; d.selected = !d.selected!;
} }
} }
print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::");
destinations.add(d); destinations.add(d);
} }
// destinationCount.value = 0; // destinationCount.value = 0;

View File

@ -160,14 +160,32 @@ class DestnationPage extends StatelessWidget {
automaticallyImplyLeading: true, automaticallyImplyLeading: true,
title: Text("app_title".tr), title: Text("app_title".tr),
actions: [ actions: [
TextButton( InkWell(
onPressed: (){ onTap: (){
//ExternalService().StartRogaining('team_name', "2222");
//destinationController.openCamera(context);
Get.toNamed(AppPages.CAMERA_PAGE); Get.toNamed(AppPages.CAMERA_PAGE);
}, },
child: Icon(Icons.ac_unit), child: destinationController.is_in_rog == true ?
Image.asset("assets/images/basic-walking.gif",height: 10.0,)
:
destinationController.is_at_goal == true ?
IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.assistant_photo),
)
:
IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.accessibility),
),
), ),
// TextButton(
// onPressed: (){
// //ExternalService().StartRogaining('team_name', "2222");
// //destinationController.openCamera(context);
// Get.toNamed(AppPages.CAMERA_PAGE);
// },
// child: Icon(Icons.ac_unit),
// ),
Obx(() => Obx(() =>
ToggleButtons( ToggleButtons(
disabledColor: Colors.grey.shade200, disabledColor: Colors.grey.shade200,
@ -176,9 +194,12 @@ class DestnationPage extends StatelessWidget {
Icon(Icons.explore, size: 35.0, Icon(Icons.explore, size: 35.0,
)], )],
onPressed: (int index) { onPressed: (int index) {
destinationController.isSelected.value = !destinationController.isSelected.value; destinationController.is_gps_selected.value = !destinationController.is_gps_selected.value;
if(destinationController.is_gps_selected.value){
destinationController.skip_gps = false;
}
}, },
isSelected: [destinationController.isSelected.value], isSelected: [destinationController.is_gps_selected.value],
), ),
), ),
// IconButton(onPressed: (){ // IconButton(onPressed: (){

View File

@ -131,7 +131,12 @@ class DestinationMapPage extends StatelessWidget {
if (mapEvent is MapEventMoveStart) { if (mapEvent is MapEventMoveStart) {
} }
if (mapEvent is MapEventMoveEnd) { if (mapEvent is MapEventMoveEnd) {
destinationController.isSelected.value = false; //destinationController.is_gps_selected.value = true;
//indexController.mapController!.move(c.center, c.zoom);
LatLngBounds bounds = c.bounds!;
indexController.currentBound.clear();
indexController.currentBound.add(bounds);
indexController.loadLocationsBound();
} }
}); });
}); });

View File

@ -113,13 +113,6 @@ class IndexController extends GetxController {
@override @override
void onInit() { void onInit() {
// if(locations.length == 0){
// LocationService.loadLocations().then((value){
// locations.add(value!);
// //print(value);
// });
// }
_ever = ever(rog_mode, (_) => print("$_ has been changed (ever)")); _ever = ever(rog_mode, (_) => print("$_ has been changed (ever)"));
if(perfectures.length == 0){ if(perfectures.length == 0){
@ -215,7 +208,6 @@ void login(String email, String password, BuildContext context){
else{ else{
switchPage(AppPages.INITIAL); switchPage(AppPages.INITIAL);
} }
//Get.toNamed(AppPages.INITIAL);
}else{ }else{
Get.snackbar( Get.snackbar(
'failed'.tr, 'failed'.tr,
@ -587,7 +579,6 @@ void login(String email, String password, BuildContext context){
if(rog_mode == 1){ if(rog_mode == 1){
DestinationController destinationController = Get.find<DestinationController>(); DestinationController destinationController = Get.find<DestinationController>();
print("---- destination index--- ${destinationController.destination_index_data} --------");
} }
else { else {
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>; GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
@ -620,7 +611,6 @@ void login(String email, String password, BuildContext context){
if(rog_mode == 1){ if(rog_mode == 1){
DestinationController destinationController = Get.find<DestinationController>(); DestinationController destinationController = Get.find<DestinationController>();
print("---- destination index--- ${destinationController.destination_index_data} --------");
} }
else { else {

View File

@ -68,19 +68,23 @@ class IndexPage extends GetView<IndexController> {
child: InkWell( child: InkWell(
child: child:
Obx(() => Obx(() =>
destinationController.isSelected == true ? destinationController.is_gps_selected == true ?
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: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,),
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);}, onTap: (){
indexController.switchPage(AppPages.TRAVEL);
},
), ),
) : ) :
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: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,),
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);}, onTap: (){
indexController.switchPage(AppPages.TRAVEL);
},
), ),
) )
) )

View File

@ -164,6 +164,7 @@ class LocationService{
return null; return null;
} }
else{ else{
//print("---- feature got from server is ${cc.collection[0].properties} ------");
return cc; return cc;
} }
} }

View File

@ -2,9 +2,10 @@
class ConstValues{ class ConstValues{
static const server_uri = "http://container.intranet.sumasen.net:8100"; static const container_svr = "http://container.intranet.sumasen.net:8100";
static const server_uri = "https://rogaining.sumasen.net";
static const dev_server = "http://localhost:8100"; static const dev_server = "http://localhost:8100";
static const dev_ip_server = "http://192.168.8.100:8100"; static const dev_ip_server = "http://192.168.1.10:8100";
static const dev_home_ip_server = "http://172.20.10.9:8100"; static const dev_home_ip_server = "http://172.20.10.9:8100";
static String currentServer(){ static String currentServer(){

View File

@ -45,7 +45,8 @@ class DatabaseHelper{
checkedin INTEGER, checkedin INTEGER,
cp REAL, cp REAL,
checkin_point REAL, checkin_point REAL,
buy_point REAL buy_point REAL,
hidden_location INTEGER
) )
'''); ''');
@ -82,6 +83,14 @@ class DatabaseHelper{
return roglist; return roglist;
} }
Future<Destination> getDestinationById(int id) async {
Database db = await instance.database;
var rog = await db.query('destination', where: "location_id = ${id}");
List<Destination> deslist = rog.isNotEmpty
? rog.map((e) => Destination.fromMap(e)).toList() : [];
return deslist[0];
}
Future<int> deleteRogaining(int rog_id) async { Future<int> deleteRogaining(int rog_id) async {
Database db = await instance.database; Database db = await instance.database;
@ -195,7 +204,7 @@ class DatabaseHelper{
dest.toMap(), dest.toMap(),
conflictAlgorithm: ConflictAlgorithm.replace, conflictAlgorithm: ConflictAlgorithm.replace,
); );
print("------ database helper insert ${res}-----------::::::::"); print("------ database helper insert ${dest.toMap()}-----------::::::::");
return res; return res;
} }

View File

@ -58,7 +58,16 @@ class StringValues extends Translations{
'goal_saved': "Goal Saved", 'goal_saved': "Goal Saved",
'goal_added_successfuly' : 'Goal added successfully', 'goal_added_successfuly' : 'Goal added successfully',
'goal_not_added' : 'Goal not added', 'goal_not_added' : 'Goal not added',
'please_try_again' : 'Please try again' 'please_try_again' : 'Please try again',
"Click start to start rogaining":"Click start to start rogaining",
"you are at roganing point, start rogaining":"you are at roganing point, start rogaining",
"Start":"Start",
"Rogaining Started":"Rogaining Started",
"Rogaining session started":"Rogaining session started",
"Not started yet":"Not started yet",
"You have not started rogaining yet.":"You have not started rogaining yet.",
"Not reached the goal yet": "Not reached the goal yet",
"You have not reached the goal yet.":"You have not reached the goal yet."
}, },
'ja_JP': { 'ja_JP': {
'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます', 'drawer_title':'ロゲイニング参加者はログイン するとチェックポイントが参照 できます',
@ -117,7 +126,16 @@ class StringValues extends Translations{
'goal_saved': "目標を保存しました", 'goal_saved': "目標を保存しました",
'goal_added_successfuly' : '目標が正常に追加されました', 'goal_added_successfuly' : '目標が正常に追加されました',
'goal_not_added' : '目標が追加されていません', 'goal_not_added' : '目標が追加されていません',
'please_try_again' : 'もう一度お試しください' 'please_try_again' : 'もう一度お試しください',
"Click start to start rogaining":"開始をクリックして、ロゲイニングを開始します",
"you are at roganing point, start rogaining":"あなたはロガニングポイントにいます、ロガニングを始めてください",
"Start":"始める",
"Rogaining Started":"ロゲイニング開始",
"Rogaining session started":"ロゲイニングセッション開始",
"Not started yet":"まだ開始されていません",
"You have not started rogaining yet.":"あなたはまだロゲイニングを始めていません。",
"Not reached the goal yet": "まだ目標に達していない",
"You have not reached the goal yet.":"あなたはまだゴールに達していません。"
}, },
}; };
} }

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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:get/get_state_manager/get_state_manager.dart';
@ -8,6 +9,7 @@ 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/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/utils/const.dart';
import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/utils/text_util.dart'; import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/bottom_sheet_controller.dart'; import 'package:rogapp/widgets/bottom_sheet_controller.dart';
@ -21,6 +23,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Image getImage(){ Image getImage(){
String server_url = 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.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){
@ -40,7 +43,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
} }
else { else {
return Image(image: NetworkImage( return Image(image: NetworkImage(
'http://container.intranet.sumasen.net:8100/media/' + indexController.currentDestinationFeature[0].photos!, '${server_url}/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");
@ -67,7 +70,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
} }
else { else {
return Image(image: NetworkImage( return Image(image: NetworkImage(
'http://container.intranet.sumasen.net:8100/media/' + gf.properties!["photos"], '${server_url}/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");
@ -96,11 +99,15 @@ class BottomSheetNew extends GetView<BottomSheetController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print('---- rog_mode ----- ${indexController.rog_mode} -----');
return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context); return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context);
} }
// Show destination detais // Show destination detais
SingleChildScrollView destinationSheet(BuildContext context) { SingleChildScrollView destinationSheet(BuildContext context) {
print('---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----');
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
@ -156,6 +163,77 @@ class BottomSheetNew extends GetView<BottomSheetController> {
), ),
], ],
), ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Obx(() =>
indexController.currentDestinationFeature.isNotEmpty && destinationController.is_in_checkin.value == true ?
Row(
children: [
ElevatedButton(
onPressed: (){
if(indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false){
destinationController.makeCheckin(indexController.currentDestinationFeature[0], true);
if(indexController.currentDestinationFeature[0].cp != -1){
destinationController.rogaining_counted.value =true;
}
}
else{
destinationController.makeCheckin(indexController.currentDestinationFeature[0], false);
}
Get.back();
},
child: Text(
indexController.currentDestinationFeature[0].checkedin == null || indexController.currentDestinationFeature[0].checkedin == false ?
"Chekin"
:
"Checkput"
)
),
],
)
:
Container(),
),
Obx(() =>
destinationController.is_at_start.value == true ?
ElevatedButton(
onPressed: (){
destinationController.is_in_rog.value = true;
destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, indexController.currentDestinationFeature[0].location_id!);
Get.back();
},
child: Text(
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"Start Rogaining"
:
"Wrong destination ..."
)
)
:
Container(),
),
Obx(() =>
destinationController.is_at_goal.value == true && destinationController.rogaining_counted ==true ?
ElevatedButton(
onPressed: (){
Get.toNamed(AppPages.CAMERA_PAGE);
Get.back();
},
child: Text(
indexController.currentDestinationFeature[0].checkedin != null || indexController.currentDestinationFeature[0].checkedin == true ?
"Finish Rogaining"
:
"Wrong destination ..."
)
)
:
Container(),
),
],
),
Obx(() => Obx(() =>
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! ?? '')
@ -187,19 +265,19 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Container(width: 0.0, height: 0,), Container(width: 0.0, height: 0,),
), ),
SizedBox(height: 20.0,), SizedBox(height: 20.0,),
Obx(() => // Obx(() =>
//wantToGo(context), // //wantToGo(context),
FutureBuilder<Widget>( // FutureBuilder<Widget>(
future: wantToGo(context), // future: wantToGo(context),
builder: (context, snapshot) { // builder: (context, snapshot) {
return Container( // return Container(
child: snapshot.data, // child: snapshot.data,
); // );
}, // },
), // ),
), // ),
SizedBox(height: 60.0,) SizedBox(height: 60.0,)
], ],
), ),
@ -440,6 +518,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint; GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint;
LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude); LatLng pt = LatLng(mp.geoSerie!.geoPoints[0].latitude, mp.geoSerie!.geoPoints[0].longitude);
//print("----- ${indexController.currentFeature[0].properties} -----");
Destination dest = Destination( Destination dest = Destination(
name: indexController.currentFeature[0].properties!["location_name"], name: indexController.currentFeature[0].properties!["location_name"],
address: indexController.currentFeature[0].properties!["address"], address: indexController.currentFeature[0].properties!["address"],
@ -454,13 +534,14 @@ class BottomSheetNew extends GetView<BottomSheetController> {
location_id: indexController.currentFeature[0].properties!["location_id"], location_id: indexController.currentFeature[0].properties!["location_id"],
list_order: 1, list_order: 1,
photos: indexController.currentFeature[0].properties!["photos"], photos: indexController.currentFeature[0].properties!["photos"],
checkin_radious: indexController.currentFeature[0].properties!["checkin_radious"], checkin_radious: indexController.currentFeature[0].properties!["checkin_radius"],
auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0, auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0,
cp: indexController.currentFeature[0].properties!["cp"], cp: indexController.currentFeature[0].properties!["cp"],
checkin_point: indexController.currentFeature[0].properties!["checkin_point"], checkin_point: indexController.currentFeature[0].properties!["checkin_point"],
buy_point: indexController.currentFeature[0].properties!["buy_point"], buy_point: indexController.currentFeature[0].properties!["buy_point"],
selected: false, selected: false,
checkedin: false checkedin: false,
hidden_location: indexController.currentFeature[0].properties!["hidden_location"] == true ?1 : 0
); );
destinationController.addDestinations(dest); destinationController.addDestinations(dest);
Get.back(); Get.back();
@ -589,13 +670,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}, },
child: Container( child: Container(
width: MediaQuery.of(context).size.width - 160, width: MediaQuery.of(context).size.width - 160,
child: Expanded( child: Text(text,
child: Text(text, style: TextStyle(
style: TextStyle( color: isurl ? Colors.blue : Colors.black,
color: isurl ? Colors.blue : Colors.black,
),
), ),
), ),
), ),
), ),
], ],

View File

@ -46,22 +46,23 @@ class DestinationWidget extends StatelessWidget {
} }
} }
bool getSelection(int index){ // bool getSelection(int index){
bool ret = false; // bool ret = false;
destinationController.destination_index_data.forEach((element) { // destinationController.destination_index_data.forEach((element) {
if(index == element["index"]){ // if(index == element["index"]){
if(element["selected"] == true){ // if(element["selected"] == true){
ret = true; // ret = true;
return; // return;
} // }
} // }
}); // });
return ret; // return ret;
} // }
void doDelete() { void doDelete() {
destinationController.currentSelectedDestinations.forEach((element) { destinationController.currentSelectedDestinations.forEach((element) {
destinationController.deleteDestination(element); destinationController.deleteDestination(element);
destinationController.resetRogaining();
}); });
// destinationController.destination_index_data.forEach((element) { // destinationController.destination_index_data.forEach((element) {
// //print(element["index"]); // //print(element["index"]);
@ -174,13 +175,14 @@ class DestinationWidget extends StatelessWidget {
onTap: () async { onTap: () async {
{ {
Destination? fs = destinationController.destinations[index]; Destination? fs = destinationController.destinations[index];
print("----fsf-----${fs}"); print("----fsf-----${fs.location_id}");
if(fs != null){ if(fs != null){
if(indexController.currentDestinationFeature.length > 0) { if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear(); indexController.currentDestinationFeature.clear();
} }
indexController.currentDestinationFeature.add(fs); indexController.currentDestinationFeature.add(fs);
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
//indexController.getAction(); //indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true, showModalBottomSheet(context: context, isScrollControlled: true,
@ -196,7 +198,7 @@ class DestinationWidget extends StatelessWidget {
if(destinationController.currentSelectedDestinations.length > 0){ if(destinationController.currentSelectedDestinations.length > 0){
if(destinationController.currentSelectedDestinations[0].location_id == destinationController.destinations[index].location_id){ if(destinationController.currentSelectedDestinations[0].location_id == destinationController.destinations[index].location_id){
destinationController.currentSelectedDestinations.clear(); destinationController.currentSelectedDestinations.clear();
print("---- fount ----"); print("---- found ----");
destinationController.PopulateDestinations(); destinationController.PopulateDestinations();
return; return;
} }

View File

@ -85,6 +85,7 @@ class MapWidget extends StatelessWidget {
if (mapEvent is MapEventMoveEnd) { if (mapEvent is MapEventMoveEnd) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] END'); //print(DateTime.now().toString() + ' [MapEventMoveStart] END');
indexController.loadLocationsBound(); indexController.loadLocationsBound();
//indexController.rogMapController!.move(c.center, c.zoom);
} }
}); });
}); });