Destination controller から Location controller へGPS信号シミュレーションを変更
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import 'dart:ffi';
|
||||
import 'dart:math';
|
||||
//import 'dart:ffi';
|
||||
//import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -7,13 +7,14 @@ import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/DatabaseService.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
//import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/GameState/CheckinState.dart';
|
||||
import 'package:rogapp/widgets/GameState/ConnectionStatus.dart';
|
||||
import 'package:rogapp/widgets/GameState/DashboardWidget.dart';
|
||||
//import 'package:rogapp/widgets/GameState/DashboardWidget.dart';
|
||||
import 'package:rogapp/widgets/GameState/game_on_off.dart';
|
||||
import 'package:rogapp/widgets/GameState/Colors.dart';
|
||||
//import 'package:rogapp/widgets/GameState/Colors.dart';
|
||||
import 'package:rogapp/widgets/gps_status.dart';
|
||||
import 'package:rogapp/utils/location_controller.dart';
|
||||
|
||||
class GameStateManager {
|
||||
static final GameStateManager _instance = GameStateManager._internal();
|
||||
@ -24,8 +25,8 @@ class GameStateManager {
|
||||
|
||||
GameStateManager._internal();
|
||||
|
||||
List<String> _logs = [];
|
||||
List<VoidCallback> _listeners = [];
|
||||
final List<String> _logs = [];
|
||||
final List<VoidCallback> _listeners = [];
|
||||
|
||||
List<String> get logs => _logs;
|
||||
|
||||
@ -103,9 +104,10 @@ class _GameStateWidgetState extends State<GameStateWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final DatabaseService dbService = DatabaseService();
|
||||
//final LocationController locationController = Get.find<LocationController>();
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
decoration: BoxDecoration(color: Colors.black12),
|
||||
decoration: const BoxDecoration(color: Colors.black12),
|
||||
child: GestureDetector(
|
||||
onTap: toggleExpanded,
|
||||
child: AnimatedContainer(
|
||||
@ -117,15 +119,15 @@ class _GameStateWidgetState extends State<GameStateWidget> {
|
||||
// Top bar with clear button
|
||||
if (isExpanded)
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
color: Colors.blueGrey, // Adjust color as needed
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text('ゲームステータス', style: TextStyle(color: Colors.white)),
|
||||
const Text('ゲームステータス', style: TextStyle(color: Colors.white)),
|
||||
IconButton(
|
||||
icon: Icon(Icons.clear, color: Colors.white),
|
||||
icon: const Icon(Icons.clear, color: Colors.white),
|
||||
onPressed: toggleExpanded,
|
||||
),
|
||||
],
|
||||
@ -196,7 +198,7 @@ class _GameStateWidgetState extends State<GameStateWidget> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child:GpsSignalStrengthIndicator(
|
||||
destinationController: Get.find<DestinationController>(),
|
||||
locationController: Get.find<LocationController>(),
|
||||
minimized: !isExpanded, // isExpanded はあなたのロジックに依存した変数),
|
||||
)
|
||||
),
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/widgets/GameState/Colors.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/widgets/custom_icons.dart';
|
||||
import 'package:rogapp/utils/location_controller.dart';
|
||||
|
||||
enum GPSStatus { high, middle, low }
|
||||
|
||||
class GpsSignalStrengthIndicator extends StatelessWidget {
|
||||
final DestinationController destinationController; // = Get.find<DestinationController>();
|
||||
LocationController locationController;
|
||||
final bool minimized;
|
||||
|
||||
// コンストラクタにminimizedパラメータを追加し、デフォルト値をfalseに設定
|
||||
const GpsSignalStrengthIndicator({
|
||||
GpsSignalStrengthIndicator({
|
||||
Key? key,
|
||||
required this.destinationController,
|
||||
required this.locationController,
|
||||
this.minimized = false, // ここでデフォルト値を指定
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final LocationController locationController = Get.find<LocationController>();
|
||||
return Obx(() {
|
||||
final signalStrength = destinationController.getGpsSignalStrength();
|
||||
String signalStrength = locationController.latestSignalStrength;
|
||||
print("signalStrength=${signalStrength}");
|
||||
IconData iconData;
|
||||
Color backgroundColor;
|
||||
String text;
|
||||
|
||||
@ -34,7 +34,7 @@ import 'package:rogapp/widgets/game_state_view.dart';
|
||||
// StatefulWidgetを継承したクラスで、地図表示のメインウィジェットです。
|
||||
//
|
||||
class MapWidget extends StatefulWidget {
|
||||
MapWidget({Key? key}) : super(key: key);
|
||||
const MapWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MapWidget> createState() => _MapWidgetState();
|
||||
@ -117,7 +117,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
),
|
||||
i.properties!['cp'] == -1
|
||||
? Transform.translate(
|
||||
offset: Offset(18, 0),
|
||||
offset: const Offset(18, 0),
|
||||
child: Transform.rotate(
|
||||
alignment: Alignment.centerLeft,
|
||||
origin: Offset.fromDirection(1, 26),
|
||||
@ -134,7 +134,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
],
|
||||
)),
|
||||
Transform.translate(
|
||||
offset: Offset(45, 0),
|
||||
offset: const Offset(45, 0),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
@ -162,7 +162,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
// Text with black fill
|
||||
Text(
|
||||
TextUtils.getDisplayTextFeture(i),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
@ -217,7 +217,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
//
|
||||
void _centerMapOnUser() {
|
||||
assert(() {
|
||||
print("showBottomSheet ${destinationController.shouldShowBottomSheet}");
|
||||
print("showBottomSheet ${destinationController.shouldShowBottomSheet}");
|
||||
return true;
|
||||
}());
|
||||
// 2024-04-03 Akira Log enabled only debug mode..
|
||||
@ -269,14 +269,15 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
if (mapEvent is MapEventMoveEnd) {}
|
||||
});
|
||||
},
|
||||
//center: LatLng(37.15319600454702, 139.58765950528198),
|
||||
|
||||
initialCenter: const LatLng(37.15319600454702, 139.58765950528198),
|
||||
bounds: indexController.currentBound.isNotEmpty
|
||||
? indexController.currentBound[0]
|
||||
: LatLngBounds.fromPoints([
|
||||
LatLng(35.03999881162295, 136.40587119778962),
|
||||
LatLng(36.642756778706904, 137.95226720406063)
|
||||
const LatLng(35.03999881162295, 136.40587119778962),
|
||||
const LatLng(36.642756778706904, 137.95226720406063)
|
||||
]),
|
||||
zoom: 1,
|
||||
initialZoom: 1,
|
||||
interactiveFlags:
|
||||
InteractiveFlag.pinchZoom | InteractiveFlag.drag,
|
||||
|
||||
@ -312,15 +313,28 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
.locationMarkerPositionStreamController.stream,
|
||||
// locationMarkerPositionStreamController.streamを設定して、現在位置の更新を監視しています。
|
||||
alignDirectionOnUpdate: AlignOnUpdate.never,
|
||||
turnOnHeadingUpdate: TurnOnHeadingUpdate.never,
|
||||
//turnOnHeadingUpdate: TurnOnHeadingUpdate.never,
|
||||
style: const LocationMarkerStyle(
|
||||
// styleプロパティで、現在位置のマーカーのスタイルを設定しています。
|
||||
marker: Stack(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 13.5,
|
||||
backgroundColor: Colors.blue,
|
||||
child: Icon(Icons.navigation, color: Colors.white),
|
||||
),
|
||||
//if (locationController.getGpsSignalStrength() == 'low')
|
||||
// child: Icon(Icons.warning, color: Colors.red),
|
||||
],
|
||||
),
|
||||
/*
|
||||
marker: DefaultLocationMarker(
|
||||
child: Icon(
|
||||
Icons.navigation,
|
||||
color: Colors.yellowAccent,
|
||||
),
|
||||
),
|
||||
*/
|
||||
markerSize: Size(27, 27),
|
||||
markerDirection: MarkerDirection.heading,
|
||||
),
|
||||
@ -333,7 +347,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
indexController.locations[0].features.map((i) {
|
||||
//print("i si ${i.properties!['location_id']}");
|
||||
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
//RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
GeoJSONMultiPoint p =
|
||||
i!.geometry as GeoJSONMultiPoint;
|
||||
//print(
|
||||
|
||||
Reference in New Issue
Block a user