タイマーを設定で変更できるようにした。現在地ボタンの長押しおよびドロワーへの設定ボタンの追加

This commit is contained in:
2024-04-26 18:44:22 +09:00
parent b9c641954d
commit 72267f29bb
9 changed files with 191 additions and 38 deletions

View File

@ -0,0 +1,63 @@
// lib/pages/settings/settings_page.dart
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/settings/settings_controller.dart';
class SettingsPage extends GetView<SettingsController> {
const SettingsPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('設定'),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'タイマーの長さ',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Obx(
() => controller.autoReturnDisabled.value
? Container()
: Slider(
value: controller.timerDuration.value.inSeconds.toDouble(),
min: 5,
max: 30,
divisions: 5,
label: '${controller.timerDuration.value.inSeconds}',
onChanged: (value) {
controller.updateTimerDuration(value.toInt());
},
),
),
const SizedBox(height: 8),
const Text(
'マップ操作がなければ自動的に現在地に復帰します。そのタイマー秒数を入れて下さい。チェックボックスをチェックすると、自動復帰は行われなくなります。',
style: TextStyle(fontSize: 14),
),
const SizedBox(height: 16),
Obx(
() => CheckboxListTile(
title: const Text('自動復帰なし'),
value: controller.autoReturnDisabled.value,
onChanged: (value) {
controller.setAutoReturnDisabled(value!);
},
),
),
],
),
),
);
}
}