temporary update

This commit is contained in:
2024-09-08 18:16:51 +09:00
parent 2c0bb06e74
commit e37c4ceebd
32 changed files with 1235 additions and 1189 deletions

View File

@ -1126,7 +1126,7 @@ class DestinationController extends GetxController {
}
Future<String?> _saveImageToGallery(String imagePath) async {
final status = await PermissionController.checkStoragePermission();
final status = await PermissionController.checkStoragePermission(); // destinationController._saveImageToGallery
if(!status){
await PermissionController.requestStoragePermission();
}
@ -1333,12 +1333,6 @@ class DestinationController extends GetxController {
void onInit() async {
super.onInit();
WidgetsBinding.instance.addPostFrameCallback((_) async {
await PermissionController.checkAndRequestPermissions();
});
startGPSCheckTimer();
// MapControllerの初期化完了を待機するフラグを設定
@ -1645,6 +1639,7 @@ class DestinationController extends GetxController {
final token = indexController.userToken;
if (token != null && token.isNotEmpty) {
await indexController.loadUserDetailsForToken(token);
await Future.delayed(Duration(milliseconds: 500)); // 短い遅延を追加
fixMapBound(token);
}else {
Get.toNamed(AppPages.LOGIN)!.then((value) {
@ -1665,6 +1660,9 @@ class DestinationController extends GetxController {
});
}
// MapControllerの準備が整うまで待機
await indexController.waitForMapControllerReady();
// 地図のイベントリスナーを設定
indexController.mapController.mapEventStream.listen((MapEvent mapEvent) {
if (mapEvent is MapEventMoveEnd) {
@ -1677,11 +1675,12 @@ class DestinationController extends GetxController {
// 地図の境界を修正する関数です。
//
void fixMapBound(String token) {
Future<void> fixMapBound(String token) async {
await indexController.waitForMapControllerReady();
//String _token = indexController.currentUser[0]["token"];
indexController.switchPage(AppPages.INDEX);
if (isMapControllerReady) {
if (indexController.isMapControllerReady.value) {
LocationService.getLocationsExt(token).then((value) {
if (value != null) {
//print("--- loc ext is - $value ----");
@ -1743,11 +1742,18 @@ class DestinationController extends GetxController {
// 地図を現在位置に中央揃えする関数です。
//
void centerMapToCurrentLocation() {
final indexController = Get.find<IndexController>();
if (indexController.isMapControllerReady.value && indexController.isMapControllerReady.value) {
// ... 現在位置へのセンタリングのロジック ...
indexController.mapController.move(LatLng(currentLat, currentLon), 17.0);
} else {
debugPrint('Map controller is not ready for centering');
}
//print("center is ${currentLat}, ${currentLon}");
// Akira ... 状況によって呼ぶか呼ばないか
if (currentLat != 0 || currentLon != 0) {
indexController.mapController.move(LatLng(currentLat, currentLon), 17.0);
}
//if (currentLat != 0 || currentLon != 0) {
//indexController.mapController.move(LatLng(currentLat, currentLon), 17.0);
//}
}
// 接続状態が変更されたときに呼び出される関数です。
@ -1920,7 +1926,7 @@ class DestinationController extends GetxController {
barrierDismissible: false,
builder: (BuildContext context) {
return const Center(
child: CircularProgressIndicator(),
child: CircularProgressIndicator(), // Destination COntroller
);
});
}