Skip to content

Commit

Permalink
Various User Interface Enhancements (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkoerber authored Nov 21, 2024
1 parent e223ab7 commit ad5d21c
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 53 deletions.
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.7.0' apply false
id "com.android.application" version '8.7.2' apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "2.0.21" apply false
id "com.google.gms.google-services" version "4.4.2" apply false
Expand Down
1 change: 1 addition & 0 deletions assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"openingHours": "Öffnungszeiten",
"open": "{} offen von {} - {}",
"closed": "Geschlossen",
"currentlyClosed": "Aktuell geschlossen",
"closedOn": "{} geschlossen",
"closedToday": "Heute geschlossen",
"submitFeedback": "Feedback einreichen",
Expand Down
5 changes: 3 additions & 2 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"roomDetails": "Room Details",
"building": "Building",
"nFreeRooms": {
"zero": "no free rooms",
"zero": "No free rooms",
"one": "1 free room",
"other": "{} free rooms"
},
Expand Down Expand Up @@ -139,8 +139,9 @@
"openingHours": "Opening Hours",
"open": "Open {} from {} - {}",
"closed": "Closed",
"currentlyClosed": "Currently closed",
"closedOn": "Closed on {}",
"closedToday": "Closed Today",
"closedToday": "Closed today",
"submitFeedback": "Submit Feedback",
"name": "Name",
"message": "Message",
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ PODS:
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (11.5.0)
- Flutter (1.0.0)
- flutter_native_splash (0.0.1):
- flutter_native_splash (2.4.3):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
Expand Down Expand Up @@ -249,7 +249,7 @@ SPEC CHECKSUMS:
FirebaseSessions: 3f56f177d9e53a85021d16b31f9a111849d1dd8b
FirebaseSharedSwift: 302ac5967857ad7e7388b15382d705b8c8d892aa
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778
flutter_native_splash: e8a1e01082d97a8099d973f919f57904c925008a
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
geolocator_apple: 9bcea1918ff7f0062d98345d238ae12718acfbc1
Google-Maps-iOS-Utils: 66d6de12be1ce6d3742a54661e7a79cb317a9321
Expand Down
16 changes: 14 additions & 2 deletions lib/placesComponent/model/studyRooms/study_room_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,28 @@ class StudyRoomGroup extends Searchable {
@JsonKey(name: "opening_hours", readValue: readListValue)
final List<StudyRoomOpeningHours> openingHours;

List<String>? get openToday {
(String, String)? get openToday {
final currentDay = DateTime.now().weekday;
for (var openingHour in openingHours) {
if (openingHour.days.contains(currentDay)) {
return [openingHour.startString, openingHour.endString];
return (openingHour.startString, openingHour.endString);
}
}
return null;
}

bool get isOpen {
final now = DateTime.now();
final currentDay = now.weekday;
for (var openingHour in openingHours) {
if (openingHour.days.contains(currentDay)) {
return now.hour >= openingHour.startTime &&
now.hour <= openingHour.endTime;
}
}
return false;
}

LatLng? get coordinate {
switch (id) {
case 44:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class StudyRoomOpeningHours {

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

int get startTime => int.parse(start.substring(0, 2));

int get endTime => int.parse(end.substring(0, 2));

StudyRoomOpeningHours({
required this.daysString,
required this.daysBitMask,
Expand Down
17 changes: 12 additions & 5 deletions lib/placesComponent/views/homeWidget/study_room_widget_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,17 @@ class _StudyRoomWidgetViewState extends ConsumerState<StudyRoomWidgetView> {
}

Widget _freeRooms(StudyRoomGroup studyRoomGroup) {
final freeRooms = ref.read(studyRoomsViewModel).freeRooms(studyRoomGroup);
return Text(
context.plural("nFreeRooms", freeRooms),
style: TextStyle(color: freeRooms > 0 ? Colors.green : Colors.red),
);
if (studyRoomGroup.isOpen) {
final freeRooms = ref.read(studyRoomsViewModel).freeRooms(studyRoomGroup);
return Text(
context.plural("nFreeRooms", freeRooms),
style: TextStyle(color: freeRooms > 0 ? Colors.green : Colors.red),
);
} else {
return Text(
context.tr("currentlyClosed"),
style: TextStyle(color: Colors.red),
);
}
}
}
21 changes: 11 additions & 10 deletions lib/placesComponent/views/places_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:campus_flutter/base/enums/device.dart';
import 'package:campus_flutter/base/services/device_type_service.dart';
import 'package:campus_flutter/base/util/padded_divider.dart';
import 'package:campus_flutter/base/routing/routes.dart';
import 'package:campus_flutter/placesComponent/viewModels/places_viewmodel.dart';
Expand All @@ -13,15 +15,11 @@ class PlacesView extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
return OrientationBuilder(
builder: (context, orientation) {
if (orientation == Orientation.landscape) {
return _landscapeOrientation(context, ref);
} else {
return _portraitOrientation(context, ref);
}
},
);
if (DeviceService.getType(context) == Device.phone) {
return _portraitOrientation(context, ref);
} else {
return _landscapeOrientation(context, ref);
}
}

Widget _landscapeOrientation(BuildContext context, WidgetRef ref) {
Expand Down Expand Up @@ -58,7 +56,10 @@ class PlacesView extends ConsumerWidget {
const PaddedDivider(),
Expanded(
child: GridView.count(
crossAxisCount: 3,
crossAxisCount:
DeviceService.getType(context) == Device.landscapeTablet
? 3
: 2,
childAspectRatio: 1.5,
mainAxisSpacing: context.padding,
crossAxisSpacing: context.padding,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ class StudyRoomGroupView extends ConsumerWidget {
studyRoomGroup?.openToday != null
? context.tr(
"open",
args: [context.tr("today"), ...studyRoomGroup!.openToday!],
args: [
context.tr("today").toLowerCase(),
studyRoomGroup!.openToday!.$1,
studyRoomGroup!.openToday!.$2,
],
)
: context.tr("closedToday"),
),
Expand Down
60 changes: 30 additions & 30 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ packages:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a
url: "https://pub.dev"
source: hosted
version: "1.3.1"
version: "1.4.0"
checked_yaml:
dependency: transitive
description:
Expand Down Expand Up @@ -494,10 +494,10 @@ packages:
dependency: "direct main"
description:
name: flutter_native_splash
sha256: ee5c9bd2b74ea8676442fd4ab876b5d41681df49276488854d6c81a5377c0ef1
sha256: "1152ab0067ca5a2ebeb862fe0a762057202cceb22b7e62692dcbabf6483891bb"
url: "https://pub.dev"
source: hosted
version: "2.4.2"
version: "2.4.3"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
Expand Down Expand Up @@ -574,10 +574,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: "578bd8c508144fdaffd4f77b8ef2d8c523602275cd697cc3db284dbd762ef4ce"
sha256: "936d9c1c010d3e234d1672574636f3352b4941ca3decaddd3cafaeb9ad49c471"
url: "https://pub.dev"
source: hosted
version: "2.0.14"
version: "2.0.15"
flutter_test:
dependency: "direct dev"
description: flutter
Expand All @@ -600,10 +600,10 @@ packages:
dependency: "direct main"
description:
name: geolocator
sha256: "0ec58b731776bc43097fcf751f79681b6a8f6d3bc737c94779fe9f1ad73c1a81"
sha256: d2ec66329cab29cb297d51d96c067d457ca519dca8589665fa0b82ebacb7dbe4
url: "https://pub.dev"
source: hosted
version: "13.0.1"
version: "13.0.2"
geolocator_android:
dependency: transitive
description:
Expand All @@ -616,10 +616,10 @@ packages:
dependency: transitive
description:
name: geolocator_apple
sha256: f47bca50d7f564bc342aac311a050ea0de7d0b6b7bbcf3948b22b1b61874ebd3
sha256: "6154ea2682563f69fc0125762ed7e91e7ed85d0b9776595653be33918e064807"
url: "https://pub.dev"
source: hosted
version: "2.3.8"
version: "2.3.8+1"
geolocator_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -672,10 +672,10 @@ packages:
dependency: transitive
description:
name: google_identity_services_web
sha256: "304e2a4c25d84c287df6d7ebf5b93d8bbd4ceb817d96c2686d44f6a346f227b6"
sha256: "55580f436822d64c8ff9a77e37d61f5fb1e6c7ec9d632a43ee324e2a05c3c6c9"
url: "https://pub.dev"
source: hosted
version: "0.3.1+5"
version: "0.3.3"
google_maps:
dependency: transitive
description:
Expand All @@ -688,10 +688,10 @@ packages:
dependency: "direct main"
description:
name: google_maps_flutter
sha256: "2e302fa3aaf4e2a297f0342d83ebc5e8e9f826e9a716aef473fe7f404ec630a7"
sha256: "209856c8e5571626afba7182cf634b2910069dc567954e76ec3e3fb37f5e9db3"
url: "https://pub.dev"
source: hosted
version: "2.9.0"
version: "2.10.0"
google_maps_flutter_android:
dependency: transitive
description:
Expand Down Expand Up @@ -841,10 +841,10 @@ packages:
dependency: "direct main"
description:
name: json_serializable
sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b
sha256: c2fcb3920cf2b6ae6845954186420fca40bc0a8abcc84903b7801f17d7050d7c
url: "https://pub.dev"
source: hosted
version: "6.8.0"
version: "6.9.0"
leak_tracker:
dependency: transitive
description:
Expand Down Expand Up @@ -1081,10 +1081,10 @@ packages:
dependency: transitive
description:
name: permission_handler_html
sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
url: "https://pub.dev"
source: hosted
version: "0.1.3+2"
version: "0.1.3+5"
permission_handler_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -1486,34 +1486,34 @@ packages:
dependency: "direct main"
description:
name: syncfusion_flutter_calendar
sha256: "769d3bbf8743922d74b242a968366661bd7b2973b3d34af9b9bc865874a520d9"
sha256: "00703dd2e154ad534e7e898958f1e4c1573b15a19448c0b183365f4b9779f054"
url: "https://pub.dev"
source: hosted
version: "27.1.58"
version: "27.2.2"
syncfusion_flutter_charts:
dependency: "direct main"
description:
name: syncfusion_flutter_charts
sha256: e97025be6a68d358463dcf0a83b3c600c52e14574c754b331aac5d1cbb86c759
sha256: f14547b70ad0a662d1f65e8fb79b7178b0dea439d3fc9cb13da8aa4714fecb96
url: "https://pub.dev"
source: hosted
version: "27.1.58"
version: "27.2.2"
syncfusion_flutter_core:
dependency: "direct main"
description:
name: syncfusion_flutter_core
sha256: "31d2ddf410ee41abb3ecf85b7b6e8e1563307ad52ee784ddd91337e30280f715"
sha256: "225b1cc135549bb4eef096d63b7323c30ee61c4b095c7e8a14bf9333e243d84b"
url: "https://pub.dev"
source: hosted
version: "27.1.58"
version: "27.2.2"
syncfusion_flutter_datepicker:
dependency: "direct main"
description:
name: syncfusion_flutter_datepicker
sha256: e25797401bec43cd64c475150f87150e8bc3e67212d4d1273ff35483ea793a8b
sha256: e2e2a97b033390f0791316c6019743991aa598563d09f603ba13230cd50b8905
url: "https://pub.dev"
source: hosted
version: "27.1.58"
version: "27.2.2"
synchronized:
dependency: transitive
description:
Expand Down Expand Up @@ -1670,10 +1670,10 @@ packages:
dependency: transitive
description:
name: vector_graphics
sha256: "773c9522d66d523e1c7b25dfb95cc91c26a1e17b107039cfe147285e92de7878"
sha256: "27d5fefe86fb9aace4a9f8375b56b3c292b64d8c04510df230f849850d912cb7"
url: "https://pub.dev"
source: hosted
version: "1.1.14"
version: "1.1.15"
vector_graphics_codec:
dependency: transitive
description:
Expand Down Expand Up @@ -1718,10 +1718,10 @@ packages:
dependency: transitive
description:
name: video_player_avfoundation
sha256: cd5ab8a8bc0eab65ab0cea40304097edc46da574c8c1ecdee96f28cd8ef3792f
sha256: "0b146e5d82e886ff43e5a46c6bcbe390761b802864a6e2503eb612d69a405dfa"
url: "https://pub.dev"
source: hosted
version: "2.6.2"
version: "2.6.3"
video_player_platform_interface:
dependency: transitive
description:
Expand Down

0 comments on commit ad5d21c

Please sign in to comment.