diff --git a/.metadata b/.metadata index 854b390..2429bad 100644 --- a/.metadata +++ b/.metadata @@ -1,10 +1,36 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c - channel: stable - -project_type: app +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "300451adae589accbece3490f4396f10bdf15e6e" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: android + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: ios + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + - platform: macos + create_revision: 300451adae589accbece3490f4396f10bdf15e6e + base_revision: 300451adae589accbece3490f4396f10bdf15e6e + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/android/app/src/main/kotlin/com/example/rog_app/MainActivity.kt b/android/app/src/main/kotlin/com/example/rog_app/MainActivity.kt new file mode 100644 index 0000000..1694a09 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/rog_app/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.rog_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/lib/pages/destination/destination_controller.dart b/lib/pages/destination/destination_controller.dart index 2dd5132..b146bdf 100644 --- a/lib/pages/destination/destination_controller.dart +++ b/lib/pages/destination/destination_controller.dart @@ -94,7 +94,7 @@ class DestinationController extends GetxController { bool kDebugMode = true; // シミュレーションモードのフラグ - RxBool isSimulationMode = RxBool(false); + RxBool isSimulationMode = RxBool(true); // シミュレーションモードを切り替えるための関数 void toggleSimulationMode(bool value) { @@ -106,6 +106,7 @@ class DestinationController extends GetxController { // String getGpsSignalStrength() { // デバッグモードかつシミュレーションモードの場合は、シミュレートされた信号強度を返す + print("kDebugMode : ${kDebugMode}, isSimulationMode : ${isSimulationMode.value}"); if (kDebugMode && isSimulationMode.value) { return locationController.getSimulatedSignalStrength(); } diff --git a/lib/widgets/game_state_view.dart b/lib/widgets/game_state_view.dart index d80cc82..acd7866 100644 --- a/lib/widgets/game_state_view.dart +++ b/lib/widgets/game_state_view.dart @@ -12,6 +12,8 @@ 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/game_on_off.dart'; +import 'package:rogapp/widgets/GameState/Colors.dart'; +import 'package:rogapp/widgets/gps_status.dart'; class GameStateManager { static final GameStateManager _instance = GameStateManager._internal(); @@ -190,7 +192,14 @@ class _GameStateWidgetState extends State { : ConnectionStatus.mobile : ConnectionStatus.none, minimized: !isExpanded)), - ) // Expanded view + ), // Expanded view + Padding( + padding: const EdgeInsets.all(4.0), + child:GpsSignalStrengthIndicator( + destinationController: Get.find(), + minimized: !isExpanded, // isExpanded はあなたのロジックに依存した変数), + ) + ), ], ), // child: Obx( diff --git a/lib/widgets/gps_status.dart b/lib/widgets/gps_status.dart new file mode 100644 index 0000000..68a79dc --- /dev/null +++ b/lib/widgets/gps_status.dart @@ -0,0 +1,78 @@ +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'; + +enum GPSStatus { high, middle, low } + +class GpsSignalStrengthIndicator extends StatelessWidget { + final DestinationController destinationController; // = Get.find(); + final bool minimized; + + // コンストラクタにminimizedパラメータを追加し、デフォルト値をfalseに設定 + const GpsSignalStrengthIndicator({ + Key? key, + required this.destinationController, + this.minimized = false, // ここでデフォルト値を指定 + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Obx(() { + final signalStrength = destinationController.getGpsSignalStrength(); + IconData iconData; + Color backgroundColor; + String text; + + // signalStrengthに応じて、アイコン、背景色、テキストを設定 + switch (signalStrength) { + case 'high': + backgroundColor = Colors.green; + iconData = Icons.signal_cellular_alt; + //iconData = CustomIcons.gps_signal_high_0; + text = 'GPS 強'; + break; + case 'medium': + backgroundColor = Colors.orange; + iconData = Icons.signal_cellular_alt_2_bar; + //iconData = CustomIcons.gps_signal_middle_0; + text = 'GPS 中'; + break; + default: + backgroundColor = Colors.grey; // Fallback color + iconData = Icons.signal_cellular_connected_no_internet_4_bar; + //iconData = CustomIcons.gps_signal_low_0; + text = 'GPS 弱'; + } + + // コンテナの設定をminimizedの値に応じて調整 + return Container( + height: minimized ? 40 : null, + width: minimized ? 40 : null, + padding: minimized ? null : const EdgeInsets.symmetric(vertical: 8, horizontal: 16), + decoration: BoxDecoration( + color: backgroundColor, + shape: minimized ? BoxShape.circle : BoxShape.rectangle, + borderRadius: minimized ? null : BorderRadius.circular(10), + ), + child: minimized + ? Center( + child: Icon(iconData, color: Colors.white, size: 24), + ) + : Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(iconData, color: Colors.white), + const SizedBox(width: 8), + Text( + text, + style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + ], + ), + ); + }); + } +} +