2024-04-20 14:32:01 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-04-21 00:22:53 +00:00
|
|
|
import 'package:get/get.dart';
|
2024-04-20 14:32:01 +00:00
|
|
|
import 'package:uninav/components/drawer.dart';
|
|
|
|
import 'package:uninav/components/hamburger_menu.dart';
|
2024-04-21 12:21:31 +00:00
|
|
|
import 'package:uninav/controllers/shared_prefs_controller.dart';
|
2024-04-20 14:32:01 +00:00
|
|
|
|
|
|
|
class SettingsPage extends StatelessWidget {
|
|
|
|
const SettingsPage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-04-21 12:21:31 +00:00
|
|
|
final persistenceController = Get.find<SharedPrefsController>();
|
|
|
|
final settings = persistenceController.settings;
|
2024-04-21 00:22:53 +00:00
|
|
|
|
2024-04-20 14:32:01 +00:00
|
|
|
return Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: const Text('Settings'),
|
|
|
|
leading: HamburgerMenu(),
|
|
|
|
),
|
|
|
|
drawer: MyDrawer(),
|
2024-04-21 00:22:53 +00:00
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Obx(
|
|
|
|
() => Column(
|
|
|
|
children: [
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Icons'),
|
|
|
|
subtitle: const Text(
|
|
|
|
'Warning: disables ALL icons',
|
|
|
|
style: TextStyle(color: Colors.red, fontSize: 12),
|
|
|
|
),
|
|
|
|
value: settings.value.showIcons,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showIcons: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Elevators'),
|
|
|
|
value: settings.value.showElevators,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showElevators: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Food and Drink'),
|
|
|
|
value: settings.value.showFoodAndDrink,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showFoodAndDrink: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Lecture Halls'),
|
|
|
|
value: settings.value.showLectureHalls,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showLectureHalls: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Computer Pools'),
|
|
|
|
value: settings.value.showComputerPools,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showComputerPools: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Seminar Rooms'),
|
|
|
|
value: settings.value.showSeminarRooms,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showSeminarRooms: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Toilets'),
|
|
|
|
value: settings.value.showToilets,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showToilets: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Stairs'),
|
|
|
|
value: settings.value.showStairs,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showStairs: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
SwitchListTile(
|
|
|
|
title: const Text('Show Doors'),
|
|
|
|
value: settings.value.showDoors,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
showDoors: value,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
const Padding(
|
|
|
|
padding: EdgeInsets.only(left: 8.0),
|
|
|
|
child: Text('Toilet Preference'),
|
|
|
|
),
|
|
|
|
CheckboxListTile(
|
|
|
|
title: const Text('Male Toilets'),
|
|
|
|
value: settings.value.maleToilets,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
maleToilets: value ?? false,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
CheckboxListTile(
|
|
|
|
title: const Text('Female Toilets'),
|
|
|
|
value: settings.value.femaleToilets,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
femaleToilets: value ?? false,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
CheckboxListTile(
|
|
|
|
title: const Text('Handicap Toilets'),
|
|
|
|
value: settings.value.handicapToilets,
|
|
|
|
onChanged: (value) {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = settings.value.copyWith(
|
|
|
|
handicapToilets: value ?? false,
|
|
|
|
);
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
ElevatedButton(
|
|
|
|
onPressed: () {
|
2024-04-21 12:21:31 +00:00
|
|
|
settings.value = const Settings();
|
|
|
|
persistenceController.persistSettings();
|
2024-04-21 00:22:53 +00:00
|
|
|
},
|
|
|
|
child: const Text("Reset Settings"),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-04-20 14:32:01 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|