Destination controller から Location controller へGPS信号シミュレーションを変更

This commit is contained in:
2024-04-09 15:06:41 +09:00
parent 8ad2e5988d
commit f6b2a6c7d4
9 changed files with 184 additions and 63 deletions

View File

@ -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(