From 8ecf09458e2f385ca15b7e953f35f86c832577d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:19:16 +0100 Subject: [PATCH 1/9] Bump Dependencies --- android/settings.gradle | 2 +- ios/Podfile.lock | 24 ++++++------- pubspec.lock | 76 ++++++++++++++++++++--------------------- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/android/settings.gradle b/android/settings.gradle index 1754b6d0..c6c09f05 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -20,7 +20,7 @@ plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version '8.6.1' apply false id "org.jetbrains.kotlin.android" version "1.9.20" apply false - id "org.jetbrains.kotlin.plugin.serialization" version "2.0.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 id "com.google.firebase.crashlytics" version "3.0.2" apply false } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index fc0ffc13..b6f31d9b 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -28,7 +28,7 @@ PODS: - GoogleUtilities/Logger (~> 8.0) - FirebaseCoreExtension (11.4.1): - FirebaseCore (~> 11.0) - - FirebaseCoreInternal (11.4.0): + - FirebaseCoreInternal (11.4.2): - "GoogleUtilities/NSData+zlib (~> 8.0)" - FirebaseCrashlytics (11.2.0): - FirebaseCore (~> 11.0) @@ -122,20 +122,20 @@ PODS: - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS - - "sqlite3 (3.46.1+1)": - - "sqlite3/common (= 3.46.1+1)" - - "sqlite3/common (3.46.1+1)" - - "sqlite3/dbstatvtab (3.46.1+1)": + - sqlite3 (3.47.0): + - sqlite3/common (= 3.47.0) + - sqlite3/common (3.47.0) + - sqlite3/dbstatvtab (3.47.0): - sqlite3/common - - "sqlite3/fts5 (3.46.1+1)": + - sqlite3/fts5 (3.47.0): - sqlite3/common - - "sqlite3/perf-threadsafe (3.46.1+1)": + - sqlite3/perf-threadsafe (3.47.0): - sqlite3/common - - "sqlite3/rtree (3.46.1+1)": + - sqlite3/rtree (3.47.0): - sqlite3/common - sqlite3_flutter_libs (0.0.1): - Flutter - - "sqlite3 (~> 3.46.0+1)" + - sqlite3 (~> 3.47.0) - sqlite3/dbstatvtab - sqlite3/fts5 - sqlite3/perf-threadsafe @@ -241,7 +241,7 @@ SPEC CHECKSUMS: FirebaseABTesting: aef1719704fade00b200827e7973f352efc4caee FirebaseCore: a282032ae9295c795714ded2ec9c522fc237f8da FirebaseCoreExtension: f1bc67a4702931a7caa097d8e4ac0a1b0d16720e - FirebaseCoreInternal: 5c2b016f06a96fbf20d9b443459f80427a827d7b + FirebaseCoreInternal: 35731192cab10797b88411be84940d2beb33a238 FirebaseCrashlytics: cfc69af5b53565dc6a5e563788809b5778ac4eac FirebaseInstallations: 6ef4a1c7eb2a61ee1f74727d7f6ce2e72acf1414 FirebaseRemoteConfig: fca0b2d017fc1de52b28a4e5bcf2007c1a840457 @@ -268,8 +268,8 @@ SPEC CHECKSUMS: quick_actions_ios: 56f3cbaa71e94f212838d1f9fe354bd0734779bf shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13 - sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb - sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b + sqlite3: 0aa20658a9b238a3b1ff7175eb7bdd863b0ab4fd + sqlite3_flutter_libs: b55ef23cfafea5318ae5081e0bf3fbbce8417c94 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 diff --git a/pubspec.lock b/pubspec.lock index c5eafa6a..3acdeaf4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -218,10 +218,10 @@ packages: dependency: transitive description: name: cli_util - sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c url: "https://pub.dev" source: hosted - version: "0.4.1" + version: "0.4.2" clock: dependency: transitive description: @@ -234,10 +234,10 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.10.1" collection: dependency: "direct main" description: @@ -274,10 +274,10 @@ packages: dependency: transitive description: name: csslib - sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.2" dart_style: dependency: transitive description: @@ -330,10 +330,10 @@ packages: dependency: "direct dev" description: name: drift_dev - sha256: "27bab15e7869b69259663590381180117873b9b273a1ea9ebb21bb73133d1233" + sha256: "623649abe932fc17bd32e578e7e05f7ac5e7dd0b33e6c8669a0634105d1389bf" url: "https://pub.dev" source: hosted - version: "2.21.0" + version: "2.21.2" easy_localization: dependency: "direct main" description: @@ -648,10 +648,10 @@ packages: dependency: "direct main" description: name: get_it - sha256: "35c253f83f9e03cbac65ffa159510e41ae15f49b37291ab8c522d7a0b6f330cd" + sha256: c49895c1ecb0ee2a0ec568d39de882e2c299ba26355aa6744ab1001f98cebd15 url: "https://pub.dev" source: hosted - version: "8.0.1" + version: "8.0.2" glob: dependency: transitive description: @@ -761,10 +761,10 @@ packages: dependency: "direct main" description: name: html - sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" url: "https://pub.dev" source: hosted - version: "0.15.4" + version: "0.15.5" http: dependency: transitive description: @@ -1001,18 +1001,18 @@ packages: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + sha256: "45f7d6bba1128761de5540f39d5ca000ea8a1f22f06b76b61094a60a2997bd0e" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" path_provider: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.5" path_provider_android: dependency: transitive description: @@ -1430,18 +1430,18 @@ packages: dependency: "direct main" description: name: sqlite3_flutter_libs - sha256: ccd29dd6cf6fb9351fa07cd6f92895809adbf0779c1d986acf5e3d53b3250e33 + sha256: "7ae52b23366e5295005022e62fa093f64bfe190810223ea0ebf733a4cd140bce" url: "https://pub.dev" source: hosted - version: "0.5.25" + version: "0.5.26" sqlparser: dependency: transitive description: name: sqlparser - sha256: c5f63dff8677407ddcddfa4744c176ea6dc44286c47ba9e69e76d8071398034d + sha256: d77749237609784e337ec36c979d41f6f38a7b279df98622ae23929c8eb954a4 url: "https://pub.dev" source: hosted - version: "0.39.1" + version: "0.39.2" stack_trace: dependency: transitive description: @@ -1486,34 +1486,34 @@ packages: dependency: "direct main" description: name: syncfusion_flutter_calendar - sha256: "1fdbcb8435abc4a1fb36914b83d9690eb0dea617df3ac2772519fba7a3011828" + sha256: "4a8e40552fc9b7c669d2f671f6cbfdbdade35d99d250b87b37950a8033671c24" url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.57" syncfusion_flutter_charts: dependency: "direct main" description: name: syncfusion_flutter_charts - sha256: ec08668a7b3c95075aee32f6d73b7a053c6f1361de1e85f88a433d63f835beed + sha256: "977a6bbf67b542e8b59566b9963f1c3c270feae7737f9c85891c3ad81a40dd53" url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.57" syncfusion_flutter_core: dependency: "direct main" description: name: syncfusion_flutter_core - sha256: bc86234c9a0a87b6c3288b9065175e74e9a73e22b2237989a8bbdeff0c8befd7 + sha256: "6a2445aef2adc77136aedaf8b0c1b7f22c43b43d7036f219414db9acd679570a" url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.57" syncfusion_flutter_datepicker: dependency: "direct main" description: name: syncfusion_flutter_datepicker - sha256: "54fe7e7a660ecdf072cceec890425d7531b42f647245f9244565c61e96fbca4a" + sha256: "69ed9fd90279024284083373120217e713bb0685cd248d84416edc061e73c273" url: "https://pub.dev" source: hosted - version: "27.1.55" + version: "27.1.57" synchronized: dependency: transitive description: @@ -1606,10 +1606,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "8fc3bae0b68c02c47c5c86fa8bfa74471d42687b0eded01b78de87872db745e2" + sha256: "0dea215895a4d254401730ca0ba8204b29109a34a99fb06ae559a2b60988d2de" url: "https://pub.dev" source: hosted - version: "6.3.12" + version: "6.3.13" url_launcher_ios: dependency: transitive description: @@ -1710,10 +1710,10 @@ packages: dependency: transitive description: name: video_player_android - sha256: "2800d68d6d5b4c22da62453568ed68e63c35bea524d4fa42062e53d6bb591433" + sha256: "391e092ba4abe2f93b3e625bd6b6a6ec7d7414279462c1c0ee42b5ab8d0a0898" url: "https://pub.dev" source: hosted - version: "2.7.13" + version: "2.7.16" video_player_avfoundation: dependency: transitive description: @@ -1734,10 +1734,10 @@ packages: dependency: transitive description: name: video_player_web - sha256: "6dcdd298136523eaf7dfc31abaf0dfba9aa8a8dbc96670e87e9d42b6f2caf774" + sha256: "881b375a934d8ebf868c7fb1423b2bfaa393a0a265fa3f733079a86536064a10" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" vm_service: dependency: transitive description: @@ -1790,10 +1790,10 @@ packages: dependency: transitive description: name: win32 - sha256: e1d0cc62e65dc2561f5071fcbccecf58ff20c344f8f3dc7d4922df372a11df1f + sha256: "10169d3934549017f0ae278ccb07f828f9d6ea21573bab0fb77b0e1ef0fce454" url: "https://pub.dev" source: hosted - version: "5.7.1" + version: "5.7.2" win32_registry: dependency: transitive description: @@ -1823,10 +1823,10 @@ packages: description: path: "." ref: master - resolved-ref: "519915971f5cfcce2fc5ac274c4b711a6bb743e8" + resolved-ref: "6120a04a6e7cc7edecae69fcb9cc966fde4d6f23" url: "https://github.com/jakobkoerber/xml2json.git" source: git - version: "6.2.4" + version: "6.2.5" yaml: dependency: transitive description: From ee71b4d8f02c81e88ccaee54b9a77a81d35a6a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:37:53 +0100 Subject: [PATCH 2/9] Update Proto Files --- .../apis/google/protobuf/empty.pb.dart | 2 + .../apis/google/protobuf/timestamp.pb.dart | 4 +- .../apis/tumdev/campus_backend.pb.dart | 306 ------------------ .../apis/tumdev/campus_backend.pbgrpc.dart | 80 ----- .../apis/tumdev/campus_backend.pbjson.dart | 69 ---- protos/tumdev/campus_backend.proto | 42 +-- 6 files changed, 7 insertions(+), 496 deletions(-) diff --git a/lib/base/networking/apis/google/protobuf/empty.pb.dart b/lib/base/networking/apis/google/protobuf/empty.pb.dart index 05ae77c7..fb65fac9 100644 --- a/lib/base/networking/apis/google/protobuf/empty.pb.dart +++ b/lib/base/networking/apis/google/protobuf/empty.pb.dart @@ -20,6 +20,8 @@ import 'package:protobuf/protobuf.dart' as $pb; /// service Foo { /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); /// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. class Empty extends $pb.GeneratedMessage { factory Empty() => create(); Empty._() : super(); diff --git a/lib/base/networking/apis/google/protobuf/timestamp.pb.dart b/lib/base/networking/apis/google/protobuf/timestamp.pb.dart index ea44b44e..85f80767 100644 --- a/lib/base/networking/apis/google/protobuf/timestamp.pb.dart +++ b/lib/base/networking/apis/google/protobuf/timestamp.pb.dart @@ -65,6 +65,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) /// .setNanos((int) ((millis % 1000) * 1000000)).build(); /// +/// /// Example 5: Compute Timestamp from Java `Instant.now()`. /// /// Instant now = Instant.now(); @@ -73,6 +74,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; /// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) /// .setNanos(now.getNano()).build(); /// +/// /// Example 6: Compute Timestamp from current time in Python. /// /// timestamp = Timestamp() @@ -102,7 +104,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin; /// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with /// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use /// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -/// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() +/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D /// ) to obtain a formatter capable of generating timestamps in this format. class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin { factory Timestamp({ diff --git a/lib/base/networking/apis/tumdev/campus_backend.pb.dart b/lib/base/networking/apis/tumdev/campus_backend.pb.dart index e7f0b15f..e189f087 100644 --- a/lib/base/networking/apis/tumdev/campus_backend.pb.dart +++ b/lib/base/networking/apis/tumdev/campus_backend.pb.dart @@ -3788,56 +3788,6 @@ class GetMemberReply extends $pb.GeneratedMessage { void clearMemberId() => clearField(3); } -class GetUploadStatusRequest extends $pb.GeneratedMessage { - factory GetUploadStatusRequest({ - $core.String? lrzId, - }) { - final $result = create(); - if (lrzId != null) { - $result.lrzId = lrzId; - } - return $result; - } - GetUploadStatusRequest._() : super(); - factory GetUploadStatusRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetUploadStatusRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetUploadStatusRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'lrzId') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetUploadStatusRequest clone() => GetUploadStatusRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetUploadStatusRequest copyWith(void Function(GetUploadStatusRequest) updates) => super.copyWith((message) => updates(message as GetUploadStatusRequest)) as GetUploadStatusRequest; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetUploadStatusRequest create() => GetUploadStatusRequest._(); - GetUploadStatusRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetUploadStatusRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetUploadStatusRequest? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get lrzId => $_getSZ(0); - @$pb.TagNumber(1) - set lrzId($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasLrzId() => $_has(0); - @$pb.TagNumber(1) - void clearLrzId() => clearField(1); -} - class GetUploadStatusReply extends $pb.GeneratedMessage { factory GetUploadStatusReply({ $core.String? fcmToken, @@ -3944,262 +3894,6 @@ class GetUploadStatusReply extends $pb.GeneratedMessage { void clearExternalId() => clearField(5); } -class GetNotificationRequest extends $pb.GeneratedMessage { - factory GetNotificationRequest({ - $core.int? notificationId, - }) { - final $result = create(); - if (notificationId != null) { - $result.notificationId = notificationId; - } - return $result; - } - GetNotificationRequest._() : super(); - factory GetNotificationRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'notificationId', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationRequest clone() => GetNotificationRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationRequest copyWith(void Function(GetNotificationRequest) updates) => super.copyWith((message) => updates(message as GetNotificationRequest)) as GetNotificationRequest; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationRequest create() => GetNotificationRequest._(); - GetNotificationRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationRequest? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get notificationId => $_getIZ(0); - @$pb.TagNumber(1) - set notificationId($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasNotificationId() => $_has(0); - @$pb.TagNumber(1) - void clearNotificationId() => clearField(1); -} - -class GetNotificationReply extends $pb.GeneratedMessage { - factory GetNotificationReply({ - $core.int? notificationId, - $core.int? type, - $core.String? title, - $core.String? description, - $core.String? signature, - }) { - final $result = create(); - if (notificationId != null) { - $result.notificationId = notificationId; - } - if (type != null) { - $result.type = type; - } - if (title != null) { - $result.title = title; - } - if (description != null) { - $result.description = description; - } - if (signature != null) { - $result.signature = signature; - } - return $result; - } - GetNotificationReply._() : super(); - factory GetNotificationReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationReply', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'notificationId', $pb.PbFieldType.O3) - ..a<$core.int>(2, _omitFieldNames ? '' : 'type', $pb.PbFieldType.O3) - ..aOS(3, _omitFieldNames ? '' : 'title') - ..aOS(4, _omitFieldNames ? '' : 'description') - ..aOS(5, _omitFieldNames ? '' : 'signature') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationReply clone() => GetNotificationReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationReply copyWith(void Function(GetNotificationReply) updates) => super.copyWith((message) => updates(message as GetNotificationReply)) as GetNotificationReply; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationReply create() => GetNotificationReply._(); - GetNotificationReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationReply? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get notificationId => $_getIZ(0); - @$pb.TagNumber(1) - set notificationId($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasNotificationId() => $_has(0); - @$pb.TagNumber(1) - void clearNotificationId() => clearField(1); - - @$pb.TagNumber(2) - $core.int get type => $_getIZ(1); - @$pb.TagNumber(2) - set type($core.int v) { $_setSignedInt32(1, v); } - @$pb.TagNumber(2) - $core.bool hasType() => $_has(1); - @$pb.TagNumber(2) - void clearType() => clearField(2); - - @$pb.TagNumber(3) - $core.String get title => $_getSZ(2); - @$pb.TagNumber(3) - set title($core.String v) { $_setString(2, v); } - @$pb.TagNumber(3) - $core.bool hasTitle() => $_has(2); - @$pb.TagNumber(3) - void clearTitle() => clearField(3); - - @$pb.TagNumber(4) - $core.String get description => $_getSZ(3); - @$pb.TagNumber(4) - set description($core.String v) { $_setString(3, v); } - @$pb.TagNumber(4) - $core.bool hasDescription() => $_has(3); - @$pb.TagNumber(4) - void clearDescription() => clearField(4); - - @$pb.TagNumber(5) - $core.String get signature => $_getSZ(4); - @$pb.TagNumber(5) - set signature($core.String v) { $_setString(4, v); } - @$pb.TagNumber(5) - $core.bool hasSignature() => $_has(4); - @$pb.TagNumber(5) - void clearSignature() => clearField(5); -} - -class GetNotificationConfirmRequest extends $pb.GeneratedMessage { - factory GetNotificationConfirmRequest({ - $core.int? notificationId, - }) { - final $result = create(); - if (notificationId != null) { - $result.notificationId = notificationId; - } - return $result; - } - GetNotificationConfirmRequest._() : super(); - factory GetNotificationConfirmRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationConfirmRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationConfirmRequest', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..a<$core.int>(1, _omitFieldNames ? '' : 'notificationId', $pb.PbFieldType.O3) - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmRequest clone() => GetNotificationConfirmRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmRequest copyWith(void Function(GetNotificationConfirmRequest) updates) => super.copyWith((message) => updates(message as GetNotificationConfirmRequest)) as GetNotificationConfirmRequest; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmRequest create() => GetNotificationConfirmRequest._(); - GetNotificationConfirmRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationConfirmRequest? _defaultInstance; - - @$pb.TagNumber(1) - $core.int get notificationId => $_getIZ(0); - @$pb.TagNumber(1) - set notificationId($core.int v) { $_setSignedInt32(0, v); } - @$pb.TagNumber(1) - $core.bool hasNotificationId() => $_has(0); - @$pb.TagNumber(1) - void clearNotificationId() => clearField(1); -} - -class GetNotificationConfirmReply extends $pb.GeneratedMessage { - factory GetNotificationConfirmReply({ - $core.String? status, - }) { - final $result = create(); - if (status != null) { - $result.status = status; - } - return $result; - } - GetNotificationConfirmReply._() : super(); - factory GetNotificationConfirmReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory GetNotificationConfirmReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - - static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'GetNotificationConfirmReply', package: const $pb.PackageName(_omitMessageNames ? '' : 'api'), createEmptyInstance: create) - ..aOS(1, _omitFieldNames ? '' : 'status') - ..hasRequiredFields = false - ; - - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmReply clone() => GetNotificationConfirmReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - GetNotificationConfirmReply copyWith(void Function(GetNotificationConfirmReply) updates) => super.copyWith((message) => updates(message as GetNotificationConfirmReply)) as GetNotificationConfirmReply; - - $pb.BuilderInfo get info_ => _i; - - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmReply create() => GetNotificationConfirmReply._(); - GetNotificationConfirmReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); - @$core.pragma('dart2js:noInline') - static GetNotificationConfirmReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); - static GetNotificationConfirmReply? _defaultInstance; - - @$pb.TagNumber(1) - $core.String get status => $_getSZ(0); - @$pb.TagNumber(1) - set status($core.String v) { $_setString(0, v); } - @$pb.TagNumber(1) - $core.bool hasStatus() => $_has(0); - @$pb.TagNumber(1) - void clearStatus() => clearField(1); -} - class GetCanteenHeadCountRequest extends $pb.GeneratedMessage { factory GetCanteenHeadCountRequest({ $core.String? canteenId, diff --git a/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart b/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart index a806781e..212f77b8 100644 --- a/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart +++ b/lib/base/networking/apis/tumdev/campus_backend.pbgrpc.dart @@ -81,22 +81,6 @@ class CampusClient extends $grpc.Client { '/api.Campus/CreateFeedback', ($0.CreateFeedbackRequest value) => value.writeToBuffer(), ($core.List<$core.int> value) => $0.CreateFeedbackReply.fromBuffer(value)); - static final _$getUploadStatus = $grpc.ClientMethod<$0.GetUploadStatusRequest, $0.GetUploadStatusReply>( - '/api.Campus/GetUploadStatus', - ($0.GetUploadStatusRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetUploadStatusReply.fromBuffer(value)); - static final _$getNotification = $grpc.ClientMethod<$0.GetNotificationRequest, $0.GetNotificationReply>( - '/api.Campus/GetNotification', - ($0.GetNotificationRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetNotificationReply.fromBuffer(value)); - static final _$getNotificationConfirm = $grpc.ClientMethod<$0.GetNotificationConfirmRequest, $0.GetNotificationConfirmReply>( - '/api.Campus/GetNotificationConfirm', - ($0.GetNotificationConfirmRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetNotificationConfirmReply.fromBuffer(value)); - static final _$getMember = $grpc.ClientMethod<$0.GetMemberRequest, $0.GetMemberReply>( - '/api.Campus/GetMember', - ($0.GetMemberRequest value) => value.writeToBuffer(), - ($core.List<$core.int> value) => $0.GetMemberReply.fromBuffer(value)); static final _$getCanteenHeadCount = $grpc.ClientMethod<$0.GetCanteenHeadCountRequest, $0.GetCanteenHeadCountReply>( '/api.Campus/GetCanteenHeadCount', ($0.GetCanteenHeadCountRequest value) => value.writeToBuffer(), @@ -180,22 +164,6 @@ class CampusClient extends $grpc.Client { return $createStreamingCall(_$createFeedback, request, options: options).single; } - $grpc.ResponseFuture<$0.GetUploadStatusReply> getUploadStatus($0.GetUploadStatusRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getUploadStatus, request, options: options); - } - - $grpc.ResponseFuture<$0.GetNotificationReply> getNotification($0.GetNotificationRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getNotification, request, options: options); - } - - $grpc.ResponseFuture<$0.GetNotificationConfirmReply> getNotificationConfirm($0.GetNotificationConfirmRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getNotificationConfirm, request, options: options); - } - - $grpc.ResponseFuture<$0.GetMemberReply> getMember($0.GetMemberRequest request, {$grpc.CallOptions? options}) { - return $createUnaryCall(_$getMember, request, options: options); - } - $grpc.ResponseFuture<$0.GetCanteenHeadCountReply> getCanteenHeadCount($0.GetCanteenHeadCountRequest request, {$grpc.CallOptions? options}) { return $createUnaryCall(_$getCanteenHeadCount, request, options: options); } @@ -323,34 +291,6 @@ abstract class CampusServiceBase extends $grpc.Service { false, ($core.List<$core.int> value) => $0.CreateFeedbackRequest.fromBuffer(value), ($0.CreateFeedbackReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetUploadStatusRequest, $0.GetUploadStatusReply>( - 'GetUploadStatus', - getUploadStatus_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetUploadStatusRequest.fromBuffer(value), - ($0.GetUploadStatusReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetNotificationRequest, $0.GetNotificationReply>( - 'GetNotification', - getNotification_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetNotificationRequest.fromBuffer(value), - ($0.GetNotificationReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetNotificationConfirmRequest, $0.GetNotificationConfirmReply>( - 'GetNotificationConfirm', - getNotificationConfirm_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetNotificationConfirmRequest.fromBuffer(value), - ($0.GetNotificationConfirmReply value) => value.writeToBuffer())); - $addMethod($grpc.ServiceMethod<$0.GetMemberRequest, $0.GetMemberReply>( - 'GetMember', - getMember_Pre, - false, - false, - ($core.List<$core.int> value) => $0.GetMemberRequest.fromBuffer(value), - ($0.GetMemberReply value) => value.writeToBuffer())); $addMethod($grpc.ServiceMethod<$0.GetCanteenHeadCountRequest, $0.GetCanteenHeadCountReply>( 'GetCanteenHeadCount', getCanteenHeadCount_Pre, @@ -437,22 +377,6 @@ abstract class CampusServiceBase extends $grpc.Service { return listMovies(call, await request); } - $async.Future<$0.GetUploadStatusReply> getUploadStatus_Pre($grpc.ServiceCall call, $async.Future<$0.GetUploadStatusRequest> request) async { - return getUploadStatus(call, await request); - } - - $async.Future<$0.GetNotificationReply> getNotification_Pre($grpc.ServiceCall call, $async.Future<$0.GetNotificationRequest> request) async { - return getNotification(call, await request); - } - - $async.Future<$0.GetNotificationConfirmReply> getNotificationConfirm_Pre($grpc.ServiceCall call, $async.Future<$0.GetNotificationConfirmRequest> request) async { - return getNotificationConfirm(call, await request); - } - - $async.Future<$0.GetMemberReply> getMember_Pre($grpc.ServiceCall call, $async.Future<$0.GetMemberRequest> request) async { - return getMember(call, await request); - } - $async.Future<$0.GetCanteenHeadCountReply> getCanteenHeadCount_Pre($grpc.ServiceCall call, $async.Future<$0.GetCanteenHeadCountRequest> request) async { return getCanteenHeadCount(call, await request); } @@ -484,10 +408,6 @@ abstract class CampusServiceBase extends $grpc.Service { $async.Future<$0.GetUpdateNoteReply> getUpdateNote($grpc.ServiceCall call, $0.GetUpdateNoteRequest request); $async.Future<$0.ListMoviesReply> listMovies($grpc.ServiceCall call, $0.ListMoviesRequest request); $async.Future<$0.CreateFeedbackReply> createFeedback($grpc.ServiceCall call, $async.Stream<$0.CreateFeedbackRequest> request); - $async.Future<$0.GetUploadStatusReply> getUploadStatus($grpc.ServiceCall call, $0.GetUploadStatusRequest request); - $async.Future<$0.GetNotificationReply> getNotification($grpc.ServiceCall call, $0.GetNotificationRequest request); - $async.Future<$0.GetNotificationConfirmReply> getNotificationConfirm($grpc.ServiceCall call, $0.GetNotificationConfirmRequest request); - $async.Future<$0.GetMemberReply> getMember($grpc.ServiceCall call, $0.GetMemberRequest request); $async.Future<$0.GetCanteenHeadCountReply> getCanteenHeadCount($grpc.ServiceCall call, $0.GetCanteenHeadCountRequest request); $async.Future<$0.CreateDeviceReply> createDevice($grpc.ServiceCall call, $0.CreateDeviceRequest request); $async.Future<$0.DeleteDeviceReply> deleteDevice($grpc.ServiceCall call, $0.DeleteDeviceRequest request); diff --git a/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart b/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart index cb725b89..efd4245d 100644 --- a/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart +++ b/lib/base/networking/apis/tumdev/campus_backend.pbjson.dart @@ -805,18 +805,6 @@ final $typed_data.Uint8List getMemberReplyDescriptor = $convert.base64Decode( 'Cg5HZXRNZW1iZXJSZXBseRIVCgZscnpfaWQYASABKAlSBWxyeklkEhIKBG5hbWUYAiABKAlSBG' '5hbWUSGwoJbWVtYmVyX2lkGAMgASgFUghtZW1iZXJJZA=='); -@$core.Deprecated('Use getUploadStatusRequestDescriptor instead') -const GetUploadStatusRequest$json = { - '1': 'GetUploadStatusRequest', - '2': [ - {'1': 'lrz_id', '3': 1, '4': 1, '5': 9, '10': 'lrzId'}, - ], -}; - -/// Descriptor for `GetUploadStatusRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getUploadStatusRequestDescriptor = $convert.base64Decode( - 'ChZHZXRVcGxvYWRTdGF0dXNSZXF1ZXN0EhUKBmxyel9pZBgBIAEoCVIFbHJ6SWQ='); - @$core.Deprecated('Use getUploadStatusReplyDescriptor instead') const GetUploadStatusReply$json = { '1': 'GetUploadStatusReply', @@ -836,63 +824,6 @@ final $typed_data.Uint8List getUploadStatusReplyDescriptor = $convert.base64Deco 'SWQSHwoLZW1wbG95ZWVfaWQYBCABKAhSCmVtcGxveWVlSWQSHwoLZXh0ZXJuYWxfaWQYBSABKA' 'hSCmV4dGVybmFsSWQ='); -@$core.Deprecated('Use getNotificationRequestDescriptor instead') -const GetNotificationRequest$json = { - '1': 'GetNotificationRequest', - '2': [ - {'1': 'notification_id', '3': 1, '4': 1, '5': 5, '10': 'notificationId'}, - ], -}; - -/// Descriptor for `GetNotificationRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationRequestDescriptor = $convert.base64Decode( - 'ChZHZXROb3RpZmljYXRpb25SZXF1ZXN0EicKD25vdGlmaWNhdGlvbl9pZBgBIAEoBVIObm90aW' - 'ZpY2F0aW9uSWQ='); - -@$core.Deprecated('Use getNotificationReplyDescriptor instead') -const GetNotificationReply$json = { - '1': 'GetNotificationReply', - '2': [ - {'1': 'notification_id', '3': 1, '4': 1, '5': 5, '10': 'notificationId'}, - {'1': 'type', '3': 2, '4': 1, '5': 5, '10': 'type'}, - {'1': 'title', '3': 3, '4': 1, '5': 9, '10': 'title'}, - {'1': 'description', '3': 4, '4': 1, '5': 9, '10': 'description'}, - {'1': 'signature', '3': 5, '4': 1, '5': 9, '10': 'signature'}, - ], -}; - -/// Descriptor for `GetNotificationReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationReplyDescriptor = $convert.base64Decode( - 'ChRHZXROb3RpZmljYXRpb25SZXBseRInCg9ub3RpZmljYXRpb25faWQYASABKAVSDm5vdGlmaW' - 'NhdGlvbklkEhIKBHR5cGUYAiABKAVSBHR5cGUSFAoFdGl0bGUYAyABKAlSBXRpdGxlEiAKC2Rl' - 'c2NyaXB0aW9uGAQgASgJUgtkZXNjcmlwdGlvbhIcCglzaWduYXR1cmUYBSABKAlSCXNpZ25hdH' - 'VyZQ=='); - -@$core.Deprecated('Use getNotificationConfirmRequestDescriptor instead') -const GetNotificationConfirmRequest$json = { - '1': 'GetNotificationConfirmRequest', - '2': [ - {'1': 'notification_id', '3': 1, '4': 1, '5': 5, '10': 'notificationId'}, - ], -}; - -/// Descriptor for `GetNotificationConfirmRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationConfirmRequestDescriptor = $convert.base64Decode( - 'Ch1HZXROb3RpZmljYXRpb25Db25maXJtUmVxdWVzdBInCg9ub3RpZmljYXRpb25faWQYASABKA' - 'VSDm5vdGlmaWNhdGlvbklk'); - -@$core.Deprecated('Use getNotificationConfirmReplyDescriptor instead') -const GetNotificationConfirmReply$json = { - '1': 'GetNotificationConfirmReply', - '2': [ - {'1': 'status', '3': 1, '4': 1, '5': 9, '10': 'status'}, - ], -}; - -/// Descriptor for `GetNotificationConfirmReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List getNotificationConfirmReplyDescriptor = $convert.base64Decode( - 'ChtHZXROb3RpZmljYXRpb25Db25maXJtUmVwbHkSFgoGc3RhdHVzGAEgASgJUgZzdGF0dXM='); - @$core.Deprecated('Use getCanteenHeadCountRequestDescriptor instead') const GetCanteenHeadCountRequest$json = { '1': 'GetCanteenHeadCountRequest', diff --git a/protos/tumdev/campus_backend.proto b/protos/tumdev/campus_backend.proto index 4ecb265c..2304ff41 100644 --- a/protos/tumdev/campus_backend.proto +++ b/protos/tumdev/campus_backend.proto @@ -114,22 +114,6 @@ service Campus { }; } - rpc GetUploadStatus(GetUploadStatusRequest) returns (GetUploadStatusReply) { - option (google.api.http) = {get: "/device/uploaded/{lrz_id}"}; - } - - rpc GetNotification(GetNotificationRequest) returns (GetNotificationReply) { - option (google.api.http) = {get: "/notifications/{notification_id}"}; - } - - rpc GetNotificationConfirm(GetNotificationConfirmRequest) returns (GetNotificationConfirmReply) { - option (google.api.http) = {get: "/notifications/confirm/{notification_id}"}; - } - - rpc GetMember(GetMemberRequest) returns (GetMemberReply) { - option (google.api.http) = {get: "/members/{lrz_id}"}; - } - rpc GetCanteenHeadCount(GetCanteenHeadCountRequest) returns (GetCanteenHeadCountReply) { option (google.api.http) = {get: "/canteen/headCount/{canteen_id}"}; } @@ -147,9 +131,9 @@ service Campus { option (google.api.http) = {delete: "/device/{device_id}"}; } - // Delete a device from push notifications + // List all avaliable student clubs rpc ListStudentClub(ListStudentClubRequest) returns (ListStudentClubReply) { - option (google.api.http) = {delete: "/student_clubs"}; + option (google.api.http) = {get: "/student_clubs"}; } } @@ -519,10 +503,6 @@ message GetMemberReply { int32 member_id = 3; } -message GetUploadStatusRequest { - string lrz_id = 1; -} - message GetUploadStatusReply { string fcm_token = 1; string public_key = 2; @@ -531,24 +511,6 @@ message GetUploadStatusReply { bool external_id = 5; } -message GetNotificationRequest { - int32 notification_id = 1; -} -message GetNotificationReply { - int32 notification_id = 1; - int32 type = 2; - string title = 3; - string description = 4; - string signature = 5; -} - -message GetNotificationConfirmRequest { - int32 notification_id = 1; -} -message GetNotificationConfirmReply { - string status = 1; -} - message GetCanteenHeadCountRequest { // The requested canteen ID string canteen_id = 1; From 6f84a14f3b64d57654f3e35238929b5739921a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:13:19 +0100 Subject: [PATCH 3/9] Transition Movies from Carousel to Widget --- lib/campusComponent/screen/movie_screen.dart | 12 ++--- .../view/movie/movie_card_view.dart | 27 ++++------- .../view/movie/movie_grid_view.dart | 33 +++++++++++++ .../view/movie/movies_widget_view.dart | 46 ++++++++----------- 4 files changed, 65 insertions(+), 53 deletions(-) create mode 100644 lib/campusComponent/view/movie/movie_grid_view.dart diff --git a/lib/campusComponent/screen/movie_screen.dart b/lib/campusComponent/screen/movie_screen.dart index c36e0244..a8fd519e 100644 --- a/lib/campusComponent/screen/movie_screen.dart +++ b/lib/campusComponent/screen/movie_screen.dart @@ -5,7 +5,7 @@ import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/services/device_type_service.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/util/url_launcher.dart'; -import 'package:campus_flutter/campusComponent/view/movie/movie_card_view.dart'; +import 'package:campus_flutter/campusComponent/view/movie/movie_grid_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/movies_viewmodel.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -34,15 +34,11 @@ class MovieScreen extends ConsumerWidget { ), body: () { if (snapshot.hasData) { - return GridView.count( + return MovieGridView( + movies: snapshot.data!, padding: EdgeInsets.all(context.padding), crossAxisCount: crossAxisCount(context), - mainAxisSpacing: context.padding, - crossAxisSpacing: context.padding, - childAspectRatio: 250 / 470, - children: [ - for (var movie in snapshot.data!) MovieCardView(movie: movie), - ], + withinScrollView: false, ); } else if (snapshot.hasError) { return Center( diff --git a/lib/campusComponent/view/movie/movie_card_view.dart b/lib/campusComponent/view/movie/movie_card_view.dart index cbd66c76..44946544 100644 --- a/lib/campusComponent/view/movie/movie_card_view.dart +++ b/lib/campusComponent/view/movie/movie_card_view.dart @@ -7,36 +7,25 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; class MovieCardView extends ConsumerWidget { - const MovieCardView({ - super.key, - required this.movie, - this.isCarousel = false, - }); + const MovieCardView({super.key, required this.movie}); final Movie movie; - final bool isCarousel; @override Widget build(BuildContext context, WidgetRef ref) { - if (isCarousel) { - return body(context); - } else { - return InkWell( - onTap: () { - UrlLauncher.urlString(movie.additionalInformationUrl, ref); - }, - child: body(context), - ); - } + return InkWell( + onTap: () { + UrlLauncher.urlString(movie.additionalInformationUrl, ref); + }, + child: body(context), + ); } Widget body(BuildContext context) { return Container( decoration: BoxDecoration( color: Theme.of(context).cardTheme.color, - borderRadius: isCarousel - ? BorderRadius.zero - : const BorderRadius.all(Radius.circular(12)), + borderRadius: const BorderRadius.all(Radius.circular(12)), ), clipBehavior: Clip.antiAlias, child: AspectRatio( diff --git a/lib/campusComponent/view/movie/movie_grid_view.dart b/lib/campusComponent/view/movie/movie_grid_view.dart new file mode 100644 index 00000000..24125913 --- /dev/null +++ b/lib/campusComponent/view/movie/movie_grid_view.dart @@ -0,0 +1,33 @@ +import 'package:campus_flutter/base/extensions/context.dart'; +import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pb.dart'; +import 'package:campus_flutter/campusComponent/view/movie/movie_card_view.dart'; +import 'package:flutter/material.dart'; + +class MovieGridView extends StatelessWidget { + const MovieGridView({ + super.key, + required this.movies, + required this.padding, + required this.crossAxisCount, + required this.withinScrollView, + }); + + final List movies; + final EdgeInsets padding; + final int crossAxisCount; + final bool withinScrollView; + + @override + Widget build(BuildContext context) { + return GridView.count( + shrinkWrap: withinScrollView, + physics: withinScrollView ? NeverScrollableScrollPhysics() : null, + padding: padding, + crossAxisCount: crossAxisCount, + mainAxisSpacing: context.padding, + crossAxisSpacing: context.padding, + childAspectRatio: 250 / 470, + children: [for (var movie in movies) MovieCardView(movie: movie)], + ); + } +} diff --git a/lib/campusComponent/view/movie/movies_widget_view.dart b/lib/campusComponent/view/movie/movies_widget_view.dart index 84c110f0..5e8c902a 100644 --- a/lib/campusComponent/view/movie/movies_widget_view.dart +++ b/lib/campusComponent/view/movie/movies_widget_view.dart @@ -1,9 +1,10 @@ import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; +import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pbgrpc.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; -import 'package:campus_flutter/base/util/url_launcher.dart'; +import 'package:campus_flutter/campusComponent/view/movie/movie_grid_view.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/movies_viewmodel.dart'; import 'package:campus_flutter/campusComponent/view/movie/movie_card_view.dart'; @@ -65,32 +66,25 @@ class _MoviesHomeWidgetState extends ConsumerState { Widget body(AsyncSnapshot?> snapshot) { if (snapshot.hasData) { - final height = MediaQuery.of(context).size.height * 0.34; - final width = height * 250 / 470; - return SizedBox( - height: height, - child: Padding( - padding: const EdgeInsets.only(left: 11), - child: CarouselView( - itemExtent: width, - shrinkExtent: width, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - children: [ - for (var data in snapshot.data!) - MovieCardView( - movie: data, - isCarousel: true, - ), - ], - onTap: (index) => UrlLauncher.urlString( - snapshot.data![index].additionalInformationUrl, - ref, - ), - ), - ), + return MovieGridView( + movies: snapshot.data!.take(4).toList(), + padding: EdgeInsets.symmetric(horizontal: context.padding), + crossAxisCount: 2, + withinScrollView: true, ); + /*return GridView.count( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: context.padding), + crossAxisCount: 2, + mainAxisSpacing: context.padding, + crossAxisSpacing: context.padding, + childAspectRatio: 250 / 470, + children: [ + for (var data in snapshot.data!.take(4).toList()) + MovieCardView(movie: data), + ], + );*/ } else if (snapshot.hasError) { return SizedBox( height: MediaQuery.of(context).size.height * 0.34, From 2910f1560b23c85e51f03d0a3cd251e4a69d0928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:13:26 +0100 Subject: [PATCH 4/9] Transition Student Clubs from Carousel to Widget --- .../screen/student_clubs_screen.dart | 36 ++-------- ..._view.dart => student_club_card_view.dart} | 19 ++--- .../studentClub/student_club_grid_view.dart | 35 +++++++++ .../studentClub/student_club_widget_view.dart | 72 ++++++++----------- .../viewmodel/student_club_viewmodel.dart | 2 +- 5 files changed, 78 insertions(+), 86 deletions(-) rename lib/campusComponent/view/studentClub/{student_club_item_view.dart => student_club_card_view.dart} (88%) create mode 100644 lib/campusComponent/view/studentClub/student_club_grid_view.dart diff --git a/lib/campusComponent/screen/student_clubs_screen.dart b/lib/campusComponent/screen/student_clubs_screen.dart index 7bee7b72..5575da6a 100644 --- a/lib/campusComponent/screen/student_clubs_screen.dart +++ b/lib/campusComponent/screen/student_clubs_screen.dart @@ -1,12 +1,13 @@ import 'package:campus_flutter/base/enums/device.dart'; import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; +import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pb.dart'; import 'package:campus_flutter/base/services/device_type_service.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/util/url_launcher.dart'; import 'package:campus_flutter/campusComponent/model/student_club_collection.dart'; -import 'package:campus_flutter/campusComponent/view/studentClub/student_club_item_view.dart'; +import 'package:campus_flutter/campusComponent/view/studentClub/student_club_grid_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/student_club_viewmodel.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; @@ -48,34 +49,11 @@ class StudentClubsScreen extends ConsumerWidget { return TabBarView( children: [ for (var collection in snapshot.data!) - Padding( - padding: const EdgeInsets.only( - top: 15, - left: 11, - right: 11, - ), - child: GridView.count( - crossAxisCount: crossAxisCount(context), - children: [ - for (var studentClub in collection.clubs) - Padding( - padding: const EdgeInsets.all(4.0), - child: Container( - decoration: const ShapeDecoration( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all( - Radius.circular(28.0), - ), - ), - ), - clipBehavior: Clip.antiAlias, - child: StudentClubItemView( - studentClub: studentClub, - ), - ), - ), - ], - ), + StudentClubGridView( + studentClubs: collection.clubs, + padding: EdgeInsets.all(context.padding), + crossAxisCount: crossAxisCount(context), + withinScrollView: false, ), ], ); diff --git a/lib/campusComponent/view/studentClub/student_club_item_view.dart b/lib/campusComponent/view/studentClub/student_club_card_view.dart similarity index 88% rename from lib/campusComponent/view/studentClub/student_club_item_view.dart rename to lib/campusComponent/view/studentClub/student_club_card_view.dart index bdbec597..a2e930e7 100644 --- a/lib/campusComponent/view/studentClub/student_club_item_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_card_view.dart @@ -6,31 +6,26 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -class StudentClubItemView extends ConsumerWidget { - const StudentClubItemView({ +class StudentClubCardView extends ConsumerWidget { + const StudentClubCardView({ super.key, - required this.studentClub, - this.isCarousel = false, + required this.studentClub }); final StudentClub studentClub; - final bool isCarousel; @override Widget build(BuildContext context, WidgetRef ref) { - if (isCarousel) { - return body(context); - } else { - return InkWell( + return InkWell( onTap: () => UrlLauncher.urlString(studentClub.linkUrl, ref), child: body(context), ); - } } Widget body(BuildContext context) { - return Container( - color: Theme.of(context).cardTheme.color, + return Card( + margin: EdgeInsets.zero, + clipBehavior: Clip.hardEdge, child: Column( children: [ if (studentClub.coverUrl.contains("svg")) diff --git a/lib/campusComponent/view/studentClub/student_club_grid_view.dart b/lib/campusComponent/view/studentClub/student_club_grid_view.dart new file mode 100644 index 00000000..d74df898 --- /dev/null +++ b/lib/campusComponent/view/studentClub/student_club_grid_view.dart @@ -0,0 +1,35 @@ +import 'package:campus_flutter/base/extensions/context.dart'; +import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pb.dart'; +import 'package:campus_flutter/campusComponent/view/studentClub/student_club_item_view.dart'; +import 'package:flutter/material.dart'; + +class StudentClubGridView extends StatelessWidget { + const StudentClubGridView({ + super.key, + required this.studentClubs, + required this.padding, + required this.crossAxisCount, + required this.withinScrollView, + }); + + final List studentClubs; + final EdgeInsets padding; + final int crossAxisCount; + final bool withinScrollView; + + @override + Widget build(BuildContext context) { + return GridView.count( + shrinkWrap: withinScrollView, + physics: withinScrollView ? NeverScrollableScrollPhysics() : null, + padding: padding, + mainAxisSpacing: context.padding, + crossAxisSpacing: context.padding, + crossAxisCount: crossAxisCount, + children: [ + for (var studentClub in studentClubs) + StudentClubCardView(studentClub: studentClub), + ], + ); + } +} diff --git a/lib/campusComponent/view/studentClub/student_club_widget_view.dart b/lib/campusComponent/view/studentClub/student_club_widget_view.dart index 3598b4e2..9fac56fe 100644 --- a/lib/campusComponent/view/studentClub/student_club_widget_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_widget_view.dart @@ -1,8 +1,11 @@ import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; +import 'package:campus_flutter/base/errorHandling/error_handling_view.dart'; +import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/util/url_launcher.dart'; +import 'package:campus_flutter/campusComponent/view/studentClub/student_club_grid_view.dart'; import 'package:campus_flutter/campusComponent/view/studentClub/student_club_item_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/student_club_viewmodel.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; @@ -24,7 +27,6 @@ class _StudentClubWidgetViewState extends ConsumerState { @override void didChangeDependencies() { ref.read(studentClubViewModel).fetchStudentClubs(false, context); - ref.read(movieViewModel).fetch(false); super.didChangeDependencies(); } @@ -51,49 +53,31 @@ class _StudentClubWidgetViewState extends ConsumerState { ), ], ), - child: SizedBox( - height: 200, - child: StreamBuilder( - stream: ref.watch(studentClubViewModel).suggestions, - builder: (context, snapshot) { - if (snapshot.hasData) { - return Padding( - padding: const EdgeInsets.only(left: 11), - child: CarouselView( - itemExtent: 200, - shrinkExtent: 200, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - children: [ - for (var studentClub in snapshot.data!) - StudentClubItemView( - studentClub: studentClub, - isCarousel: true, - ), - ], - onTap: (index) => UrlLauncher.urlString( - snapshot.data![index].linkUrl, - ref, - ), - ), - ); - } else if (snapshot.hasError) { - return Card( - child: ErrorHandlingRouter( - error: Error(), - errorHandlingViewType: ErrorHandlingViewType.textOnly, - ), - ); - } else { - return const Card( - child: DelayedLoadingIndicator( - name: "Student Clubs", - ), - ); - } - }, - ), + child: StreamBuilder( + stream: ref.watch(studentClubViewModel).suggestions, + builder: (context, snapshot) { + if (snapshot.hasData) { + return StudentClubGridView( + studentClubs: snapshot.data!, + padding: EdgeInsets.symmetric(horizontal: context.padding), + crossAxisCount: 2, + withinScrollView: true, + ); + } else if (snapshot.hasError) { + return Card( + child: ErrorHandlingRouter( + error: Error(), + errorHandlingViewType: ErrorHandlingViewType.textOnly, + ), + ); + } else { + return const Card( + child: DelayedLoadingIndicator( + name: "Student Clubs", + ), + ); + } + }, ), ); } diff --git a/lib/campusComponent/viewmodel/student_club_viewmodel.dart b/lib/campusComponent/viewmodel/student_club_viewmodel.dart index 26429a8a..570a4695 100644 --- a/lib/campusComponent/viewmodel/student_club_viewmodel.dart +++ b/lib/campusComponent/viewmodel/student_club_viewmodel.dart @@ -24,7 +24,7 @@ class StudentClubViewModel { final studentClubs = value.$2.expand((e) => e.clubs).toList(); studentClubs.removeWhere((studentClub) => studentClub.coverUrl.isEmpty); studentClubs.shuffle(); - suggestions.add(studentClubs.take(5).toList()); + suggestions.add(studentClubs.take(6).toList()); }, onError: (error) { collections.addError(error); From 284ca9ab35998ca8f5c1a183d1c563b205ea4555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 30 Oct 2024 22:16:34 +0100 Subject: [PATCH 5/9] Fix Build Errors and Formatting --- lib/campusComponent/view/movie/movies_widget_view.dart | 1 - .../view/studentClub/student_club_card_view.dart | 8 ++++---- .../view/studentClub/student_club_grid_view.dart | 2 +- .../view/studentClub/student_club_widget_view.dart | 4 ---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/campusComponent/view/movie/movies_widget_view.dart b/lib/campusComponent/view/movie/movies_widget_view.dart index 5e8c902a..911104d1 100644 --- a/lib/campusComponent/view/movie/movies_widget_view.dart +++ b/lib/campusComponent/view/movie/movies_widget_view.dart @@ -7,7 +7,6 @@ import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; import 'package:campus_flutter/campusComponent/view/movie/movie_grid_view.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/movies_viewmodel.dart'; -import 'package:campus_flutter/campusComponent/view/movie/movie_card_view.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/campusComponent/view/studentClub/student_club_card_view.dart b/lib/campusComponent/view/studentClub/student_club_card_view.dart index a2e930e7..cdfd68ea 100644 --- a/lib/campusComponent/view/studentClub/student_club_card_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_card_view.dart @@ -9,7 +9,7 @@ import 'package:flutter_svg/svg.dart'; class StudentClubCardView extends ConsumerWidget { const StudentClubCardView({ super.key, - required this.studentClub + required this.studentClub, }); final StudentClub studentClub; @@ -17,9 +17,9 @@ class StudentClubCardView extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { return InkWell( - onTap: () => UrlLauncher.urlString(studentClub.linkUrl, ref), - child: body(context), - ); + onTap: () => UrlLauncher.urlString(studentClub.linkUrl, ref), + child: body(context), + ); } Widget body(BuildContext context) { diff --git a/lib/campusComponent/view/studentClub/student_club_grid_view.dart b/lib/campusComponent/view/studentClub/student_club_grid_view.dart index d74df898..34885b35 100644 --- a/lib/campusComponent/view/studentClub/student_club_grid_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_grid_view.dart @@ -1,6 +1,6 @@ import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pb.dart'; -import 'package:campus_flutter/campusComponent/view/studentClub/student_club_item_view.dart'; +import 'package:campus_flutter/campusComponent/view/studentClub/student_club_card_view.dart'; import 'package:flutter/material.dart'; class StudentClubGridView extends StatelessWidget { diff --git a/lib/campusComponent/view/studentClub/student_club_widget_view.dart b/lib/campusComponent/view/studentClub/student_club_widget_view.dart index 9fac56fe..e14d499d 100644 --- a/lib/campusComponent/view/studentClub/student_club_widget_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_widget_view.dart @@ -1,15 +1,11 @@ import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; -import 'package:campus_flutter/base/errorHandling/error_handling_view.dart'; import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; -import 'package:campus_flutter/base/util/url_launcher.dart'; import 'package:campus_flutter/campusComponent/view/studentClub/student_club_grid_view.dart'; -import 'package:campus_flutter/campusComponent/view/studentClub/student_club_item_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/student_club_viewmodel.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; -import 'package:campus_flutter/campusComponent/viewmodel/movies_viewmodel.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; From 18e2b9c51047f0344a0ef353b145b7a1515b2090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Wed, 30 Oct 2024 23:14:15 +0100 Subject: [PATCH 6/9] Improve for Tablet --- lib/base/util/grid_utility.dart | 38 +++++++++++++++++++ lib/campusComponent/screen/movie_screen.dart | 16 +------- .../view/movie/movies_widget_view.dart | 20 +++------- .../studentClub/student_club_widget_view.dart | 7 +++- .../viewmodel/student_club_viewmodel.dart | 2 +- 5 files changed, 51 insertions(+), 32 deletions(-) create mode 100644 lib/base/util/grid_utility.dart diff --git a/lib/base/util/grid_utility.dart b/lib/base/util/grid_utility.dart new file mode 100644 index 00000000..a0dd39a3 --- /dev/null +++ b/lib/base/util/grid_utility.dart @@ -0,0 +1,38 @@ +import 'package:campus_flutter/base/enums/device.dart'; +import 'package:campus_flutter/base/services/device_type_service.dart'; +import 'package:flutter/material.dart'; + +class GridUtility { + static int campusCrossAxisCount(BuildContext context) { + switch (DeviceService.getType(context)) { + case Device.landscapeTablet: + return 6; + case Device.portraitTablet: + return 4; + case Device.phone: + return 2; + } + } + + static int campusPaddedCrossAxisCount(BuildContext context) { + switch (DeviceService.getType(context)) { + case Device.landscapeTablet: + return 3; + case Device.portraitTablet: + return 4; + case Device.phone: + return 2; + } + } + + static int campusNumberOfItems(BuildContext context) { + switch (DeviceService.getType(context)) { + case Device.landscapeTablet: + return 6; + case Device.portraitTablet: + return 8; + case Device.phone: + return 6; + } + } +} diff --git a/lib/campusComponent/screen/movie_screen.dart b/lib/campusComponent/screen/movie_screen.dart index a8fd519e..6c381be9 100644 --- a/lib/campusComponent/screen/movie_screen.dart +++ b/lib/campusComponent/screen/movie_screen.dart @@ -1,9 +1,8 @@ -import 'package:campus_flutter/base/enums/device.dart'; import 'package:campus_flutter/base/enums/error_handling_view_type.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; import 'package:campus_flutter/base/extensions/context.dart'; -import 'package:campus_flutter/base/services/device_type_service.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; +import 'package:campus_flutter/base/util/grid_utility.dart'; import 'package:campus_flutter/base/util/url_launcher.dart'; import 'package:campus_flutter/campusComponent/view/movie/movie_grid_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/movies_viewmodel.dart'; @@ -37,7 +36,7 @@ class MovieScreen extends ConsumerWidget { return MovieGridView( movies: snapshot.data!, padding: EdgeInsets.all(context.padding), - crossAxisCount: crossAxisCount(context), + crossAxisCount: GridUtility.campusCrossAxisCount(context), withinScrollView: false, ); } else if (snapshot.hasError) { @@ -59,15 +58,4 @@ class MovieScreen extends ConsumerWidget { }, ); } - - int crossAxisCount(BuildContext context) { - switch (DeviceService.getType(context)) { - case Device.landscapeTablet: - return 6; - case Device.portraitTablet: - return 4; - case Device.phone: - return 2; - } - } } diff --git a/lib/campusComponent/view/movie/movies_widget_view.dart b/lib/campusComponent/view/movie/movies_widget_view.dart index 911104d1..c998f2ee 100644 --- a/lib/campusComponent/view/movie/movies_widget_view.dart +++ b/lib/campusComponent/view/movie/movies_widget_view.dart @@ -4,6 +4,7 @@ import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; import 'package:campus_flutter/base/networking/apis/tumdev/campus_backend.pbgrpc.dart'; import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; +import 'package:campus_flutter/base/util/grid_utility.dart'; import 'package:campus_flutter/campusComponent/view/movie/movie_grid_view.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/movies_viewmodel.dart'; @@ -66,24 +67,13 @@ class _MoviesHomeWidgetState extends ConsumerState { Widget body(AsyncSnapshot?> snapshot) { if (snapshot.hasData) { return MovieGridView( - movies: snapshot.data!.take(4).toList(), + movies: snapshot.data! + .take(GridUtility.campusNumberOfItems(context)) + .toList(), padding: EdgeInsets.symmetric(horizontal: context.padding), - crossAxisCount: 2, + crossAxisCount: GridUtility.campusPaddedCrossAxisCount(context), withinScrollView: true, ); - /*return GridView.count( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - padding: EdgeInsets.symmetric(horizontal: context.padding), - crossAxisCount: 2, - mainAxisSpacing: context.padding, - crossAxisSpacing: context.padding, - childAspectRatio: 250 / 470, - children: [ - for (var data in snapshot.data!.take(4).toList()) - MovieCardView(movie: data), - ], - );*/ } else if (snapshot.hasError) { return SizedBox( height: MediaQuery.of(context).size.height * 0.34, diff --git a/lib/campusComponent/view/studentClub/student_club_widget_view.dart b/lib/campusComponent/view/studentClub/student_club_widget_view.dart index e14d499d..1b1433fd 100644 --- a/lib/campusComponent/view/studentClub/student_club_widget_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_widget_view.dart @@ -3,6 +3,7 @@ import 'package:campus_flutter/base/errorHandling/error_handling_router.dart'; import 'package:campus_flutter/base/extensions/context.dart'; import 'package:campus_flutter/base/routing/routes.dart'; import 'package:campus_flutter/base/util/delayed_loading_indicator.dart'; +import 'package:campus_flutter/base/util/grid_utility.dart'; import 'package:campus_flutter/campusComponent/view/studentClub/student_club_grid_view.dart'; import 'package:campus_flutter/campusComponent/viewmodel/student_club_viewmodel.dart'; import 'package:campus_flutter/homeComponent/view/widget/widget_frame_view.dart'; @@ -54,9 +55,11 @@ class _StudentClubWidgetViewState extends ConsumerState { builder: (context, snapshot) { if (snapshot.hasData) { return StudentClubGridView( - studentClubs: snapshot.data!, + studentClubs: snapshot.data! + .take(GridUtility.campusNumberOfItems(context)) + .toList(), padding: EdgeInsets.symmetric(horizontal: context.padding), - crossAxisCount: 2, + crossAxisCount: GridUtility.campusPaddedCrossAxisCount(context), withinScrollView: true, ); } else if (snapshot.hasError) { diff --git a/lib/campusComponent/viewmodel/student_club_viewmodel.dart b/lib/campusComponent/viewmodel/student_club_viewmodel.dart index 570a4695..442bc681 100644 --- a/lib/campusComponent/viewmodel/student_club_viewmodel.dart +++ b/lib/campusComponent/viewmodel/student_club_viewmodel.dart @@ -24,7 +24,7 @@ class StudentClubViewModel { final studentClubs = value.$2.expand((e) => e.clubs).toList(); studentClubs.removeWhere((studentClub) => studentClub.coverUrl.isEmpty); studentClubs.shuffle(); - suggestions.add(studentClubs.take(6).toList()); + suggestions.add(studentClubs); }, onError: (error) { collections.addError(error); From f9b63d3056bdad71a7a2ea394943a149e282a9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:56:08 +0100 Subject: [PATCH 7/9] Improve Loading and Error Screens --- .../view/movie/movies_widget_view.dart | 20 ++++++++++--------- .../studentClub/student_club_widget_view.dart | 20 ++++++++++++------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/lib/campusComponent/view/movie/movies_widget_view.dart b/lib/campusComponent/view/movie/movies_widget_view.dart index c998f2ee..ce25f047 100644 --- a/lib/campusComponent/view/movie/movies_widget_view.dart +++ b/lib/campusComponent/view/movie/movies_widget_view.dart @@ -75,18 +75,20 @@ class _MoviesHomeWidgetState extends ConsumerState { withinScrollView: true, ); } else if (snapshot.hasError) { - return SizedBox( - height: MediaQuery.of(context).size.height * 0.34, - child: ErrorHandlingRouter( - error: snapshot.error!, - errorHandlingViewType: ErrorHandlingViewType.textOnly, - retry: (() => ref.read(movieViewModel).fetch(true)), + return AspectRatio( + aspectRatio: 2, + child: Card( + child: ErrorHandlingRouter( + error: Error(), + errorHandlingViewType: ErrorHandlingViewType.textOnly, + retry: (() => ref.read(movieViewModel).fetch(true)), + ), ), ); } else { - return Card( - child: SizedBox( - height: MediaQuery.of(context).size.height * 0.34, + return AspectRatio( + aspectRatio: 2, + child: Card( child: DelayedLoadingIndicator(name: context.tr("movies")), ), ); diff --git a/lib/campusComponent/view/studentClub/student_club_widget_view.dart b/lib/campusComponent/view/studentClub/student_club_widget_view.dart index 1b1433fd..8e7f812a 100644 --- a/lib/campusComponent/view/studentClub/student_club_widget_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_widget_view.dart @@ -63,16 +63,22 @@ class _StudentClubWidgetViewState extends ConsumerState { withinScrollView: true, ); } else if (snapshot.hasError) { - return Card( - child: ErrorHandlingRouter( - error: Error(), - errorHandlingViewType: ErrorHandlingViewType.textOnly, + return AspectRatio( + aspectRatio: 2, + child: Card( + child: ErrorHandlingRouter( + error: Error(), + errorHandlingViewType: ErrorHandlingViewType.textOnly, + ), ), ); } else { - return const Card( - child: DelayedLoadingIndicator( - name: "Student Clubs", + return const AspectRatio( + aspectRatio: 2, + child: Card( + child: DelayedLoadingIndicator( + name: "Student Clubs", + ), ), ); } From 28231394f1bce900277154823412a0f6d24629dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:30:24 +0100 Subject: [PATCH 8/9] Adjust Student Club Card --- lib/campusComponent/view/studentClub/student_club_card_view.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/campusComponent/view/studentClub/student_club_card_view.dart b/lib/campusComponent/view/studentClub/student_club_card_view.dart index cdfd68ea..00416a0b 100644 --- a/lib/campusComponent/view/studentClub/student_club_card_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_card_view.dart @@ -62,6 +62,7 @@ class StudentClubCardView extends ConsumerWidget { ), ), ), + Divider(height: 0), Expanded( flex: 2, child: Center( From 89ced90ea7b8ddfa6fbacf76417e3e3cdadce12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20K=C3=B6rber?= <56073945+jakobkoerber@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:34:11 +0100 Subject: [PATCH 9/9] Adjust Translations --- assets/translations/de.json | 2 +- assets/translations/en.json | 2 +- lib/campusComponent/view/movie/movies_widget_view.dart | 2 +- lib/campusComponent/view/news/news_widget_view.dart | 2 +- .../view/studentClub/student_club_widget_view.dart | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/translations/de.json b/assets/translations/de.json index d38c095d..808a51a0 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -226,6 +226,6 @@ "campus": "Campus", "studies": "Studium", "suggested": "Interessante {}", - "all": "Alle", + "more": "Mehr", "visibility": "Sichtbarkeit" } diff --git a/assets/translations/en.json b/assets/translations/en.json index 5abfcc87..e7fc1f52 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -226,6 +226,6 @@ "campus": "Campus", "studies": "Studies", "suggested": "Suggested {}", - "all": "All", + "more": "More", "visibility": "Visibility" } diff --git a/lib/campusComponent/view/movie/movies_widget_view.dart b/lib/campusComponent/view/movie/movies_widget_view.dart index ce25f047..052fcef3 100644 --- a/lib/campusComponent/view/movie/movies_widget_view.dart +++ b/lib/campusComponent/view/movie/movies_widget_view.dart @@ -48,7 +48,7 @@ class _MoviesHomeWidgetState extends ConsumerState { const Spacer(), InkWell( child: Text( - context.tr("all"), + context.tr("more"), style: Theme.of(context).textTheme.titleMedium, maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/campusComponent/view/news/news_widget_view.dart b/lib/campusComponent/view/news/news_widget_view.dart index d363be1f..8dc11aa7 100644 --- a/lib/campusComponent/view/news/news_widget_view.dart +++ b/lib/campusComponent/view/news/news_widget_view.dart @@ -40,7 +40,7 @@ class _NewsWidgetViewState extends ConsumerState { const Spacer(), InkWell( child: Text( - context.tr("all"), + context.tr("more"), style: Theme.of(context).textTheme.titleMedium, maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/campusComponent/view/studentClub/student_club_widget_view.dart b/lib/campusComponent/view/studentClub/student_club_widget_view.dart index 8e7f812a..293be9d2 100644 --- a/lib/campusComponent/view/studentClub/student_club_widget_view.dart +++ b/lib/campusComponent/view/studentClub/student_club_widget_view.dart @@ -41,7 +41,7 @@ class _StudentClubWidgetViewState extends ConsumerState { const Spacer(), InkWell( child: Text( - context.tr("all"), + context.tr("more"), style: Theme.of(context).textTheme.titleMedium, maxLines: 1, overflow: TextOverflow.ellipsis,