| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import 'dart:ffi';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:trackoffical_app/service/app.dart';
- import 'package:trackoffical_app/service/sport_wear.dart';
- import 'package:trackoffical_app/service/user_profile.dart';
- import 'package:trackoffical_app/widget/app_top_bar.dart';
- import '../sport_wear_select_view.dart';
- import 'in_game_controller.dart';
- class SettingsView extends GetView<InGameController> {
- SettingsView({super.key});
- final SportWearService _sp = Get.find();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar:
- AppTopBar(title: const Text('设置'), automaticallyImplyLeading: true),
- body: ListView(
- children: [
- // ListTile(
- // title: const Text('无图模式'),
- // trailing: Obx(() => Switch(
- // value: controller.isNoMapMode.value,
- // onChanged: (v) {
- // controller.isNoMapMode.value = v;
- // }))),
- ListTile(
- title: const Text('心率带'),
- trailing: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Obx(() {
- final wear = _sp.connectedSportWear.value;
- return wear != null ? Text(wear.name) : const Text('未连接');
- }),
- const Icon(Icons.keyboard_arrow_right)
- ],
- ),
- onTap: showSportWearSelectDialog,
- ),
- ListTile(
- title: const Text('精简模式'),
- trailing: Obx(() => Switch(
- value: controller.isInGameUISimplifyMode,
- onChanged: (v) {
- controller.isInGameUISimplifyMode = v;
- }))),
- ListTile(
- title: const Text('边界报警'),
- trailing: Obx(() => Switch(
- value: controller.isEnableOutBoundaryWarn,
- onChanged: (v) {
- controller.isEnableOutBoundaryWarn = v;
- }))),
- const ListTile(
- title: Text('轨迹长度(秒)'), trailing: DropdownMenuTrajectory()),
- ListTile(
- title: const Text('定位'), trailing: Obx(() => Switch(
- value: controller.isEnableUserLocation,
- onChanged: (v) {
- controller.isEnableUserLocation = v;
- }))),
- ListTile(
- title: const Text('开始提示'), trailing: Obx(() => Switch(
- value: controller.isStartShowWarn.value,
- onChanged: (v) {
- controller.isStartShowWarn.value = v;
- }))),
- ListTile(
- title: const Text('声音提示'), trailing: Obx(() => Switch(
- value: controller.isEnableGameSound.value,
- onChanged: (v) {
- controller.isEnableGameSound.value = v;
- }))),
- ListTile(
- title: const Text('震动提示'), trailing: Obx(() => Switch(
- value: controller.isEnableGameVibrate.value,
- onChanged: (v) {
- controller.isEnableGameVibrate.value = v;
- }))),
- ListTile(
- title: const Text('打点文创'), trailing: Obx(() => Switch(
- value: controller.isEnableGameCulture.value,
- onChanged: (v) {
- controller.isEnableGameCulture.value = v;
- }))),
- ListTile(
- title: const Text('指北针真北'),
- trailing: Obx(() => Switch(
- value: controller.isUseRealNorth,
- onChanged: (v) {
- controller.isUseRealNorth = v;
- }))),
- ],
- ),
- );
- }
- }
- class DropdownMenuTrajectory extends StatefulWidget {
- const DropdownMenuTrajectory({super.key});
- @override
- State<DropdownMenuTrajectory> createState() => _DropdownMenuTrajectoryState();
- }
- class _DropdownMenuTrajectoryState extends State<DropdownMenuTrajectory> {
- var selectedValue = App.to.userProfile.inGameTrajectorySeconds.val;
- @override
- Widget build(BuildContext context) {
- const l = UserProfile.inGameTrajectorySecondsList;
- final menus = l.map((e) => MenuItemButton(
- onPressed: ()=>setState(() {
- App.to.userProfile.inGameTrajectorySeconds.val=e;
- selectedValue=e;
- }),
- child: MenuAcceleratorLabel(e.toString()),
- )).toList();
-
- return SizedBox(
- height: 46, width: 80,
- child:
- SubmenuButton(menuChildren: menus,
- trailingIcon: const Icon(Icons.arrow_drop_down, size: 20,),
- child:
- Text('$selectedValue'),
- ),
- ) ;
- }
- }
|