fixed start issue
This commit is contained in:
@ -669,20 +669,19 @@ class DestinationController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double distanceToStart() {
|
double distanceToStart() {
|
||||||
Destination? ds;
|
//print("=== gfs len == ${indexController.locations[0].collection.length}");
|
||||||
for (Destination d in destinations) {
|
GeoJsonFeature gfs = indexController.locations[0].collection
|
||||||
if (d.cp == -1) {
|
.firstWhere((element) => festuretoDestination(element).cp == -1);
|
||||||
ds = d;
|
|
||||||
}
|
Destination des = festuretoDestination(gfs);
|
||||||
}
|
|
||||||
|
//print("=== gfs == ${des.toMap()}");
|
||||||
|
|
||||||
double distanceToDest = double.infinity;
|
double distanceToDest = double.infinity;
|
||||||
if (ds != null) {
|
|
||||||
var distance = const Distance();
|
var distance = const Distance();
|
||||||
distanceToDest = distance.as(LengthUnit.Meter,
|
distanceToDest = distance.as(LengthUnit.Meter,
|
||||||
LatLng(currentLat, currentLon), LatLng(ds.lat!, ds.lon!));
|
LatLng(currentLat, currentLon), LatLng(des.lat!, des.lon!));
|
||||||
}
|
//print("==== dist==${distanceToDest}");
|
||||||
print("==== dist==${distanceToDest}");
|
|
||||||
return distanceToDest;
|
return distanceToDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,20 +691,17 @@ class DestinationController extends GetxController {
|
|||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
Destination? ds;
|
Destination? ds;
|
||||||
for (Destination d in destinations) {
|
GeoJsonFeature gfs = indexController.locations[0].collection
|
||||||
if (d.cp == -1) {
|
.firstWhere((element) => festuretoDestination(element).cp == -1);
|
||||||
ds = d;
|
|
||||||
}
|
ds = festuretoDestination(gfs);
|
||||||
}
|
|
||||||
if (ds != null) {
|
|
||||||
var distance = const Distance();
|
var distance = const Distance();
|
||||||
double distanceToDest = distance.as(LengthUnit.Meter,
|
double distanceToDest = distance.as(LengthUnit.Meter,
|
||||||
LatLng(dest.lat!, dest.lon!), LatLng(ds.lat!, ds.lon!));
|
LatLng(dest.lat!, dest.lon!), LatLng(ds.lat!, ds.lon!));
|
||||||
if (distanceToDest <= 500) {
|
if (distanceToDest <= 500) {
|
||||||
return 500;
|
return 500;
|
||||||
}
|
}
|
||||||
}
|
print("==== forced dist ==${distanceToDest}");
|
||||||
|
|
||||||
return _retValue;
|
return _retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -237,6 +237,7 @@ class DatabaseHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<int> insertDestination(Destination dest) async {
|
Future<int> insertDestination(Destination dest) async {
|
||||||
|
await deleteDestination(dest.location_id!);
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
int? nextOrder = Sqflite.firstIntValue(
|
int? nextOrder = Sqflite.firstIntValue(
|
||||||
await db.rawQuery('SELECT MAX(list_order) FROM destination'));
|
await db.rawQuery('SELECT MAX(list_order) FROM destination'));
|
||||||
|
|||||||
@ -109,9 +109,10 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
destinationController.skipGps = true;
|
destinationController.skipGps = true;
|
||||||
// print('--- c use --- ${indexController.currentUser[0].values}');
|
// print('--- c use --- ${indexController.currentUser[0].values}');
|
||||||
// print('---- rog_mode ----- ${indexController.rogMode.value} -----');
|
// print('---- rog_mode ----- ${indexController.rogMode.value} -----');
|
||||||
return indexController.rogMode.value == 0
|
// return indexController.rogMode.value == 0
|
||||||
? detailsSheet(context)
|
// ? detailsSheet(context)
|
||||||
: destinationSheet(context);
|
// : destinationSheet(context);
|
||||||
|
return detailsSheet(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show destination detais
|
// Show destination detais
|
||||||
@ -480,9 +481,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
// : "間違った目的地..."))
|
// : "間違った目的地..."))
|
||||||
// : Container(),
|
// : Container(),
|
||||||
// ),
|
// ),
|
||||||
Obx(
|
|
||||||
() => destinationController.rogainingCounted.value ==
|
destinationController.rogainingCounted.value == true &&
|
||||||
true &&
|
|
||||||
destination.cp == -1 &&
|
destination.cp == -1 &&
|
||||||
destinationController.distanceToStart() <= 500
|
destinationController.distanceToStart() <= 500
|
||||||
? ElevatedButton(
|
? ElevatedButton(
|
||||||
@ -490,22 +490,35 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
Get.toNamed(AppPages.CAMERA_PAGE);
|
Get.toNamed(AppPages.CAMERA_PAGE);
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text("ロゲイニングを終える"))
|
||||||
//goal
|
|
||||||
indexController
|
|
||||||
.currentDestinationFeature[
|
|
||||||
0]
|
|
||||||
.checkedin !=
|
|
||||||
null ||
|
|
||||||
indexController
|
|
||||||
.currentDestinationFeature[
|
|
||||||
0]
|
|
||||||
.checkedin ==
|
|
||||||
true
|
|
||||||
? "ロゲイニングを終える"
|
|
||||||
: "間違った目的地 ..."))
|
|
||||||
: Container(),
|
: Container(),
|
||||||
),
|
|
||||||
|
// Obx(
|
||||||
|
// () => destinationController.rogainingCounted.value ==
|
||||||
|
// false &&
|
||||||
|
// destination.cp == -1 &&
|
||||||
|
// destinationController.distanceToStart() <= 500
|
||||||
|
// ? ElevatedButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// Get.toNamed(AppPages.CAMERA_PAGE);
|
||||||
|
// Get.back();
|
||||||
|
// },
|
||||||
|
// child: Text(
|
||||||
|
// //goal
|
||||||
|
// indexController
|
||||||
|
// .currentDestinationFeature[
|
||||||
|
// 0]
|
||||||
|
// .checkedin !=
|
||||||
|
// null ||
|
||||||
|
// indexController
|
||||||
|
// .currentDestinationFeature[
|
||||||
|
// 0]
|
||||||
|
// .checkedin ==
|
||||||
|
// true
|
||||||
|
// ? "ロゲイニングを終える"
|
||||||
|
// : "間違った目的地 ..."))
|
||||||
|
// : Container(),
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
@ -555,8 +568,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
distanceToDest <=
|
distanceToDest <=
|
||||||
destinationController
|
destinationController
|
||||||
.getForcedChckinDistance(destination) &&
|
.getForcedChckinDistance(destination) &&
|
||||||
destinationController.isInCheckin.value ==
|
// destinationController.isInCheckin.value ==
|
||||||
true &&
|
// true &&
|
||||||
destinationController.rogainingCounted.value ==
|
destinationController.rogainingCounted.value ==
|
||||||
false
|
false
|
||||||
? ElevatedButton(
|
? ElevatedButton(
|
||||||
|
|||||||
Reference in New Issue
Block a user