大幅変更&環境バージョンアップ
This commit is contained in:
9
lib/pages/debug/debug_binding.dart
Normal file
9
lib/pages/debug/debug_binding.dart
Normal file
@ -0,0 +1,9 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gifunavi/pages/debug/debug_controller.dart';
|
||||
|
||||
class DebugBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut<DebugController>(() => DebugController());
|
||||
}
|
||||
}
|
||||
47
lib/pages/debug/debug_controller.dart
Normal file
47
lib/pages/debug/debug_controller.dart
Normal file
@ -0,0 +1,47 @@
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gifunavi/utils/location_controller.dart';
|
||||
|
||||
class DebugController extends GetxController {
|
||||
final LocationController locationController = Get.find<LocationController>();
|
||||
final gpsSignalStrength = 'high'.obs;
|
||||
final currentPosition = Rx<Position?>(null);
|
||||
final isSimulationMode = false.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// 位置情報の更新を監視
|
||||
locationController.locationMarkerPositionStream.listen((position) {
|
||||
if (position != null) {
|
||||
currentPosition.value = Position(
|
||||
latitude: position.latitude,
|
||||
longitude: position.longitude,
|
||||
accuracy: position.accuracy,
|
||||
altitudeAccuracy: 30,
|
||||
headingAccuracy: 30,
|
||||
heading: 0,
|
||||
altitude: 0,
|
||||
speed: 0,
|
||||
speedAccuracy: 0,
|
||||
timestamp: DateTime.now(),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void setGpsSignalStrength(String value) {
|
||||
gpsSignalStrength.value = value;
|
||||
locationController.setSimulatedSignalStrength(value);
|
||||
}
|
||||
|
||||
void toggleSimulationMode() {
|
||||
isSimulationMode.value = !isSimulationMode.value;
|
||||
locationController.setSimulationMode(isSimulationMode.value);
|
||||
if (!isSimulationMode.value) {
|
||||
// 標準モードに切り替えた場合は、シミュレートされた信号強度をリセット
|
||||
locationController.setSimulatedSignalStrength('low');
|
||||
gpsSignalStrength.value = 'low';
|
||||
}
|
||||
}
|
||||
}
|
||||
65
lib/pages/debug/debug_page.dart
Normal file
65
lib/pages/debug/debug_page.dart
Normal file
@ -0,0 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gifunavi/pages/debug/debug_controller.dart';
|
||||
|
||||
class DebugPage extends GetView<DebugController> {
|
||||
const DebugPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('デバッグモード'),
|
||||
),
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('GPS信号強度'),
|
||||
const SizedBox(height: 20),
|
||||
Obx(
|
||||
() => DropdownButton<String>(
|
||||
value: controller.gpsSignalStrength.value,
|
||||
onChanged: (value) {
|
||||
controller.setGpsSignalStrength(value!);
|
||||
},
|
||||
items: ['high', 'medium', 'low']
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text('現在のGPS座標'),
|
||||
const SizedBox(height: 10),
|
||||
Obx(
|
||||
() => Text(
|
||||
'緯度: ${controller.currentPosition.value?.latitude ?? '-'}, 経度: ${controller.currentPosition.value?.longitude ?? '-'}',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const Text('現在のGPS精度'),
|
||||
const SizedBox(height: 10),
|
||||
Obx(
|
||||
() => Text(
|
||||
'精度: ${controller.currentPosition.value?.accuracy.toStringAsFixed(2) ?? '-'} m',
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Obx(
|
||||
() => ElevatedButton(
|
||||
onPressed: controller.toggleSimulationMode,
|
||||
child: Text(controller.isSimulationMode.value
|
||||
? 'シミュレーションモード'
|
||||
: '標準モード'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user