Skip to content

Commit ad5d21c

Browse files
authored
Various User Interface Enhancements (#299)
1 parent e223ab7 commit ad5d21c

10 files changed

Lines changed: 83 additions & 53 deletions

File tree

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version '8.7.0' apply false
21+
id "com.android.application" version '8.7.2' apply false
2222
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
2323
id "org.jetbrains.kotlin.plugin.serialization" version "2.0.21" apply false
2424
id "com.google.gms.google-services" version "4.4.2" apply false

assets/translations/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
"openingHours": "Öffnungszeiten",
140140
"open": "{} offen von {} - {}",
141141
"closed": "Geschlossen",
142+
"currentlyClosed": "Aktuell geschlossen",
142143
"closedOn": "{} geschlossen",
143144
"closedToday": "Heute geschlossen",
144145
"submitFeedback": "Feedback einreichen",

assets/translations/en.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"roomDetails": "Room Details",
105105
"building": "Building",
106106
"nFreeRooms": {
107-
"zero": "no free rooms",
107+
"zero": "No free rooms",
108108
"one": "1 free room",
109109
"other": "{} free rooms"
110110
},
@@ -139,8 +139,9 @@
139139
"openingHours": "Opening Hours",
140140
"open": "Open {} from {} - {}",
141141
"closed": "Closed",
142+
"currentlyClosed": "Currently closed",
142143
"closedOn": "Closed on {}",
143-
"closedToday": "Closed Today",
144+
"closedToday": "Closed today",
144145
"submitFeedback": "Submit Feedback",
145146
"name": "Name",
146147
"message": "Message",

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ PODS:
6464
- PromisesSwift (~> 2.1)
6565
- FirebaseSharedSwift (11.5.0)
6666
- Flutter (1.0.0)
67-
- flutter_native_splash (0.0.1):
67+
- flutter_native_splash (2.4.3):
6868
- Flutter
6969
- flutter_secure_storage (6.0.0):
7070
- Flutter
@@ -249,7 +249,7 @@ SPEC CHECKSUMS:
249249
FirebaseSessions: 3f56f177d9e53a85021d16b31f9a111849d1dd8b
250250
FirebaseSharedSwift: 302ac5967857ad7e7388b15382d705b8c8d892aa
251251
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
252-
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778
252+
flutter_native_splash: e8a1e01082d97a8099d973f919f57904c925008a
253253
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
254254
geolocator_apple: 9bcea1918ff7f0062d98345d238ae12718acfbc1
255255
Google-Maps-iOS-Utils: 66d6de12be1ce6d3742a54661e7a79cb317a9321

lib/placesComponent/model/studyRooms/study_room_group.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,28 @@ class StudyRoomGroup extends Searchable {
2121
@JsonKey(name: "opening_hours", readValue: readListValue)
2222
final List<StudyRoomOpeningHours> openingHours;
2323

24-
List<String>? get openToday {
24+
(String, String)? get openToday {
2525
final currentDay = DateTime.now().weekday;
2626
for (var openingHour in openingHours) {
2727
if (openingHour.days.contains(currentDay)) {
28-
return [openingHour.startString, openingHour.endString];
28+
return (openingHour.startString, openingHour.endString);
2929
}
3030
}
3131
return null;
3232
}
3333

34+
bool get isOpen {
35+
final now = DateTime.now();
36+
final currentDay = now.weekday;
37+
for (var openingHour in openingHours) {
38+
if (openingHour.days.contains(currentDay)) {
39+
return now.hour >= openingHour.startTime &&
40+
now.hour <= openingHour.endTime;
41+
}
42+
}
43+
return false;
44+
}
45+
3446
LatLng? get coordinate {
3547
switch (id) {
3648
case 44:

lib/placesComponent/model/studyRooms/study_room_opening_hours.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class StudyRoomOpeningHours {
3030

3131
String get endString => end.substring(0, end.length - 3);
3232

33+
int get startTime => int.parse(start.substring(0, 2));
34+
35+
int get endTime => int.parse(end.substring(0, 2));
36+
3337
StudyRoomOpeningHours({
3438
required this.daysString,
3539
required this.daysBitMask,

lib/placesComponent/views/homeWidget/study_room_widget_view.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,17 @@ class _StudyRoomWidgetViewState extends ConsumerState<StudyRoomWidgetView> {
166166
}
167167

168168
Widget _freeRooms(StudyRoomGroup studyRoomGroup) {
169-
final freeRooms = ref.read(studyRoomsViewModel).freeRooms(studyRoomGroup);
170-
return Text(
171-
context.plural("nFreeRooms", freeRooms),
172-
style: TextStyle(color: freeRooms > 0 ? Colors.green : Colors.red),
173-
);
169+
if (studyRoomGroup.isOpen) {
170+
final freeRooms = ref.read(studyRoomsViewModel).freeRooms(studyRoomGroup);
171+
return Text(
172+
context.plural("nFreeRooms", freeRooms),
173+
style: TextStyle(color: freeRooms > 0 ? Colors.green : Colors.red),
174+
);
175+
} else {
176+
return Text(
177+
context.tr("currentlyClosed"),
178+
style: TextStyle(color: Colors.red),
179+
);
180+
}
174181
}
175182
}

lib/placesComponent/views/places_view.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'package:campus_flutter/base/enums/device.dart';
2+
import 'package:campus_flutter/base/services/device_type_service.dart';
13
import 'package:campus_flutter/base/util/padded_divider.dart';
24
import 'package:campus_flutter/base/routing/routes.dart';
35
import 'package:campus_flutter/placesComponent/viewModels/places_viewmodel.dart';
@@ -13,15 +15,11 @@ class PlacesView extends ConsumerWidget {
1315

1416
@override
1517
Widget build(BuildContext context, WidgetRef ref) {
16-
return OrientationBuilder(
17-
builder: (context, orientation) {
18-
if (orientation == Orientation.landscape) {
19-
return _landscapeOrientation(context, ref);
20-
} else {
21-
return _portraitOrientation(context, ref);
22-
}
23-
},
24-
);
18+
if (DeviceService.getType(context) == Device.phone) {
19+
return _portraitOrientation(context, ref);
20+
} else {
21+
return _landscapeOrientation(context, ref);
22+
}
2523
}
2624

2725
Widget _landscapeOrientation(BuildContext context, WidgetRef ref) {
@@ -58,7 +56,10 @@ class PlacesView extends ConsumerWidget {
5856
const PaddedDivider(),
5957
Expanded(
6058
child: GridView.count(
61-
crossAxisCount: 3,
59+
crossAxisCount:
60+
DeviceService.getType(context) == Device.landscapeTablet
61+
? 3
62+
: 2,
6263
childAspectRatio: 1.5,
6364
mainAxisSpacing: context.padding,
6465
crossAxisSpacing: context.padding,

lib/placesComponent/views/studyGroups/study_room_group_view.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ class StudyRoomGroupView extends ConsumerWidget {
149149
studyRoomGroup?.openToday != null
150150
? context.tr(
151151
"open",
152-
args: [context.tr("today"), ...studyRoomGroup!.openToday!],
152+
args: [
153+
context.tr("today").toLowerCase(),
154+
studyRoomGroup!.openToday!.$1,
155+
studyRoomGroup!.openToday!.$2,
156+
],
153157
)
154158
: context.tr("closedToday"),
155159
),

pubspec.lock

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ packages:
202202
dependency: transitive
203203
description:
204204
name: charcode
205-
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
205+
sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a
206206
url: "https://pub.dev"
207207
source: hosted
208-
version: "1.3.1"
208+
version: "1.4.0"
209209
checked_yaml:
210210
dependency: transitive
211211
description:
@@ -494,10 +494,10 @@ packages:
494494
dependency: "direct main"
495495
description:
496496
name: flutter_native_splash
497-
sha256: ee5c9bd2b74ea8676442fd4ab876b5d41681df49276488854d6c81a5377c0ef1
497+
sha256: "1152ab0067ca5a2ebeb862fe0a762057202cceb22b7e62692dcbabf6483891bb"
498498
url: "https://pub.dev"
499499
source: hosted
500-
version: "2.4.2"
500+
version: "2.4.3"
501501
flutter_plugin_android_lifecycle:
502502
dependency: transitive
503503
description:
@@ -574,10 +574,10 @@ packages:
574574
dependency: "direct main"
575575
description:
576576
name: flutter_svg
577-
sha256: "578bd8c508144fdaffd4f77b8ef2d8c523602275cd697cc3db284dbd762ef4ce"
577+
sha256: "936d9c1c010d3e234d1672574636f3352b4941ca3decaddd3cafaeb9ad49c471"
578578
url: "https://pub.dev"
579579
source: hosted
580-
version: "2.0.14"
580+
version: "2.0.15"
581581
flutter_test:
582582
dependency: "direct dev"
583583
description: flutter
@@ -600,10 +600,10 @@ packages:
600600
dependency: "direct main"
601601
description:
602602
name: geolocator
603-
sha256: "0ec58b731776bc43097fcf751f79681b6a8f6d3bc737c94779fe9f1ad73c1a81"
603+
sha256: d2ec66329cab29cb297d51d96c067d457ca519dca8589665fa0b82ebacb7dbe4
604604
url: "https://pub.dev"
605605
source: hosted
606-
version: "13.0.1"
606+
version: "13.0.2"
607607
geolocator_android:
608608
dependency: transitive
609609
description:
@@ -616,10 +616,10 @@ packages:
616616
dependency: transitive
617617
description:
618618
name: geolocator_apple
619-
sha256: f47bca50d7f564bc342aac311a050ea0de7d0b6b7bbcf3948b22b1b61874ebd3
619+
sha256: "6154ea2682563f69fc0125762ed7e91e7ed85d0b9776595653be33918e064807"
620620
url: "https://pub.dev"
621621
source: hosted
622-
version: "2.3.8"
622+
version: "2.3.8+1"
623623
geolocator_platform_interface:
624624
dependency: transitive
625625
description:
@@ -672,10 +672,10 @@ packages:
672672
dependency: transitive
673673
description:
674674
name: google_identity_services_web
675-
sha256: "304e2a4c25d84c287df6d7ebf5b93d8bbd4ceb817d96c2686d44f6a346f227b6"
675+
sha256: "55580f436822d64c8ff9a77e37d61f5fb1e6c7ec9d632a43ee324e2a05c3c6c9"
676676
url: "https://pub.dev"
677677
source: hosted
678-
version: "0.3.1+5"
678+
version: "0.3.3"
679679
google_maps:
680680
dependency: transitive
681681
description:
@@ -688,10 +688,10 @@ packages:
688688
dependency: "direct main"
689689
description:
690690
name: google_maps_flutter
691-
sha256: "2e302fa3aaf4e2a297f0342d83ebc5e8e9f826e9a716aef473fe7f404ec630a7"
691+
sha256: "209856c8e5571626afba7182cf634b2910069dc567954e76ec3e3fb37f5e9db3"
692692
url: "https://pub.dev"
693693
source: hosted
694-
version: "2.9.0"
694+
version: "2.10.0"
695695
google_maps_flutter_android:
696696
dependency: transitive
697697
description:
@@ -841,10 +841,10 @@ packages:
841841
dependency: "direct main"
842842
description:
843843
name: json_serializable
844-
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
844+
sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c
845845
url: "https://pub.dev"
846846
source: hosted
847-
version: "6.8.0"
847+
version: "6.9.0"
848848
leak_tracker:
849849
dependency: transitive
850850
description:
@@ -1081,10 +1081,10 @@ packages:
10811081
dependency: transitive
10821082
description:
10831083
name: permission_handler_html
1084-
sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851
1084+
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
10851085
url: "https://pub.dev"
10861086
source: hosted
1087-
version: "0.1.3+2"
1087+
version: "0.1.3+5"
10881088
permission_handler_platform_interface:
10891089
dependency: transitive
10901090
description:
@@ -1486,34 +1486,34 @@ packages:
14861486
dependency: "direct main"
14871487
description:
14881488
name: syncfusion_flutter_calendar
1489-
sha256: "769d3bbf8743922d74b242a968366661bd7b2973b3d34af9b9bc865874a520d9"
1489+
sha256: "00703dd2e154ad534e7e898958f1e4c1573b15a19448c0b183365f4b9779f054"
14901490
url: "https://pub.dev"
14911491
source: hosted
1492-
version: "27.1.58"
1492+
version: "27.2.2"
14931493
syncfusion_flutter_charts:
14941494
dependency: "direct main"
14951495
description:
14961496
name: syncfusion_flutter_charts
1497-
sha256: e97025be6a68d358463dcf0a83b3c600c52e14574c754b331aac5d1cbb86c759
1497+
sha256: f14547b70ad0a662d1f65e8fb79b7178b0dea439d3fc9cb13da8aa4714fecb96
14981498
url: "https://pub.dev"
14991499
source: hosted
1500-
version: "27.1.58"
1500+
version: "27.2.2"
15011501
syncfusion_flutter_core:
15021502
dependency: "direct main"
15031503
description:
15041504
name: syncfusion_flutter_core
1505-
sha256: "31d2ddf410ee41abb3ecf85b7b6e8e1563307ad52ee784ddd91337e30280f715"
1505+
sha256: "225b1cc135549bb4eef096d63b7323c30ee61c4b095c7e8a14bf9333e243d84b"
15061506
url: "https://pub.dev"
15071507
source: hosted
1508-
version: "27.1.58"
1508+
version: "27.2.2"
15091509
syncfusion_flutter_datepicker:
15101510
dependency: "direct main"
15111511
description:
15121512
name: syncfusion_flutter_datepicker
1513-
sha256: e25797401bec43cd64c475150f87150e8bc3e67212d4d1273ff35483ea793a8b
1513+
sha256: e2e2a97b033390f0791316c6019743991aa598563d09f603ba13230cd50b8905
15141514
url: "https://pub.dev"
15151515
source: hosted
1516-
version: "27.1.58"
1516+
version: "27.2.2"
15171517
synchronized:
15181518
dependency: transitive
15191519
description:
@@ -1670,10 +1670,10 @@ packages:
16701670
dependency: transitive
16711671
description:
16721672
name: vector_graphics
1673-
sha256: "773c9522d66d523e1c7b25dfb95cc91c26a1e17b107039cfe147285e92de7878"
1673+
sha256: "27d5fefe86fb9aace4a9f8375b56b3c292b64d8c04510df230f849850d912cb7"
16741674
url: "https://pub.dev"
16751675
source: hosted
1676-
version: "1.1.14"
1676+
version: "1.1.15"
16771677
vector_graphics_codec:
16781678
dependency: transitive
16791679
description:
@@ -1718,10 +1718,10 @@ packages:
17181718
dependency: transitive
17191719
description:
17201720
name: video_player_avfoundation
1721-
sha256: cd5ab8a8bc0eab65ab0cea40304097edc46da574c8c1ecdee96f28cd8ef3792f
1721+
sha256: "0b146e5d82e886ff43e5a46c6bcbe390761b802864a6e2503eb612d69a405dfa"
17221722
url: "https://pub.dev"
17231723
source: hosted
1724-
version: "2.6.2"
1724+
version: "2.6.3"
17251725
video_player_platform_interface:
17261726
dependency: transitive
17271727
description:

0 commit comments

Comments
 (0)