> allOffsets,
-) {
- final object = Settings();
- object.femaleToilets = reader.readBool(offsets[0]);
- object.handicapToilets = reader.readBool(offsets[1]);
- object.id = id;
- object.maleToilets = reader.readBool(offsets[2]);
- object.showComputerPools = reader.readBool(offsets[3]);
- object.showDoors = reader.readBool(offsets[4]);
- object.showElevators = reader.readBool(offsets[5]);
- object.showFoodAndDrink = reader.readBool(offsets[6]);
- object.showIcons = reader.readBool(offsets[7]);
- object.showLectureHalls = reader.readBool(offsets[8]);
- object.showSeminarRooms = reader.readBool(offsets[9]);
- object.showStairs = reader.readBool(offsets[10]);
- object.showToilets = reader.readBool(offsets[11]);
- return object;
-}
-
-P _settingsDeserializeProp(
- IsarReader reader,
- int propertyId,
- int offset,
- Map> allOffsets,
-) {
- switch (propertyId) {
- case 0:
- return (reader.readBool(offset)) as P;
- case 1:
- return (reader.readBool(offset)) as P;
- case 2:
- return (reader.readBool(offset)) as P;
- case 3:
- return (reader.readBool(offset)) as P;
- case 4:
- return (reader.readBool(offset)) as P;
- case 5:
- return (reader.readBool(offset)) as P;
- case 6:
- return (reader.readBool(offset)) as P;
- case 7:
- return (reader.readBool(offset)) as P;
- case 8:
- return (reader.readBool(offset)) as P;
- case 9:
- return (reader.readBool(offset)) as P;
- case 10:
- return (reader.readBool(offset)) as P;
- case 11:
- return (reader.readBool(offset)) as P;
- default:
- throw IsarError('Unknown property with id $propertyId');
- }
-}
-
-Id _settingsGetId(Settings object) {
- return object.id;
-}
-
-List> _settingsGetLinks(Settings object) {
- return [];
-}
-
-void _settingsAttach(IsarCollection col, Id id, Settings object) {
- object.id = id;
-}
-
-extension SettingsQueryWhereSort on QueryBuilder {
- QueryBuilder anyId() {
- return QueryBuilder.apply(this, (query) {
- return query.addWhereClause(const IdWhereClause.any());
- });
- }
-}
-
-extension SettingsQueryWhere on QueryBuilder {
- QueryBuilder idEqualTo(Id id) {
- return QueryBuilder.apply(this, (query) {
- return query.addWhereClause(IdWhereClause.between(
- lower: id,
- upper: id,
- ));
- });
- }
-
- QueryBuilder idNotEqualTo(Id id) {
- return QueryBuilder.apply(this, (query) {
- if (query.whereSort == Sort.asc) {
- return query
- .addWhereClause(
- IdWhereClause.lessThan(upper: id, includeUpper: false),
- )
- .addWhereClause(
- IdWhereClause.greaterThan(lower: id, includeLower: false),
- );
- } else {
- return query
- .addWhereClause(
- IdWhereClause.greaterThan(lower: id, includeLower: false),
- )
- .addWhereClause(
- IdWhereClause.lessThan(upper: id, includeUpper: false),
- );
- }
- });
- }
-
- QueryBuilder idGreaterThan(Id id,
- {bool include = false}) {
- return QueryBuilder.apply(this, (query) {
- return query.addWhereClause(
- IdWhereClause.greaterThan(lower: id, includeLower: include),
- );
- });
- }
-
- QueryBuilder idLessThan(Id id,
- {bool include = false}) {
- return QueryBuilder.apply(this, (query) {
- return query.addWhereClause(
- IdWhereClause.lessThan(upper: id, includeUpper: include),
- );
- });
- }
-
- QueryBuilder idBetween(
- Id lowerId,
- Id upperId, {
- bool includeLower = true,
- bool includeUpper = true,
- }) {
- return QueryBuilder.apply(this, (query) {
- return query.addWhereClause(IdWhereClause.between(
- lower: lowerId,
- includeLower: includeLower,
- upper: upperId,
- includeUpper: includeUpper,
- ));
- });
- }
-}
-
-extension SettingsQueryFilter
- on QueryBuilder {
- QueryBuilder femaleToiletsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'femaleToilets',
- value: value,
- ));
- });
- }
-
- QueryBuilder
- handicapToiletsEqualTo(bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'handicapToilets',
- value: value,
- ));
- });
- }
-
- QueryBuilder idEqualTo(Id value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'id',
- value: value,
- ));
- });
- }
-
- QueryBuilder idGreaterThan(
- Id value, {
- bool include = false,
- }) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.greaterThan(
- include: include,
- property: r'id',
- value: value,
- ));
- });
- }
-
- QueryBuilder idLessThan(
- Id value, {
- bool include = false,
- }) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.lessThan(
- include: include,
- property: r'id',
- value: value,
- ));
- });
- }
-
- QueryBuilder idBetween(
- Id lower,
- Id upper, {
- bool includeLower = true,
- bool includeUpper = true,
- }) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.between(
- property: r'id',
- lower: lower,
- includeLower: includeLower,
- upper: upper,
- includeUpper: includeUpper,
- ));
- });
- }
-
- QueryBuilder maleToiletsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'maleToilets',
- value: value,
- ));
- });
- }
-
- QueryBuilder
- showComputerPoolsEqualTo(bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showComputerPools',
- value: value,
- ));
- });
- }
-
- QueryBuilder showDoorsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showDoors',
- value: value,
- ));
- });
- }
-
- QueryBuilder showElevatorsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showElevators',
- value: value,
- ));
- });
- }
-
- QueryBuilder
- showFoodAndDrinkEqualTo(bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showFoodAndDrink',
- value: value,
- ));
- });
- }
-
- QueryBuilder showIconsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showIcons',
- value: value,
- ));
- });
- }
-
- QueryBuilder
- showLectureHallsEqualTo(bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showLectureHalls',
- value: value,
- ));
- });
- }
-
- QueryBuilder
- showSeminarRoomsEqualTo(bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showSeminarRooms',
- value: value,
- ));
- });
- }
-
- QueryBuilder showStairsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showStairs',
- value: value,
- ));
- });
- }
-
- QueryBuilder showToiletsEqualTo(
- bool value) {
- return QueryBuilder.apply(this, (query) {
- return query.addFilterCondition(FilterCondition.equalTo(
- property: r'showToilets',
- value: value,
- ));
- });
- }
-}
-
-extension SettingsQueryObject
- on QueryBuilder {}
-
-extension SettingsQueryLinks
- on QueryBuilder {}
-
-extension SettingsQuerySortBy on QueryBuilder {
- QueryBuilder sortByFemaleToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'femaleToilets', Sort.asc);
- });
- }
-
- QueryBuilder sortByFemaleToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'femaleToilets', Sort.desc);
- });
- }
-
- QueryBuilder sortByHandicapToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'handicapToilets', Sort.asc);
- });
- }
-
- QueryBuilder sortByHandicapToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'handicapToilets', Sort.desc);
- });
- }
-
- QueryBuilder sortByMaleToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'maleToilets', Sort.asc);
- });
- }
-
- QueryBuilder sortByMaleToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'maleToilets', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowComputerPools() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showComputerPools', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowComputerPoolsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showComputerPools', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowDoors() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showDoors', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowDoorsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showDoors', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowElevators() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showElevators', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowElevatorsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showElevators', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowFoodAndDrink() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showFoodAndDrink', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowFoodAndDrinkDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showFoodAndDrink', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowIcons() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showIcons', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowIconsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showIcons', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowLectureHalls() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showLectureHalls', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowLectureHallsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showLectureHalls', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowSeminarRooms() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showSeminarRooms', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowSeminarRoomsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showSeminarRooms', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowStairs() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showStairs', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowStairsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showStairs', Sort.desc);
- });
- }
-
- QueryBuilder sortByShowToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showToilets', Sort.asc);
- });
- }
-
- QueryBuilder sortByShowToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showToilets', Sort.desc);
- });
- }
-}
-
-extension SettingsQuerySortThenBy
- on QueryBuilder {
- QueryBuilder thenByFemaleToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'femaleToilets', Sort.asc);
- });
- }
-
- QueryBuilder thenByFemaleToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'femaleToilets', Sort.desc);
- });
- }
-
- QueryBuilder thenByHandicapToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'handicapToilets', Sort.asc);
- });
- }
-
- QueryBuilder thenByHandicapToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'handicapToilets', Sort.desc);
- });
- }
-
- QueryBuilder thenById() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'id', Sort.asc);
- });
- }
-
- QueryBuilder thenByIdDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'id', Sort.desc);
- });
- }
-
- QueryBuilder thenByMaleToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'maleToilets', Sort.asc);
- });
- }
-
- QueryBuilder thenByMaleToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'maleToilets', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowComputerPools() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showComputerPools', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowComputerPoolsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showComputerPools', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowDoors() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showDoors', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowDoorsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showDoors', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowElevators() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showElevators', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowElevatorsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showElevators', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowFoodAndDrink() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showFoodAndDrink', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowFoodAndDrinkDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showFoodAndDrink', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowIcons() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showIcons', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowIconsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showIcons', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowLectureHalls() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showLectureHalls', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowLectureHallsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showLectureHalls', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowSeminarRooms() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showSeminarRooms', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowSeminarRoomsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showSeminarRooms', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowStairs() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showStairs', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowStairsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showStairs', Sort.desc);
- });
- }
-
- QueryBuilder thenByShowToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showToilets', Sort.asc);
- });
- }
-
- QueryBuilder thenByShowToiletsDesc() {
- return QueryBuilder.apply(this, (query) {
- return query.addSortBy(r'showToilets', Sort.desc);
- });
- }
-}
-
-extension SettingsQueryWhereDistinct
- on QueryBuilder {
- QueryBuilder distinctByFemaleToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'femaleToilets');
- });
- }
-
- QueryBuilder distinctByHandicapToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'handicapToilets');
- });
- }
-
- QueryBuilder distinctByMaleToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'maleToilets');
- });
- }
-
- QueryBuilder distinctByShowComputerPools() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showComputerPools');
- });
- }
-
- QueryBuilder distinctByShowDoors() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showDoors');
- });
- }
-
- QueryBuilder distinctByShowElevators() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showElevators');
- });
- }
-
- QueryBuilder distinctByShowFoodAndDrink() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showFoodAndDrink');
- });
- }
-
- QueryBuilder distinctByShowIcons() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showIcons');
- });
- }
-
- QueryBuilder distinctByShowLectureHalls() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showLectureHalls');
- });
- }
-
- QueryBuilder distinctByShowSeminarRooms() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showSeminarRooms');
- });
- }
-
- QueryBuilder distinctByShowStairs() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showStairs');
- });
- }
-
- QueryBuilder distinctByShowToilets() {
- return QueryBuilder.apply(this, (query) {
- return query.addDistinctBy(r'showToilets');
- });
- }
-}
-
-extension SettingsQueryProperty
- on QueryBuilder {
- QueryBuilder idProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'id');
- });
- }
-
- QueryBuilder femaleToiletsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'femaleToilets');
- });
- }
-
- QueryBuilder handicapToiletsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'handicapToilets');
- });
- }
-
- QueryBuilder maleToiletsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'maleToilets');
- });
- }
-
- QueryBuilder showComputerPoolsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showComputerPools');
- });
- }
-
- QueryBuilder showDoorsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showDoors');
- });
- }
-
- QueryBuilder showElevatorsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showElevators');
- });
- }
-
- QueryBuilder showFoodAndDrinkProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showFoodAndDrink');
- });
- }
-
- QueryBuilder showIconsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showIcons');
- });
- }
-
- QueryBuilder showLectureHallsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showLectureHalls');
- });
- }
-
- QueryBuilder showSeminarRoomsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showSeminarRooms');
- });
- }
-
- QueryBuilder showStairsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showStairs');
- });
- }
-
- QueryBuilder showToiletsProperty() {
- return QueryBuilder.apply(this, (query) {
- return query.addPropertyName(r'showToilets');
- });
- }
-}
diff --git a/lib/controllers/map_controller.dart b/lib/controllers/map_controller.dart
index c0356a0..9e1c26d 100644
--- a/lib/controllers/map_controller.dart
+++ b/lib/controllers/map_controller.dart
@@ -1,14 +1,17 @@
+import 'dart:async';
import 'dart:convert';
import 'package:anyhow/anyhow.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:geojson_vi/geojson_vi.dart';
+import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:uninav/components/feature_bottom_sheet.dart';
import 'package:uninav/data/geo/model.dart';
import 'package:uninav/data/geo/parser.dart';
import 'package:uninav/util/geojson_util.dart';
+import 'package:uninav/util/geolocator.dart';
import 'package:uninav/util/geomath.dart';
class MyMapController extends GetxController {
@@ -17,6 +20,10 @@ class MyMapController extends GetxController {
final RxList features = [].obs;
final currentLevel = 1.obs;
final levels = [1].obs;
+ final Rx position = null.obs;
+
+ bool _locationEnsured = false;
+
@override
onInit() async {
print("init");
@@ -98,6 +105,8 @@ class MyMapController extends GetxController {
feature.geometry, feature.id);
if (parsed case Ok(:final ok)) {
featuresList.add(ok);
+ } else {
+ print('Error parsing feature: $parsed');
}
}
@@ -137,4 +146,46 @@ class MyMapController extends GetxController {
}
showFeatureBottomSheet(feature, closestFeatures);
}
+
+ Future> getCurrentPosition() async {
+ if (!_locationEnsured) {
+ final ensureRes = await ensureLocationPermission();
+ if (ensureRes is Err) {
+ // TODO: check that it works
+ return ensureRes as Err;
+ }
+ }
+ _locationEnsured = true;
+ try {
+ final pos = await Geolocator.getCurrentPosition(
+ // desiredAccuracy: LocationAccuracy.high,
+ timeLimit: Duration(minutes: 1),
+ );
+ position.value = pos;
+ return Ok(pos);
+ } on TimeoutException catch (e) {
+ return bail("Timeout while waiting for location lock: $e");
+ }
+ }
+
+ Future> subscribePosition() async {
+ if (!_locationEnsured) {
+ final ensureRes = await ensureLocationPermission();
+ if (ensureRes is Err) {
+ // TODO: check that it works
+ return ensureRes;
+ }
+ }
+ _locationEnsured = true;
+ Geolocator.getPositionStream(
+ locationSettings: const LocationSettings(
+ accuracy: LocationAccuracy.high,
+ distanceFilter: 100,
+ //timeLimit: Duration(minutes: 10)
+ ),
+ ).listen((pos) {
+ position.value = pos;
+ });
+ return const Ok(());
+ }
}
diff --git a/lib/controllers/shared_prefs_controller.dart b/lib/controllers/shared_prefs_controller.dart
new file mode 100644
index 0000000..51198fe
--- /dev/null
+++ b/lib/controllers/shared_prefs_controller.dart
@@ -0,0 +1,72 @@
+import 'dart:convert';
+
+import 'package:get/get.dart';
+import 'package:path_provider/path_provider.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part 'shared_prefs_controller.freezed.dart';
+part 'shared_prefs_controller.g.dart';
+
+class SharedPrefsController {
+ late SharedPreferences _sharedPrefs;
+
+ final Rx settings = Settings().obs;
+
+ SharedPrefsController();
+
+ Future initialize() async {
+ _sharedPrefs = await SharedPreferences.getInstance();
+ try {
+ final settingsJson = _sharedPrefs.getString("settings");
+ if (settingsJson != null) {
+ settings.value = Settings.fromJson(jsonDecode(settingsJson));
+ } else {
+ settings.value = const Settings();
+ }
+ } catch (e) {
+ settings.value = const Settings();
+ }
+ }
+
+ Future persistSettings() async {
+ final prefs = await SharedPreferences.getInstance();
+ await prefs.setString('settings', jsonEncode(settings.value));
+ }
+
+ Future loadSettings() async {
+ final prefs = await SharedPreferences.getInstance();
+ final settingsJson = prefs.getString('settings');
+ return settingsJson != null
+ ? Settings.fromJson(jsonDecode(settingsJson))
+ : const Settings();
+ }
+}
+
+@freezed
+class Settings with _$Settings {
+ const factory Settings({
+ @Default(1) int id,
+ @Default(true) bool showIcons,
+ @Default(true) bool showElevators,
+ @Default(true) bool showFoodAndDrink,
+ @Default(true) bool showLectureHalls,
+ @Default(true) bool showComputerPools,
+ @Default(true) bool showSeminarRooms,
+ @Default(true) bool showToilets,
+ @Default(true) bool showStairs,
+ @Default(true) bool showDoors,
+ @Default(false) bool maleToilets,
+ @Default(false) bool femaleToilets,
+ @Default(false) bool handicapToilets,
+ }) = _Settings;
+
+ factory Settings.fromJson(Map json) =>
+ _$SettingsFromJson(json);
+}
+
+enum ToiletPreference {
+ male,
+ female,
+ disabled,
+}
diff --git a/lib/controllers/shared_prefs_controller.freezed.dart b/lib/controllers/shared_prefs_controller.freezed.dart
new file mode 100644
index 0000000..a1688b0
--- /dev/null
+++ b/lib/controllers/shared_prefs_controller.freezed.dart
@@ -0,0 +1,433 @@
+// coverage:ignore-file
+// GENERATED CODE - DO NOT MODIFY BY HAND
+// ignore_for_file: type=lint
+// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
+
+part of 'shared_prefs_controller.dart';
+
+// **************************************************************************
+// FreezedGenerator
+// **************************************************************************
+
+T _$identity(T value) => value;
+
+final _privateConstructorUsedError = UnsupportedError(
+ 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
+
+Settings _$SettingsFromJson(Map json) {
+ return _Settings.fromJson(json);
+}
+
+/// @nodoc
+mixin _$Settings {
+ int get id => throw _privateConstructorUsedError;
+ bool get showIcons => throw _privateConstructorUsedError;
+ bool get showElevators => throw _privateConstructorUsedError;
+ bool get showFoodAndDrink => throw _privateConstructorUsedError;
+ bool get showLectureHalls => throw _privateConstructorUsedError;
+ bool get showComputerPools => throw _privateConstructorUsedError;
+ bool get showSeminarRooms => throw _privateConstructorUsedError;
+ bool get showToilets => throw _privateConstructorUsedError;
+ bool get showStairs => throw _privateConstructorUsedError;
+ bool get showDoors => throw _privateConstructorUsedError;
+ bool get maleToilets => throw _privateConstructorUsedError;
+ bool get femaleToilets => throw _privateConstructorUsedError;
+ bool get handicapToilets => throw _privateConstructorUsedError;
+
+ Map toJson() => throw _privateConstructorUsedError;
+ @JsonKey(ignore: true)
+ $SettingsCopyWith get copyWith =>
+ throw _privateConstructorUsedError;
+}
+
+/// @nodoc
+abstract class $SettingsCopyWith<$Res> {
+ factory $SettingsCopyWith(Settings value, $Res Function(Settings) then) =
+ _$SettingsCopyWithImpl<$Res, Settings>;
+ @useResult
+ $Res call(
+ {int id,
+ bool showIcons,
+ bool showElevators,
+ bool showFoodAndDrink,
+ bool showLectureHalls,
+ bool showComputerPools,
+ bool showSeminarRooms,
+ bool showToilets,
+ bool showStairs,
+ bool showDoors,
+ bool maleToilets,
+ bool femaleToilets,
+ bool handicapToilets});
+}
+
+/// @nodoc
+class _$SettingsCopyWithImpl<$Res, $Val extends Settings>
+ implements $SettingsCopyWith<$Res> {
+ _$SettingsCopyWithImpl(this._value, this._then);
+
+ // ignore: unused_field
+ final $Val _value;
+ // ignore: unused_field
+ final $Res Function($Val) _then;
+
+ @pragma('vm:prefer-inline')
+ @override
+ $Res call({
+ Object? id = null,
+ Object? showIcons = null,
+ Object? showElevators = null,
+ Object? showFoodAndDrink = null,
+ Object? showLectureHalls = null,
+ Object? showComputerPools = null,
+ Object? showSeminarRooms = null,
+ Object? showToilets = null,
+ Object? showStairs = null,
+ Object? showDoors = null,
+ Object? maleToilets = null,
+ Object? femaleToilets = null,
+ Object? handicapToilets = null,
+ }) {
+ return _then(_value.copyWith(
+ id: null == id
+ ? _value.id
+ : id // ignore: cast_nullable_to_non_nullable
+ as int,
+ showIcons: null == showIcons
+ ? _value.showIcons
+ : showIcons // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showElevators: null == showElevators
+ ? _value.showElevators
+ : showElevators // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showFoodAndDrink: null == showFoodAndDrink
+ ? _value.showFoodAndDrink
+ : showFoodAndDrink // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showLectureHalls: null == showLectureHalls
+ ? _value.showLectureHalls
+ : showLectureHalls // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showComputerPools: null == showComputerPools
+ ? _value.showComputerPools
+ : showComputerPools // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showSeminarRooms: null == showSeminarRooms
+ ? _value.showSeminarRooms
+ : showSeminarRooms // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showToilets: null == showToilets
+ ? _value.showToilets
+ : showToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showStairs: null == showStairs
+ ? _value.showStairs
+ : showStairs // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showDoors: null == showDoors
+ ? _value.showDoors
+ : showDoors // ignore: cast_nullable_to_non_nullable
+ as bool,
+ maleToilets: null == maleToilets
+ ? _value.maleToilets
+ : maleToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ femaleToilets: null == femaleToilets
+ ? _value.femaleToilets
+ : femaleToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ handicapToilets: null == handicapToilets
+ ? _value.handicapToilets
+ : handicapToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ ) as $Val);
+ }
+}
+
+/// @nodoc
+abstract class _$$SettingsImplCopyWith<$Res>
+ implements $SettingsCopyWith<$Res> {
+ factory _$$SettingsImplCopyWith(
+ _$SettingsImpl value, $Res Function(_$SettingsImpl) then) =
+ __$$SettingsImplCopyWithImpl<$Res>;
+ @override
+ @useResult
+ $Res call(
+ {int id,
+ bool showIcons,
+ bool showElevators,
+ bool showFoodAndDrink,
+ bool showLectureHalls,
+ bool showComputerPools,
+ bool showSeminarRooms,
+ bool showToilets,
+ bool showStairs,
+ bool showDoors,
+ bool maleToilets,
+ bool femaleToilets,
+ bool handicapToilets});
+}
+
+/// @nodoc
+class __$$SettingsImplCopyWithImpl<$Res>
+ extends _$SettingsCopyWithImpl<$Res, _$SettingsImpl>
+ implements _$$SettingsImplCopyWith<$Res> {
+ __$$SettingsImplCopyWithImpl(
+ _$SettingsImpl _value, $Res Function(_$SettingsImpl) _then)
+ : super(_value, _then);
+
+ @pragma('vm:prefer-inline')
+ @override
+ $Res call({
+ Object? id = null,
+ Object? showIcons = null,
+ Object? showElevators = null,
+ Object? showFoodAndDrink = null,
+ Object? showLectureHalls = null,
+ Object? showComputerPools = null,
+ Object? showSeminarRooms = null,
+ Object? showToilets = null,
+ Object? showStairs = null,
+ Object? showDoors = null,
+ Object? maleToilets = null,
+ Object? femaleToilets = null,
+ Object? handicapToilets = null,
+ }) {
+ return _then(_$SettingsImpl(
+ id: null == id
+ ? _value.id
+ : id // ignore: cast_nullable_to_non_nullable
+ as int,
+ showIcons: null == showIcons
+ ? _value.showIcons
+ : showIcons // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showElevators: null == showElevators
+ ? _value.showElevators
+ : showElevators // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showFoodAndDrink: null == showFoodAndDrink
+ ? _value.showFoodAndDrink
+ : showFoodAndDrink // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showLectureHalls: null == showLectureHalls
+ ? _value.showLectureHalls
+ : showLectureHalls // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showComputerPools: null == showComputerPools
+ ? _value.showComputerPools
+ : showComputerPools // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showSeminarRooms: null == showSeminarRooms
+ ? _value.showSeminarRooms
+ : showSeminarRooms // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showToilets: null == showToilets
+ ? _value.showToilets
+ : showToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showStairs: null == showStairs
+ ? _value.showStairs
+ : showStairs // ignore: cast_nullable_to_non_nullable
+ as bool,
+ showDoors: null == showDoors
+ ? _value.showDoors
+ : showDoors // ignore: cast_nullable_to_non_nullable
+ as bool,
+ maleToilets: null == maleToilets
+ ? _value.maleToilets
+ : maleToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ femaleToilets: null == femaleToilets
+ ? _value.femaleToilets
+ : femaleToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ handicapToilets: null == handicapToilets
+ ? _value.handicapToilets
+ : handicapToilets // ignore: cast_nullable_to_non_nullable
+ as bool,
+ ));
+ }
+}
+
+/// @nodoc
+@JsonSerializable()
+class _$SettingsImpl implements _Settings {
+ const _$SettingsImpl(
+ {this.id = 1,
+ this.showIcons = true,
+ this.showElevators = true,
+ this.showFoodAndDrink = true,
+ this.showLectureHalls = true,
+ this.showComputerPools = true,
+ this.showSeminarRooms = true,
+ this.showToilets = true,
+ this.showStairs = true,
+ this.showDoors = true,
+ this.maleToilets = false,
+ this.femaleToilets = false,
+ this.handicapToilets = false});
+
+ factory _$SettingsImpl.fromJson(Map json) =>
+ _$$SettingsImplFromJson(json);
+
+ @override
+ @JsonKey()
+ final int id;
+ @override
+ @JsonKey()
+ final bool showIcons;
+ @override
+ @JsonKey()
+ final bool showElevators;
+ @override
+ @JsonKey()
+ final bool showFoodAndDrink;
+ @override
+ @JsonKey()
+ final bool showLectureHalls;
+ @override
+ @JsonKey()
+ final bool showComputerPools;
+ @override
+ @JsonKey()
+ final bool showSeminarRooms;
+ @override
+ @JsonKey()
+ final bool showToilets;
+ @override
+ @JsonKey()
+ final bool showStairs;
+ @override
+ @JsonKey()
+ final bool showDoors;
+ @override
+ @JsonKey()
+ final bool maleToilets;
+ @override
+ @JsonKey()
+ final bool femaleToilets;
+ @override
+ @JsonKey()
+ final bool handicapToilets;
+
+ @override
+ String toString() {
+ return 'Settings(id: $id, showIcons: $showIcons, showElevators: $showElevators, showFoodAndDrink: $showFoodAndDrink, showLectureHalls: $showLectureHalls, showComputerPools: $showComputerPools, showSeminarRooms: $showSeminarRooms, showToilets: $showToilets, showStairs: $showStairs, showDoors: $showDoors, maleToilets: $maleToilets, femaleToilets: $femaleToilets, handicapToilets: $handicapToilets)';
+ }
+
+ @override
+ bool operator ==(Object other) {
+ return identical(this, other) ||
+ (other.runtimeType == runtimeType &&
+ other is _$SettingsImpl &&
+ (identical(other.id, id) || other.id == id) &&
+ (identical(other.showIcons, showIcons) ||
+ other.showIcons == showIcons) &&
+ (identical(other.showElevators, showElevators) ||
+ other.showElevators == showElevators) &&
+ (identical(other.showFoodAndDrink, showFoodAndDrink) ||
+ other.showFoodAndDrink == showFoodAndDrink) &&
+ (identical(other.showLectureHalls, showLectureHalls) ||
+ other.showLectureHalls == showLectureHalls) &&
+ (identical(other.showComputerPools, showComputerPools) ||
+ other.showComputerPools == showComputerPools) &&
+ (identical(other.showSeminarRooms, showSeminarRooms) ||
+ other.showSeminarRooms == showSeminarRooms) &&
+ (identical(other.showToilets, showToilets) ||
+ other.showToilets == showToilets) &&
+ (identical(other.showStairs, showStairs) ||
+ other.showStairs == showStairs) &&
+ (identical(other.showDoors, showDoors) ||
+ other.showDoors == showDoors) &&
+ (identical(other.maleToilets, maleToilets) ||
+ other.maleToilets == maleToilets) &&
+ (identical(other.femaleToilets, femaleToilets) ||
+ other.femaleToilets == femaleToilets) &&
+ (identical(other.handicapToilets, handicapToilets) ||
+ other.handicapToilets == handicapToilets));
+ }
+
+ @JsonKey(ignore: true)
+ @override
+ int get hashCode => Object.hash(
+ runtimeType,
+ id,
+ showIcons,
+ showElevators,
+ showFoodAndDrink,
+ showLectureHalls,
+ showComputerPools,
+ showSeminarRooms,
+ showToilets,
+ showStairs,
+ showDoors,
+ maleToilets,
+ femaleToilets,
+ handicapToilets);
+
+ @JsonKey(ignore: true)
+ @override
+ @pragma('vm:prefer-inline')
+ _$$SettingsImplCopyWith<_$SettingsImpl> get copyWith =>
+ __$$SettingsImplCopyWithImpl<_$SettingsImpl>(this, _$identity);
+
+ @override
+ Map toJson() {
+ return _$$SettingsImplToJson(
+ this,
+ );
+ }
+}
+
+abstract class _Settings implements Settings {
+ const factory _Settings(
+ {final int id,
+ final bool showIcons,
+ final bool showElevators,
+ final bool showFoodAndDrink,
+ final bool showLectureHalls,
+ final bool showComputerPools,
+ final bool showSeminarRooms,
+ final bool showToilets,
+ final bool showStairs,
+ final bool showDoors,
+ final bool maleToilets,
+ final bool femaleToilets,
+ final bool handicapToilets}) = _$SettingsImpl;
+
+ factory _Settings.fromJson(Map json) =
+ _$SettingsImpl.fromJson;
+
+ @override
+ int get id;
+ @override
+ bool get showIcons;
+ @override
+ bool get showElevators;
+ @override
+ bool get showFoodAndDrink;
+ @override
+ bool get showLectureHalls;
+ @override
+ bool get showComputerPools;
+ @override
+ bool get showSeminarRooms;
+ @override
+ bool get showToilets;
+ @override
+ bool get showStairs;
+ @override
+ bool get showDoors;
+ @override
+ bool get maleToilets;
+ @override
+ bool get femaleToilets;
+ @override
+ bool get handicapToilets;
+ @override
+ @JsonKey(ignore: true)
+ _$$SettingsImplCopyWith<_$SettingsImpl> get copyWith =>
+ throw _privateConstructorUsedError;
+}
diff --git a/lib/controllers/shared_prefs_controller.g.dart b/lib/controllers/shared_prefs_controller.g.dart
new file mode 100644
index 0000000..02b5768
--- /dev/null
+++ b/lib/controllers/shared_prefs_controller.g.dart
@@ -0,0 +1,41 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'shared_prefs_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+_$SettingsImpl _$$SettingsImplFromJson(Map json) =>
+ _$SettingsImpl(
+ id: json['id'] as int? ?? 1,
+ showIcons: json['showIcons'] as bool? ?? true,
+ showElevators: json['showElevators'] as bool? ?? true,
+ showFoodAndDrink: json['showFoodAndDrink'] as bool? ?? true,
+ showLectureHalls: json['showLectureHalls'] as bool? ?? true,
+ showComputerPools: json['showComputerPools'] as bool? ?? true,
+ showSeminarRooms: json['showSeminarRooms'] as bool? ?? true,
+ showToilets: json['showToilets'] as bool? ?? true,
+ showStairs: json['showStairs'] as bool? ?? true,
+ showDoors: json['showDoors'] as bool? ?? true,
+ maleToilets: json['maleToilets'] as bool? ?? false,
+ femaleToilets: json['femaleToilets'] as bool? ?? false,
+ handicapToilets: json['handicapToilets'] as bool? ?? false,
+ );
+
+Map _$$SettingsImplToJson(_$SettingsImpl instance) =>
+ {
+ 'id': instance.id,
+ 'showIcons': instance.showIcons,
+ 'showElevators': instance.showElevators,
+ 'showFoodAndDrink': instance.showFoodAndDrink,
+ 'showLectureHalls': instance.showLectureHalls,
+ 'showComputerPools': instance.showComputerPools,
+ 'showSeminarRooms': instance.showSeminarRooms,
+ 'showToilets': instance.showToilets,
+ 'showStairs': instance.showStairs,
+ 'showDoors': instance.showDoors,
+ 'maleToilets': instance.maleToilets,
+ 'femaleToilets': instance.femaleToilets,
+ 'handicapToilets': instance.handicapToilets,
+ };
diff --git a/lib/data/geo/model.dart b/lib/data/geo/model.dart
index cbcd82a..f289550 100644
--- a/lib/data/geo/model.dart
+++ b/lib/data/geo/model.dart
@@ -99,11 +99,13 @@ class FeatureType with _$FeatureType {
// multiple feature types like lecture hall, toliet, ...
const factory FeatureType.building() = Building;
const factory FeatureType.lectureHall() = LectureHall;
- const factory FeatureType.room() = Room;
+ const factory FeatureType.room(String roomNumber) = Room;
const factory FeatureType.door(List connects) = Door;
const factory FeatureType.toilet(String toilet_type) = Toilet;
const factory FeatureType.stairs(List connects_levels) = Stairs;
const factory FeatureType.lift(List connects_levels) = Lift;
+ const factory FeatureType.foodDrink() = FoodDrink;
const factory FeatureType.publicTransport(
List bus_lines, List tram_lines) = PublicTransport;
+ const factory FeatureType.pcPool(String roomNumber) = PcPool;
}
diff --git a/lib/data/geo/model.freezed.dart b/lib/data/geo/model.freezed.dart
index fdbd365..a2cf647 100644
--- a/lib/data/geo/model.freezed.dart
+++ b/lib/data/geo/model.freezed.dart
@@ -277,39 +277,45 @@ mixin _$FeatureType {
TResult when({
required TResult Function() building,
required TResult Function() lectureHall,
- required TResult Function() room,
+ required TResult Function(String roomNumber) room,
required TResult Function(List connects) door,
required TResult Function(String toilet_type) toilet,
required TResult Function(List connects_levels) stairs,
required TResult Function(List connects_levels) lift,
+ required TResult Function() foodDrink,
required TResult Function(List bus_lines, List tram_lines)
publicTransport,
+ required TResult Function(String roomNumber) pcPool,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull({
TResult? Function()? building,
TResult? Function()? lectureHall,
- TResult? Function()? room,
+ TResult? Function(String roomNumber)? room,
TResult? Function(List connects)? door,
TResult? Function(String toilet_type)? toilet,
TResult? Function(List connects_levels)? stairs,
TResult? Function(List connects_levels)? lift,
+ TResult? Function()? foodDrink,
TResult? Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult? Function(String roomNumber)? pcPool,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen({
TResult Function()? building,
TResult Function()? lectureHall,
- TResult Function()? room,
+ TResult Function(String roomNumber)? room,
TResult Function(List connects)? door,
TResult Function(String toilet_type)? toilet,
TResult Function(List connects_levels)? stairs,
TResult Function(List connects_levels)? lift,
+ TResult Function()? foodDrink,
TResult Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult Function(String roomNumber)? pcPool,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@@ -322,7 +328,9 @@ mixin _$FeatureType {
required TResult Function(Toilet value) toilet,
required TResult Function(Stairs value) stairs,
required TResult Function(Lift value) lift,
+ required TResult Function(FoodDrink value) foodDrink,
required TResult Function(PublicTransport value) publicTransport,
+ required TResult Function(PcPool value) pcPool,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -334,7 +342,9 @@ mixin _$FeatureType {
TResult? Function(Toilet value)? toilet,
TResult? Function(Stairs value)? stairs,
TResult? Function(Lift value)? lift,
+ TResult? Function(FoodDrink value)? foodDrink,
TResult? Function(PublicTransport value)? publicTransport,
+ TResult? Function(PcPool value)? pcPool,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -346,7 +356,9 @@ mixin _$FeatureType {
TResult Function(Toilet value)? toilet,
TResult Function(Stairs value)? stairs,
TResult Function(Lift value)? lift,
+ TResult Function(FoodDrink value)? foodDrink,
TResult Function(PublicTransport value)? publicTransport,
+ TResult Function(PcPool value)? pcPool,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@@ -410,13 +422,15 @@ class _$BuildingImpl implements Building {
TResult when({
required TResult Function() building,
required TResult Function() lectureHall,
- required TResult Function() room,
+ required TResult Function(String roomNumber) room,
required TResult Function(List connects) door,
required TResult Function(String toilet_type) toilet,
required TResult Function(List connects_levels) stairs,
required TResult Function(List connects_levels) lift,
+ required TResult Function() foodDrink,
required TResult Function(List bus_lines, List tram_lines)
publicTransport,
+ required TResult Function(String roomNumber) pcPool,
}) {
return building();
}
@@ -426,13 +440,15 @@ class _$BuildingImpl implements Building {
TResult? whenOrNull({
TResult? Function()? building,
TResult? Function()? lectureHall,
- TResult? Function()? room,
+ TResult? Function(String roomNumber)? room,
TResult? Function(List connects)? door,
TResult? Function(String toilet_type)? toilet,
TResult? Function(List connects_levels)? stairs,
TResult? Function(List connects_levels)? lift,
+ TResult? Function()? foodDrink,
TResult? Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult? Function(String roomNumber)? pcPool,
}) {
return building?.call();
}
@@ -442,13 +458,15 @@ class _$BuildingImpl implements Building {
TResult maybeWhen({
TResult Function()? building,
TResult Function()? lectureHall,
- TResult Function()? room,
+ TResult Function(String roomNumber)? room,
TResult Function(List connects)? door,
TResult Function(String toilet_type)? toilet,
TResult Function(List connects_levels)? stairs,
TResult Function(List connects_levels)? lift,
+ TResult Function()? foodDrink,
TResult Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult Function(String roomNumber)? pcPool,
required TResult orElse(),
}) {
if (building != null) {
@@ -467,7 +485,9 @@ class _$BuildingImpl implements Building {
required TResult Function(Toilet value) toilet,
required TResult Function(Stairs value) stairs,
required TResult Function(Lift value) lift,
+ required TResult Function(FoodDrink value) foodDrink,
required TResult Function(PublicTransport value) publicTransport,
+ required TResult Function(PcPool value) pcPool,
}) {
return building(this);
}
@@ -482,7 +502,9 @@ class _$BuildingImpl implements Building {
TResult? Function(Toilet value)? toilet,
TResult? Function(Stairs value)? stairs,
TResult? Function(Lift value)? lift,
+ TResult? Function(FoodDrink value)? foodDrink,
TResult? Function(PublicTransport value)? publicTransport,
+ TResult? Function(PcPool value)? pcPool,
}) {
return building?.call(this);
}
@@ -497,7 +519,9 @@ class _$BuildingImpl implements Building {
TResult Function(Toilet value)? toilet,
TResult Function(Stairs value)? stairs,
TResult Function(Lift value)? lift,
+ TResult Function(FoodDrink value)? foodDrink,
TResult Function(PublicTransport value)? publicTransport,
+ TResult Function(PcPool value)? pcPool,
required TResult orElse(),
}) {
if (building != null) {
@@ -551,13 +575,15 @@ class _$LectureHallImpl implements LectureHall {
TResult when({
required TResult Function() building,
required TResult Function() lectureHall,
- required TResult Function() room,
+ required TResult Function(String roomNumber) room,
required TResult Function(List connects) door,
required TResult Function(String toilet_type) toilet,
required TResult Function(List connects_levels) stairs,
required TResult Function(List connects_levels) lift,
+ required TResult Function() foodDrink,
required TResult Function(List bus_lines, List tram_lines)
publicTransport,
+ required TResult Function(String roomNumber) pcPool,
}) {
return lectureHall();
}
@@ -567,13 +593,15 @@ class _$LectureHallImpl implements LectureHall {
TResult? whenOrNull({
TResult? Function()? building,
TResult? Function()? lectureHall,
- TResult? Function()? room,
+ TResult? Function(String roomNumber)? room,
TResult? Function(List connects)? door,
TResult? Function(String toilet_type)? toilet,
TResult? Function(List connects_levels)? stairs,
TResult? Function(List connects_levels)? lift,
+ TResult? Function()? foodDrink,
TResult? Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult? Function(String roomNumber)? pcPool,
}) {
return lectureHall?.call();
}
@@ -583,13 +611,15 @@ class _$LectureHallImpl implements LectureHall {
TResult maybeWhen({
TResult Function()? building,
TResult Function()? lectureHall,
- TResult Function()? room,
+ TResult Function(String roomNumber)? room,
TResult Function(List connects)? door,
TResult Function(String toilet_type)? toilet,
TResult Function(List connects_levels)? stairs,
TResult Function(List connects_levels)? lift,
+ TResult Function()? foodDrink,
TResult Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult Function(String roomNumber)? pcPool,
required TResult orElse(),
}) {
if (lectureHall != null) {
@@ -608,7 +638,9 @@ class _$LectureHallImpl implements LectureHall {
required TResult Function(Toilet value) toilet,
required TResult Function(Stairs value) stairs,
required TResult Function(Lift value) lift,
+ required TResult Function(FoodDrink value) foodDrink,
required TResult Function(PublicTransport value) publicTransport,
+ required TResult Function(PcPool value) pcPool,
}) {
return lectureHall(this);
}
@@ -623,7 +655,9 @@ class _$LectureHallImpl implements LectureHall {
TResult? Function(Toilet value)? toilet,
TResult? Function(Stairs value)? stairs,
TResult? Function(Lift value)? lift,
+ TResult? Function(FoodDrink value)? foodDrink,
TResult? Function(PublicTransport value)? publicTransport,
+ TResult? Function(PcPool value)? pcPool,
}) {
return lectureHall?.call(this);
}
@@ -638,7 +672,9 @@ class _$LectureHallImpl implements LectureHall {
TResult Function(Toilet value)? toilet,
TResult Function(Stairs value)? stairs,
TResult Function(Lift value)? lift,
+ TResult Function(FoodDrink value)? foodDrink,
TResult Function(PublicTransport value)? publicTransport,
+ TResult Function(PcPool value)? pcPool,
required TResult orElse(),
}) {
if (lectureHall != null) {
@@ -657,6 +693,8 @@ abstract class _$$RoomImplCopyWith<$Res> {
factory _$$RoomImplCopyWith(
_$RoomImpl value, $Res Function(_$RoomImpl) then) =
__$$RoomImplCopyWithImpl<$Res>;
+ @useResult
+ $Res call({String roomNumber});
}
/// @nodoc
@@ -665,41 +703,68 @@ class __$$RoomImplCopyWithImpl<$Res>
implements _$$RoomImplCopyWith<$Res> {
__$$RoomImplCopyWithImpl(_$RoomImpl _value, $Res Function(_$RoomImpl) _then)
: super(_value, _then);
+
+ @pragma('vm:prefer-inline')
+ @override
+ $Res call({
+ Object? roomNumber = null,
+ }) {
+ return _then(_$RoomImpl(
+ null == roomNumber
+ ? _value.roomNumber
+ : roomNumber // ignore: cast_nullable_to_non_nullable
+ as String,
+ ));
+ }
}
/// @nodoc
class _$RoomImpl implements Room {
- const _$RoomImpl();
+ const _$RoomImpl(this.roomNumber);
+
+ @override
+ final String roomNumber;
@override
String toString() {
- return 'FeatureType.room()';
+ return 'FeatureType.room(roomNumber: $roomNumber)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
- (other.runtimeType == runtimeType && other is _$RoomImpl);
+ (other.runtimeType == runtimeType &&
+ other is _$RoomImpl &&
+ (identical(other.roomNumber, roomNumber) ||
+ other.roomNumber == roomNumber));
}
@override
- int get hashCode => runtimeType.hashCode;
+ int get hashCode => Object.hash(runtimeType, roomNumber);
+
+ @JsonKey(ignore: true)
+ @override
+ @pragma('vm:prefer-inline')
+ _$$RoomImplCopyWith<_$RoomImpl> get copyWith =>
+ __$$RoomImplCopyWithImpl<_$RoomImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when({
required TResult Function() building,
required TResult Function() lectureHall,
- required TResult Function() room,
+ required TResult Function(String roomNumber) room,
required TResult Function(List connects) door,
required TResult Function(String toilet_type) toilet,
required TResult Function(List connects_levels) stairs,
required TResult Function(List connects_levels) lift,
+ required TResult Function() foodDrink,
required TResult Function(List bus_lines, List tram_lines)
publicTransport,
+ required TResult Function(String roomNumber) pcPool,
}) {
- return room();
+ return room(roomNumber);
}
@override
@@ -707,15 +772,17 @@ class _$RoomImpl implements Room {
TResult? whenOrNull({
TResult? Function()? building,
TResult? Function()? lectureHall,
- TResult? Function()? room,
+ TResult? Function(String roomNumber)? room,
TResult? Function(List connects)? door,
TResult? Function(String toilet_type)? toilet,
TResult? Function(List connects_levels)? stairs,
TResult? Function(List connects_levels)? lift,
+ TResult? Function()? foodDrink,
TResult? Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult? Function(String roomNumber)? pcPool,
}) {
- return room?.call();
+ return room?.call(roomNumber);
}
@override
@@ -723,17 +790,19 @@ class _$RoomImpl implements Room {
TResult maybeWhen({
TResult Function()? building,
TResult Function()? lectureHall,
- TResult Function()? room,
+ TResult Function(String roomNumber)? room,
TResult Function(List connects)? door,
TResult Function(String toilet_type)? toilet,
TResult Function(List connects_levels)? stairs,
TResult Function(List connects_levels)? lift,
+ TResult Function()? foodDrink,
TResult Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult Function(String roomNumber)? pcPool,
required TResult orElse(),
}) {
if (room != null) {
- return room();
+ return room(roomNumber);
}
return orElse();
}
@@ -748,7 +817,9 @@ class _$RoomImpl implements Room {
required TResult Function(Toilet value) toilet,
required TResult Function(Stairs value) stairs,
required TResult Function(Lift value) lift,
+ required TResult Function(FoodDrink value) foodDrink,
required TResult Function(PublicTransport value) publicTransport,
+ required TResult Function(PcPool value) pcPool,
}) {
return room(this);
}
@@ -763,7 +834,9 @@ class _$RoomImpl implements Room {
TResult? Function(Toilet value)? toilet,
TResult? Function(Stairs value)? stairs,
TResult? Function(Lift value)? lift,
+ TResult? Function(FoodDrink value)? foodDrink,
TResult? Function(PublicTransport value)? publicTransport,
+ TResult? Function(PcPool value)? pcPool,
}) {
return room?.call(this);
}
@@ -778,7 +851,9 @@ class _$RoomImpl implements Room {
TResult Function(Toilet value)? toilet,
TResult Function(Stairs value)? stairs,
TResult Function(Lift value)? lift,
+ TResult Function(FoodDrink value)? foodDrink,
TResult Function(PublicTransport value)? publicTransport,
+ TResult Function(PcPool value)? pcPool,
required TResult orElse(),
}) {
if (room != null) {
@@ -789,7 +864,12 @@ class _$RoomImpl implements Room {
}
abstract class Room implements FeatureType {
- const factory Room() = _$RoomImpl;
+ const factory Room(final String roomNumber) = _$RoomImpl;
+
+ String get roomNumber;
+ @JsonKey(ignore: true)
+ _$$RoomImplCopyWith<_$RoomImpl> get copyWith =>
+ throw _privateConstructorUsedError;
}
/// @nodoc
@@ -863,13 +943,15 @@ class _$DoorImpl implements Door {
TResult when({
required TResult Function() building,
required TResult Function() lectureHall,
- required TResult Function() room,
+ required TResult Function(String roomNumber) room,
required TResult Function(List connects) door,
required TResult Function(String toilet_type) toilet,
required TResult Function(List connects_levels) stairs,
required TResult Function(List connects_levels) lift,
+ required TResult Function() foodDrink,
required TResult Function(List bus_lines, List tram_lines)
publicTransport,
+ required TResult Function(String roomNumber) pcPool,
}) {
return door(connects);
}
@@ -879,13 +961,15 @@ class _$DoorImpl implements Door {
TResult? whenOrNull({
TResult? Function()? building,
TResult? Function()? lectureHall,
- TResult? Function()? room,
+ TResult? Function(String roomNumber)? room,
TResult? Function(List connects)? door,
TResult? Function(String toilet_type)? toilet,
TResult? Function(List connects_levels)? stairs,
TResult? Function(List connects_levels)? lift,
+ TResult? Function()? foodDrink,
TResult? Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult? Function(String roomNumber)? pcPool,
}) {
return door?.call(connects);
}
@@ -895,13 +979,15 @@ class _$DoorImpl implements Door {
TResult maybeWhen({
TResult Function()? building,
TResult Function()? lectureHall,
- TResult Function()? room,
+ TResult Function(String roomNumber)? room,
TResult Function(List connects)? door,
TResult Function(String toilet_type)? toilet,
TResult Function(List connects_levels)? stairs,
TResult Function(List connects_levels)? lift,
+ TResult Function()? foodDrink,
TResult Function(List bus_lines, List tram_lines)?
publicTransport,
+ TResult Function(String roomNumber)? pcPool,
required TResult orElse(),
}) {
if (door != null) {
@@ -920,7 +1006,9 @@ class _$DoorImpl implements Door {
required TResult Function(Toilet value) toilet,
required TResult Function(Stairs value) stairs,
required TResult Function(Lift value) lift,
+ required TResult Function(FoodDrink value) foodDrink,
required TResult Function(PublicTransport value) publicTransport,
+ required TResult Function(PcPool value) pcPool,
}) {
return door(this);
}
@@ -935,7 +1023,9 @@ class _$DoorImpl implements Door {
TResult? Function(Toilet value)? toilet,
TResult? Function(Stairs value)? stairs,
TResult? Function(Lift value)? lift,
+ TResult? Function(FoodDrink value)? foodDrink,
TResult? Function(PublicTransport value)? publicTransport,
+ TResult? Function(PcPool value)? pcPool,
}) {
return door?.call(this);
}
@@ -950,7 +1040,9 @@ class _$DoorImpl implements Door {
TResult Function(Toilet value)? toilet,
TResult Function(Stairs value)? stairs,
TResult Function(Lift value)? lift,
+ TResult Function(FoodDrink value)? foodDrink,
TResult Function(PublicTransport value)? publicTransport,
+ TResult Function(PcPool value)? pcPool,
required TResult orElse(),
}) {
if (door != null) {
@@ -1036,13 +1128,15 @@ class _$ToiletImpl implements Toilet {
TResult when({
required TResult Function() building,
required TResult Function() lectureHall,
- required TResult Function() room,
+ required TResult Function(String roomNumber) room,
required TResult Function(List connects) door,
required TResult Function(String toilet_type) toilet,
required TResult Function(List connects_levels) stairs,
required TResult Function(List connects_levels) lift,
+ required TResult Function() foodDrink,
required TResult Function(List bus_lines, List tram_lines)
publicTransport,
+ required TResult Function(String roomNumber) pcPool,
}) {
return toilet(toilet_type);
}
@@ -1052,13 +1146,15 @@ class _$ToiletImpl implements Toilet {
TResult? whenOrNull