まだ#2800検証中
This commit is contained in:
@ -18,6 +18,10 @@ import 'package:rogapp/widgets/bottom_sheet_controller.dart';
|
||||
import 'package:rogapp/widgets/debug_widget.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
// BottomSheetNewは、StatelessWidgetを継承したクラスで、目的地の詳細情報を表示するボトムシートのUIを構築します。
|
||||
// コンストラクタでは、destination(目的地オブジェクト)とisAlreadyCheckedIn(すでにチェックイン済みかどうかのフラグ)を受け取ります。
|
||||
// buildメソッドでは、detailsSheetメソッドを呼び出して、目的地の詳細情報を表示します。
|
||||
//
|
||||
class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
BottomSheetNew(
|
||||
{this.isAlreadyCheckedIn = false, Key? key, required this.destination})
|
||||
@ -26,9 +30,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
final Destination destination;
|
||||
final bool isAlreadyCheckedIn;
|
||||
final Destination destination; // 目的地オブジェクト
|
||||
final bool isAlreadyCheckedIn; // すでにチェックイン済みかどうかのフラグ
|
||||
|
||||
// 目的地の画像を取得するためのメソッドです。
|
||||
// indexController.rogModeの値に基づいて、適切な画像を返します。画像が見つからない場合は、デフォルトの画像を返します。
|
||||
//
|
||||
Image getImage() {
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
|
||||
@ -95,10 +102,16 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
}
|
||||
|
||||
// URLを開くためのメソッドです。
|
||||
// url_launcherパッケージを使用して、指定されたURLを開きます。
|
||||
//
|
||||
void _launchURL(url) async {
|
||||
if (!await launchUrl(url)) throw 'Could not launch $url';
|
||||
}
|
||||
|
||||
// 指定されたlocationidが目的地リストに含まれているかどうかを確認するメソッドです。
|
||||
// destinationController.destinationsリストを走査し、locationidが一致する目的地があるかどうかを返します。
|
||||
//
|
||||
bool isInDestination(String locationid) {
|
||||
int lid = int.parse(locationid);
|
||||
if (destinationController.destinations
|
||||
@ -110,6 +123,10 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
}
|
||||
|
||||
// アクションボタン(チェックイン、ゴールなど)を表示するためのメソッドです。
|
||||
// 現在の状態に基づいて、適切なボタンを返します。
|
||||
// ボタンがタップされたときの処理も含まれています。
|
||||
//
|
||||
Widget getActionButton(BuildContext context, Destination destination) {
|
||||
assert(() {
|
||||
print("getActionButton ${destinationController.rogainingCounted.value}");
|
||||
@ -130,7 +147,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
LatLng(cdest.lat!, cdest.lon!));
|
||||
|
||||
if (destinationController.rogainingCounted.value == true &&
|
||||
destinationController.distanceToStart() <= 500 &&
|
||||
// destinationController.distanceToStart() <= 500 && ... GPS信号が弱い時でもOKとする。
|
||||
(destinationController.distanceToStart() <= 500 || destinationController.isGpsSignalWeak() ) &&
|
||||
destination.cp == -1 &&
|
||||
DestinationController.ready_for_goal == true) {
|
||||
//goal
|
||||
@ -171,6 +189,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
onPressed: () async {
|
||||
// Check conditions to show confirmation dialog
|
||||
if (destinationController.isInRog.value == false &&
|
||||
(destinationController.distanceToStart() <= 500 || destinationController.isGpsSignalWeak() ) && //追加 Akira 2024-4-5
|
||||
destination.cp == -1 &&
|
||||
destinationController.rogainingCounted.value == false) {
|
||||
print("counted ${destinationController.rogainingCounted.value}");
|
||||
@ -240,6 +259,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
return Container();
|
||||
}
|
||||
|
||||
// 継承元のbuild をオーバーライドし、detailsSheetメソッドを呼び出して、目的地の詳細情報を表示します。
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
//print("to start ${destinationController.distanceToStart()}");
|
||||
@ -253,6 +273,9 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
return detailsSheet(context);
|
||||
}
|
||||
|
||||
// 指定された目的地がすでにチェックイン済みかどうかを確認するメソッドです。
|
||||
// DatabaseHelperを使用して、目的地の位置情報に基づいてデータベースを検索し、結果を返します。
|
||||
//
|
||||
Future<bool> isDestinationCheckedIn(Destination d) async {
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
List<Destination> ds = await db.getDestinationByLatLon(d.lat!, d.lon!);
|
||||
@ -261,6 +284,10 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
|
||||
// show add location details
|
||||
// 目的地の詳細情報を表示するためのUIを構築するメソッドです。
|
||||
// 目的地の画像、名前、住所、電話番号、Webサイト、備考などの情報を表示します。
|
||||
// また、アクションボタンや「ここへ行く」ボタンも表示されます。
|
||||
//
|
||||
SingleChildScrollView detailsSheet(BuildContext context) {
|
||||
Destination cdest = destinationController
|
||||
.festuretoDestination(indexController.currentFeature[0]);
|
||||
@ -592,6 +619,10 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
);
|
||||
}
|
||||
|
||||
// 「行きたい」ボタンを表示するためのUIを構築するメソッドです。
|
||||
// 目的地が選択されているかどうかに基づいて、適切なアイコンとテキストを表示します。
|
||||
// ボタンがタップされたときの処理も含まれています。
|
||||
//
|
||||
Future<Widget> wantToGo(BuildContext context) async {
|
||||
bool selected = false;
|
||||
// print(
|
||||
@ -798,6 +829,9 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
);
|
||||
}
|
||||
|
||||
// 目的地の詳細情報(住所、電話番号、Webサイトなど)を表示するためのUIを構築するメソッドです。
|
||||
// ラベルとテキストを受け取り、適切なアイコンとともに表示します。
|
||||
//
|
||||
Widget getDetails(BuildContext context, String label, String text,
|
||||
{bool isurl = false}) {
|
||||
return Row(
|
||||
|
||||
Reference in New Issue
Block a user