#2832 まで解決
This commit is contained in:
@ -128,14 +128,13 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
// ボタンがタップされたときの処理も含まれています。
|
||||
//
|
||||
Widget getActionButton(BuildContext context, Destination destination) {
|
||||
assert(() {
|
||||
print("getActionButton ${destinationController.rogainingCounted.value}");
|
||||
print("getActionButton ${destinationController.distanceToStart()}");
|
||||
print("getActionButton ${destination.cp}");
|
||||
print("getActionButton ${DestinationController.ready_for_goal}");
|
||||
return true;
|
||||
}());
|
||||
/*
|
||||
debugPrint("getActionButton ${destinationController.rogainingCounted.value}");
|
||||
debugPrint("getActionButton ${destinationController.distanceToStart()}");
|
||||
debugPrint("getActionButton ${destination.cp}");
|
||||
debugPrint("getActionButton ${DestinationController.ready_for_goal}");
|
||||
// ...2024-04-03 Akira デバッグモードのみ出力するようにした。
|
||||
*/
|
||||
|
||||
Destination cdest = destinationController
|
||||
.festuretoDestination(indexController.currentFeature[0]);
|
||||
@ -176,7 +175,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
: null,
|
||||
child: const Text(
|
||||
"ロゲイニングを終える",
|
||||
"ロゲゴール",
|
||||
style: TextStyle(color: Colors.white),
|
||||
));
|
||||
} else if (distanceToDest <=
|
||||
@ -186,7 +185,26 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
onPressed: () async {
|
||||
onPressed: isAlreadyCheckedIn == true
|
||||
? null
|
||||
: () async {
|
||||
try{
|
||||
Get.back();
|
||||
await destinationController.callforCheckin(destination);
|
||||
} catch (e) {
|
||||
// エラーハンドリング
|
||||
Get.snackbar(
|
||||
'Error',
|
||||
'An error occurred while processing check-in.',
|
||||
backgroundColor: Colors.red,
|
||||
colorText: Colors.white,
|
||||
duration: Duration(seconds: 3),
|
||||
);
|
||||
// 必要に応じてエラーログを記録
|
||||
print('Error processing check-in: $e');
|
||||
}
|
||||
},
|
||||
/*
|
||||
// Check conditions to show confirmation dialog
|
||||
if (destinationController.isInRog.value == false &&
|
||||
(destinationController.distanceToStart() <= 500 || destinationController.isGpsSignalWeak() ) && //追加 Akira 2024-4-5
|
||||
@ -239,6 +257,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
return;
|
||||
}
|
||||
},
|
||||
*/
|
||||
child: Text(
|
||||
destination.cp == -1 &&
|
||||
destinationController.isInRog.value == false &&
|
||||
@ -251,7 +270,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
? "ゲーム中"
|
||||
: destinationController.isInRog.value == true
|
||||
? "チェックイン"
|
||||
: "始まっていない",
|
||||
: "ロゲは始まっていません",
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSecondary),
|
||||
),
|
||||
);
|
||||
|
||||
@ -5,9 +5,10 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_start.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_goal.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_normal_point.dart';
|
||||
//import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_start.dart';
|
||||
//import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_goal.dart';
|
||||
//import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_normal_point.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
class DestinationWidget extends StatelessWidget {
|
||||
@ -147,8 +148,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//print(
|
||||
// "------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
print(
|
||||
"------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
|
||||
return Obx(() => Stack(
|
||||
children: [
|
||||
@ -194,7 +195,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
// "--- ndexController.currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} ----");
|
||||
//indexController.getAction();
|
||||
|
||||
Widget bottomSheet;
|
||||
Widget bottomSheet = BottomSheetNew(destination: fs);
|
||||
/*
|
||||
if (fs.cp == -1 || fs.cp == 0) {
|
||||
bottomSheet = BottomSheetStart(destination: fs);
|
||||
} else if (fs.cp == -2 || fs.cp == 0) {
|
||||
@ -202,6 +204,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
} else {
|
||||
bottomSheet = BottomSheetNormalPoint(destination: fs);
|
||||
}
|
||||
*/
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
|
||||
@ -20,7 +20,7 @@ class GpsSignalStrengthIndicator extends StatelessWidget {
|
||||
// final LocationController locationController = Get.find<LocationController>();
|
||||
return Obx(() {
|
||||
String signalStrength = locationController.latestSignalStrength.value;
|
||||
debugPrint("GpsSignalStrengthIndicator : signalStrength=${signalStrength}");
|
||||
//debugPrint("GpsSignalStrengthIndicator : signalStrength=${signalStrength}");
|
||||
IconData iconData;
|
||||
Color backgroundColor;
|
||||
String text;
|
||||
|
||||
@ -6,9 +6,10 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_start.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_goal.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_normal_point.dart';
|
||||
//import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_start.dart';
|
||||
//import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_goal.dart';
|
||||
//import 'package:rogapp/widgets/bottom_sheets/bottom_sheet_normal_point.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
|
||||
class ListWidget extends StatefulWidget {
|
||||
const ListWidget({Key? key}) : super(key: key);
|
||||
@ -102,6 +103,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("_ListWidgetState");
|
||||
return Obx(
|
||||
() => indexController.locations.isNotEmpty
|
||||
? RefreshIndicator(
|
||||
@ -130,7 +132,8 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
destinationController.festuretoDestination(gf);
|
||||
changeCurrentFeature(gf);
|
||||
|
||||
Widget bottomSheet;
|
||||
Widget bottomSheet = BottomSheetNew(destination: des);
|
||||
/*
|
||||
if (des.cp == -1 || des.cp == 0) {
|
||||
bottomSheet = BottomSheetStart(destination: des);
|
||||
} else if (des.cp == -2 || des.cp == 0) {
|
||||
@ -138,6 +141,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
} else {
|
||||
bottomSheet = BottomSheetNormalPoint(destination: des);
|
||||
}
|
||||
*/
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
|
||||
@ -25,7 +25,8 @@ class MapWidget extends StatefulWidget {
|
||||
State<MapWidget> createState() => _MapWidgetState();
|
||||
}
|
||||
|
||||
class _MapWidgetState extends State<MapWidget> {
|
||||
class _MapWidgetState extends State<MapWidget> with WidgetsBindingObserver {
|
||||
//class _MapWidgetState extends State<MapWidget> {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
@ -46,6 +47,11 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
_startIdleTimer();
|
||||
mapController = MapController();
|
||||
indexController.mapController = mapController;
|
||||
|
||||
// added by Akira
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_startIdleTimer();
|
||||
|
||||
//_initMarkers();
|
||||
|
||||
// indexController.mapController = MapController(initCompleter: mapControllerCompleter);
|
||||
@ -54,22 +60,37 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this); // added
|
||||
|
||||
mapController?.dispose();
|
||||
_timer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
// added by Akira
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
_resetTimer();
|
||||
}
|
||||
}
|
||||
|
||||
// _centerMapOnUser を10秒間でコール
|
||||
void _startIdleTimer() {
|
||||
_timer = Timer(const Duration(milliseconds: (1000 * 10)), _centerMapOnUser);
|
||||
}
|
||||
|
||||
// タイマーをリセットして_startIdleTimer をコール
|
||||
void _resetTimer() {
|
||||
_timer?.cancel();
|
||||
_startIdleTimer();
|
||||
}
|
||||
|
||||
// マッぷを現在位置を中心にする。
|
||||
void _centerMapOnUser() {
|
||||
destinationController.centerMapToCurrentLocation();
|
||||
if (mounted) {
|
||||
destinationController.centerMapToCurrentLocation();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _initMarkers() async {
|
||||
@ -172,8 +193,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: des, isAlreadyCheckedIn: value.isNotEmpty)),
|
||||
builder: ((context) => BottomSheetNew(destination: des, isAlreadyCheckedIn: value.isNotEmpty)),
|
||||
).whenComplete(() {
|
||||
destinationController.shouldShowBottomSheet = true;
|
||||
destinationController.skipGps = false;
|
||||
@ -378,7 +398,7 @@ class _MapWidgetState extends State<MapWidget> {
|
||||
stream: locationController.locationMarkerPositionStream,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData) {
|
||||
print("====== Not display current marker");
|
||||
debugPrint("====== Not display current marker");
|
||||
}
|
||||
return Container();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user