2024-09-02 ほぼOK

This commit is contained in:
2024-09-02 21:25:19 +09:00
parent dc58dc0584
commit fe46d46ab6
59 changed files with 2006 additions and 677 deletions

View File

@ -175,7 +175,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
destinationController.currentLat, destinationController.currentLon),
LatLng(cdest.lat!, cdest.lon!));
// Check conditions to show confirmation dialog
// スタートボタン:
// 表示条件:
// 1. 目的地のCP番号が-1または0の場合
// 2. ロゲイニングがまだ開始されていない場合destinationController.isInRog.value == false
// 3. 最後のゴールから10時間以上経過している場合
//
if (destinationController.isInRog.value == false &&
(destinationController.distanceToStart() <= 100 || destinationController.isGpsSignalWeak() ) && //追加 Akira 2024-4-5
(destination.cp == -1 || destination.cp == 0 ) &&
@ -294,7 +299,15 @@ class BottomSheetNew extends GetView<BottomSheetController> {
//print("counted ${destinationController.rogainingCounted.value}");
// ゴールボタン:
// 表示条件:
// 1. 目的地のCP番号が0、-2、または-1の場合
// 2. ロゲイニングが開始されている場合destinationController.rogainingCounted.value == true
// 3. スタート地点から500m以内にいる場合、または GPS信号が弱い場合
// 4. ゴール準備完了フラグが立っている場合DestinationController.ready_for_goal == true
//
}else if (destinationController.rogainingCounted.value == true &&
destinationController.isInRog.value == true &&
// destinationController.distanceToStart() <= 500 && ... GPS信号が弱い時でもOKとする。
(destinationController.distanceToStart() <= 500 || destinationController.isGpsSignalWeak() ) &&
(destination.cp == 0 || destination.cp == -2 || destination.cp == -1) &&
@ -334,7 +347,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
: null,
child: Text(
"finish_rogaining".tr,
"finish_rogaining".tr, // ロゲゴール
style: const TextStyle(color: Colors.white),
));
@ -353,6 +366,9 @@ class BottomSheetNew extends GetView<BottomSheetController> {
destinationController.isCheckingIn.value = true; // ここを追加
Get.back();
Get.back();
if(destinationController.isInRog.value==false && destination.cp == -1){
destinationController.rogainingCounted.value = false;
}
await Future.delayed(const Duration(milliseconds: 500));
await destinationController.callforCheckin(destination);
destinationController.isCheckingIn.value = false;
@ -371,8 +387,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
},
child: Text(
destination.cp == -1 &&
destinationController.isInRog.value == false &&
destinationController.rogainingCounted.value == false
destinationController.isInRog.value == false //&&
//destinationController.rogainingCounted.value == false
? "ロゲ開始"
: destinationController.isInRog.value == true &&
destination.cp == -1

View File

@ -151,26 +151,23 @@ class _GameStateWidgetState extends State<GameStateWidget> {
padding: const EdgeInsets.all(4.0),
child: StreamBuilder<List<Destination>>(
stream: dbService.destinationUpdatesStream,
initialData: const [], // 初期値を設定
builder: (context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return LocationVisitedWidget(
count: 0,
minimized: !isExpanded,
);
} else if (snapshot.hasData) {
return LocationVisitedWidget(
count: snapshot.data!.length,
minimized: !isExpanded,
);
} else {
if (snapshot.hasError) {
print('Error: ${snapshot.error}');
return LocationVisitedWidget(
count: 0,
minimized: !isExpanded,
);
}
// データがある場合はそのデータを使用し、ない場合は空のリストを使用
final destinations = snapshot.data ?? [];
return LocationVisitedWidget(
count: destinations.length,
minimized: !isExpanded,
);
},
),
@ -183,12 +180,12 @@ class _GameStateWidgetState extends State<GameStateWidget> {
padding: const EdgeInsets.all(4.0),
child: Obx(() => ConnectionStatusIndicator(
connectionStatus: (indexController
.connectionStatusName.value ==
.connectionStatusName.value.toLowerCase() ==
"wifi" ||
indexController
.connectionStatusName.value ==
.connectionStatusName.value.toLowerCase() ==
"mobile")
? indexController.connectionStatusName.value ==
? indexController.connectionStatusName.value.toLowerCase() ==
"wifi"
? ConnectionStatus.wifi
: ConnectionStatus.mobile

View File

@ -26,7 +26,8 @@ class _HelperDialogState extends State<HelperDialog> {
Text('ヘルプ'),
],
),
content: Column(
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -42,11 +43,17 @@ class _HelperDialogState extends State<HelperDialog> {
});
},
),
const Text('この画面を二度と表示しない'),
const Flexible(
child: Text(
'この画面を二度と表示しない',
overflow: TextOverflow.ellipsis,
),
),
],
),
],
),
),
actions: [
TextButton(
child: const Text('OK'),
@ -68,6 +75,9 @@ Future<void> showHelperDialog(String message, String screenKey) async {
final prefs = await SharedPreferences.getInstance();
final showHelper = prefs.getBool('helper_$screenKey') ?? true;
if (showHelper) {
Get.dialog(HelperDialog(message: message, screenKey: screenKey));
Get.dialog(
HelperDialog(message: message, screenKey: screenKey),
barrierDismissible: false,
);
}
}

View File

@ -52,6 +52,12 @@ class _MapWidgetState extends State<MapWidget> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
// 追加
WidgetsBinding.instance.addPostFrameCallback((_) {
PermissionController.checkAndRequestPermissions();
});
debugPrint('MapWidget: initState called');
SettingsBinding().dependencies(); // これを追加
_startIdleTimer();
@ -84,6 +90,23 @@ class _MapWidgetState extends State<MapWidget> with WidgetsBindingObserver {
mapResetController.resetIdleTimer = _resetIdleTimer;
Get.put(mapResetController);
// Add this debug subscription
subscription = locationController.locationMarkerPositionStreamController.stream.listen(
(LocationMarkerPosition? position) {
if (position != null) {
//debugPrint('Location update received: lat=${position.latitude}, lon=${position.longitude}');
} else {
debugPrint('Received null location update');
}
},
onError: (error) {
debugPrint('Error in location stream: $error');
},
onDone: () {
debugPrint('Location stream closed');
},
);
// indexController.mapController = MapController(initCompleter: mapControllerCompleter);
}

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:gifunavi/pages/permission/permission.dart';
import 'package:get/get.dart';
class PermissionHandlerScreen extends StatefulWidget {
const PermissionHandlerScreen({super.key});
@ -24,8 +25,14 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
appBar: AppBar(
title: const Text('権限の確認'),
),
body: const Center(
child: Text('権限の確認中...'),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('権限の確認中...'),
const SizedBox(height: 20),
],
),
),
);
}