#2832 まで解決
This commit is contained in:
@ -5,6 +5,7 @@ import 'package:geolocator/geolocator.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
//import 'package:rogapp/widgets/debug_widget.dart';
|
||||
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
|
||||
// LocationControllerクラスは、GetxControllerを継承したクラスであり、位置情報の管理を担当しています。
|
||||
// LocationControllerは以下の機能を提供しています。
|
||||
@ -66,7 +67,7 @@ class LocationController extends GetxController {
|
||||
|
||||
// シミュレートされた信号強度を取得するための関数
|
||||
String getSimulatedSignalStrength() {
|
||||
debugPrint("strength : ${_simulatedSignalStrength.value}");
|
||||
//debugPrint("strength : ${_simulatedSignalStrength.value}");
|
||||
return _simulatedSignalStrength.value;
|
||||
}
|
||||
|
||||
@ -269,22 +270,31 @@ class LocationController extends GetxController {
|
||||
isGpsSignalWeak = false;
|
||||
}
|
||||
|
||||
final adjustedLocation = adjustCurrentLocation(position);
|
||||
if (adjustedLocation != null) {
|
||||
final locationMarkerPosition = LocationMarkerPosition(
|
||||
latitude: adjustedLocation.latitude,
|
||||
longitude: adjustedLocation.longitude,
|
||||
accuracy: position?.accuracy ?? 0,
|
||||
);
|
||||
handleLocationUpdate(locationMarkerPosition);
|
||||
//locationMarkerPositionStreamController.add(locationMarkerPosition); // 位置データ送信
|
||||
} else {
|
||||
// 位置情報が取得できなかった場合、
|
||||
// locationMarkerPositionStreamControllerにnullを追加します。
|
||||
locationMarkerPositionStreamController.add(null); // null 送信?
|
||||
//forceUpdateLocation(Position? position);
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
// ロゲ開始前、終了後、GPS=low の場合は更新しない。
|
||||
//
|
||||
if (destinationController.isInRog.value && isGpsSignalWeak == false) {
|
||||
final adjustedLocation = adjustCurrentLocation(position);
|
||||
if (adjustedLocation != null) {
|
||||
final locationMarkerPosition = LocationMarkerPosition(
|
||||
latitude: adjustedLocation.latitude,
|
||||
longitude: adjustedLocation.longitude,
|
||||
accuracy: position?.accuracy ?? 0,
|
||||
);
|
||||
handleLocationUpdate(locationMarkerPosition);
|
||||
//locationMarkerPositionStreamController.add(locationMarkerPosition); // 位置データ送信
|
||||
} else {
|
||||
// 位置情報が取得できなかった場合、
|
||||
// locationMarkerPositionStreamControllerにnullを追加します。
|
||||
locationMarkerPositionStreamController.add(null); // null 送信?
|
||||
//forceUpdateLocation(Position? position);
|
||||
|
||||
}
|
||||
//}else{
|
||||
// debugPrint("GPS処理対象外");
|
||||
}
|
||||
|
||||
},
|
||||
onError: (e) {
|
||||
// エラーが発生した場合、locationMarkerPositionStreamControllerにエラーを追加します。
|
||||
@ -335,6 +345,7 @@ class LocationController extends GetxController {
|
||||
|
||||
void handleLocationUpdate(LocationMarkerPosition? position) async {
|
||||
if (position != null) {
|
||||
//debugPrint("position = ${position}");
|
||||
/*
|
||||
currentPosition.value = position;
|
||||
final locationMarkerPosition = LocationMarkerPosition(
|
||||
|
||||
Reference in New Issue
Block a user