まだ#2800検証中

This commit is contained in:
2024-04-07 10:56:51 +09:00
parent cd5befddb5
commit a0c1efc522
6 changed files with 420 additions and 56 deletions

View File

@ -11,19 +11,41 @@ import 'package:rogapp/utils/database_gps.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart';
import 'package:rogapp/utils/location_controller.dart';
// index_page.dartファイルの主な内容です。
// このファイルは、アプリのメインページのUIを構築し、各機能へのナビゲーションを提供しています。
// また、IndexControllerとDestinationControllerを使用して、状態管理と各種機能の実装を行っています。
//
// MapWidgetとListWidgetは、それぞれ別のファイルで定義されているウィジェットであり、マップモードとリストモードの表示を担当しています。
//
// 全体的に、index_page.dartはアプリのメインページの構造を定義し、他のコンポーネントやページへの橋渡しを行っているファイルです。
//
// IndexPageクラスは、GetView<IndexController>を継承したStatelessWidgetです。このクラスは、アプリのメインページを表すウィジェットです。
//
class IndexPage extends GetView<IndexController> {
IndexPage({Key? key}) : super(key: key);
// IndexControllerとDestinationControllerのインスタンスを取得しています。
//
final LocationController locationController = Get.find<LocationController>();
final IndexController indexController = Get.find<IndexController>();
final DestinationController destinationController =
Get.find<DestinationController>();
// buildメソッドは、ウィジェットのUIを構築するメソッドです。
// ここでは、WillPopScopeウィジェットを使用して、端末の戻るボタンが押された際の動作を制御しています。
//
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async => false,
child: Scaffold(
//
// Scaffoldウィジェットを使用して、アプリのメインページのレイアウトを構築しています。
//
drawer: DrawerPage(),
appBar: AppBar(
title: Text("add_location".tr),
@ -35,6 +57,10 @@ class IndexPage extends GetView<IndexController> {
// },
// icon: const Icon(Icons.ten_k_sharp)),
//
// AppBarには、タイトルとアクションアイコンが含まれています。
// アクションアイコンには、GPSデータの表示、履歴の表示、マップの更新、検索などの機能が含まれています。
//
IconButton(
onPressed: () async {
// GpsDatabaseHelper db = GpsDatabaseHelper.instance;
@ -75,6 +101,28 @@ class IndexPage extends GetView<IndexController> {
),
),
//CatWidget(indexController: indexController,),
//
// デバッグ時のみリロードボタンの横にGPS信号レベルの設定ボタンを設置し、
// タップすることでGPS信号の強弱をシミュレーションできるようにする
// Akira 2024-4-5
//
Obx(
() => destinationController.isSimulationMode.value
? DropdownButton<String>(
value: locationController.getSimulatedSignalStrength(),
onChanged: (value) {
locationController.setSimulatedSignalStrength(value!);
},
items: ['high', 'medium', 'low']
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
)
: Container(),
),
],
),
// bottomNavigationBar: BottomAppBar(
@ -139,11 +187,18 @@ class IndexPage extends GetView<IndexController> {
// ],
// ),
// ),
//
// マップモードとリストモードを切り替えるためのボタンです。
//
floatingActionButton: FloatingActionButton(
onPressed: () {
indexController.toggleMode();
},
elevation: 1.0,
//
// Obxウィジェットを使用して、indexController.mode.valueの値に基づいて、MapWidgetまたはListWidgetを表示しています。
//
child: Obx(
() => indexController.mode.value == 0
? const Image(image: AssetImage('assets/images/list2.png'))
@ -151,6 +206,9 @@ class IndexPage extends GetView<IndexController> {
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
//
// bodyには、SafeAreaウィジェットを使用して、画面の安全な領域内にUIを構築しています。
//
body: SafeArea(
child: Column(
children: [