diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d650b6e9a..ce909c2ba 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -321,4 +321,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e0bbf5c8e53a75b510552973e41d17cf5c6e2c02 -COCOAPODS: 1.11.3 +COCOAPODS: 1.11.3 \ No newline at end of file diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index f4b9147e1..d822806be 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,6 +1,6 @@ import UIKit import Flutter - import GoogleMaps +import GoogleMaps import Firebase @UIApplicationMain diff --git a/lib/core/models/dining.dart b/lib/core/models/dining.dart index 963e4c43c..b1f83da90 100644 --- a/lib/core/models/dining.dart +++ b/lib/core/models/dining.dart @@ -25,7 +25,7 @@ class DiningModel { List? images; Coordinates? coordinates; RegularHours? regularHours; - List? specialHours; + SpecialHour? specialHours; String? url; String? menuWebsite; double? distance; @@ -70,10 +70,10 @@ class DiningModel { regularHours: json["regularHours"] == null ? null : RegularHours.fromJson(json["regularHours"]), - specialHours: json["specialHours"] == null + specialHours: (json["specialHours"] == null || json["specialHours"].isEmpty) ? null - : List.from( - json["specialHours"].map((x) => SpecialHour.fromJson(x))), + : SpecialHour.fromJson(json["specialHours"]), + url: json["url"] == null ? null : json["url"], menuWebsite: json["menuWebsite"] == null ? null : json["menuWebsite"], ); @@ -97,7 +97,7 @@ class DiningModel { "regularHours": regularHours == null ? null : regularHours!.toJson(), "specialHours": specialHours == null ? null - : List.from(specialHours!.map((x) => x.toJson())), + : specialHours?.toJson(), "url": url == null ? null : url, "menuWebsite": menuWebsite == null ? null : menuWebsite, "distance": distance == null ? null : distance, @@ -176,22 +176,31 @@ class RegularHours { } class SpecialHour { - String? title; - String? hours; + String? specialHoursEvent; + String? specialHoursEventDetails; + String? specialHoursValidFrom; + String? specialHoursValidTo; SpecialHour({ - this.title, - this.hours, + this.specialHoursEvent, + this.specialHoursEventDetails, + this.specialHoursValidFrom, + this.specialHoursValidTo }); factory SpecialHour.fromJson(Map json) => SpecialHour( - title: json["title"] == null ? null : json["title"], - hours: json["hours"] == null ? null : json["hours"], + specialHoursEvent: json["specialHoursEvent"] == null ? null : json["specialHoursEvent"], + specialHoursEventDetails: json["specialHoursEventDetails"] == null ? null : json["specialHoursEventDetails"], + specialHoursValidFrom: json["specialHoursValidFrom"] == null ? null : json["specialHoursValidFrom"], + specialHoursValidTo: json["specialHoursValidTo"] == null ? null : json["specialHoursValidTo"], ); Map toJson() => { - "title": title == null ? null : title, - "hours": hours == null ? null : hours, + "specialHoursEvent": specialHoursEvent == null ? null : specialHoursEvent, + "specialHoursEventDetails": specialHoursEventDetails == null ? null : specialHoursEventDetails, + "specialHoursValidFrom": specialHoursValidFrom == null ? null : specialHoursValidFrom, + "specialHoursValidTo": specialHoursValidTo == null ? null : specialHoursValidTo + }; } diff --git a/lib/core/services/dining.dart b/lib/core/services/dining.dart index c768c0a15..e0d3fc5a8 100644 --- a/lib/core/services/dining.dart +++ b/lib/core/services/dining.dart @@ -19,7 +19,7 @@ class DiningService { final Map headers = { "accept": "application/json", }; - final String baseEndpoint = "https://api-qa.ucsd.edu:8243/dining/v3.0.0"; + String baseEndpoint = "https://api-qa.ucsd.edu:8243/dining/v4.0.0"; Future fetchData() async { _error = null; diff --git a/lib/ui/common/card_container.dart b/lib/ui/common/card_container.dart index 30640ea1c..0884de8e2 100644 --- a/lib/ui/common/card_container.dart +++ b/lib/ui/common/card_container.dart @@ -72,6 +72,7 @@ class CardContainer extends StatelessWidget { Widget buildBody(context) { if (errorText != null) { + print(errorText); if (titleText == 'News') { return Text('No articles found.'); } else if (titleText == 'Events') { diff --git a/lib/ui/dining/dining_detail_view.dart b/lib/ui/dining/dining_detail_view.dart index 5a6662a05..bf0dd0b8e 100644 --- a/lib/ui/dining/dining_detail_view.dart +++ b/lib/ui/dining/dining_detail_view.dart @@ -39,6 +39,8 @@ class DiningDetailView extends StatelessWidget { style: TextStyle(fontSize: 15), ), buildHours(context, model), + if(model.specialHours != null) + buildSpecialHours(context,model), buildPaymentOptions(context, model), buildPictures(model), Divider(), @@ -168,6 +170,31 @@ class DiningDetailView extends StatelessWidget { Divider(height: 10), ]); } +Widget buildSpecialHours(BuildContext context, prefix0.DiningModel model){ + var specialHoursDuration = ""; + if(model.specialHours?.specialHoursValidFrom != null && model.specialHours?.specialHoursValidTo != null){ + specialHoursDuration = model.specialHours!.specialHoursValidFrom ! + " to " + + model.specialHours!.specialHoursValidTo ! + "\n"; + } + return RichText( + text: TextSpan( + style: TextStyle( + fontSize: Theme.of(context).textTheme.bodyText2!.fontSize, + color: Theme.of(context).textTheme.bodyText2!.color), + children: [ + TextSpan( + text: "Special Hours: \n", + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), + ), + TextSpan( + text: model.specialHours!.specialHoursEvent! + "\n" + ), + TextSpan(text: model.specialHours!.specialHoursEventDetails! + "\n"), + TextSpan(text:specialHoursDuration) + ], + ), + ); +} Widget buildPaymentOptions(BuildContext context, prefix0.DiningModel model) { String options = model.paymentOptions!.join(', ');