From 89012a480bfc39633b563e6788c507e40ef8a5a4 Mon Sep 17 00:00:00 2001 From: "Bryant, Charles" Date: Fri, 30 Sep 2022 12:52:21 -0700 Subject: [PATCH 1/2] Change Availability card to Busyness --- lib/app_constants.dart | 4 ++-- lib/ui/availability/availability_detail_view.dart | 10 +++++----- lib/ui/availability/availability_display.dart | 10 +++++----- lib/ui/common/card_container.dart | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/app_constants.dart b/lib/app_constants.dart index 4a46b35d0..93039ab4b 100644 --- a/lib/app_constants.dart +++ b/lib/app_constants.dart @@ -71,7 +71,7 @@ class RouteTitles { 'dining/dining_list_view': 'Dining', 'dining/dining_detail_view': 'Dining', 'dining/dining_nutrition_view': 'Dining', - 'availability/detailed_view': 'Availability' + 'availability/detailed_view': 'Busyness' }; } @@ -181,7 +181,7 @@ class CardTitleConstants { 'schedule': 'Classes', 'shuttle': "Shuttle", 'dining': 'Dining', - 'availability': 'Availability', + 'availability': 'Busyness', 'events': 'Events', 'news': 'News', 'parking': 'Parking', diff --git a/lib/ui/availability/availability_detail_view.dart b/lib/ui/availability/availability_detail_view.dart index 42c7cb4b6..3cf2452bc 100644 --- a/lib/ui/availability/availability_detail_view.dart +++ b/lib/ui/availability/availability_detail_view.dart @@ -1,6 +1,6 @@ import 'package:campus_mobile_experimental/core/models/availability.dart'; -import 'package:campus_mobile_experimental/ui/common/container_view.dart'; import 'package:campus_mobile_experimental/ui/availability/availability_constants.dart'; +import 'package:campus_mobile_experimental/ui/common/container_view.dart'; import 'package:flutter/material.dart'; class AvailabilityDetailedView extends StatelessWidget { @@ -44,7 +44,7 @@ class AvailabilityDetailedView extends StatelessWidget { alignment: Alignment.centerLeft, child: Text( (100 * percentAvailability(floor)).toInt().toString() + - '% Availability', + '% Busy', // style: TextStyle(color: Colors.black), )), Align( @@ -79,15 +79,15 @@ class AvailabilityDetailedView extends StatelessWidget { // Calculate the percent available num percentAvailability(Floor subLocationFloor) => - 1 - subLocationFloor.percentage!; + subLocationFloor.percentage!; // Color options setIndicatorColor(num percentage) { if (percentage >= .75) - return Colors.green; + return Colors.red; else if (percentage >= .25) return Colors.yellow; else - return Colors.red; + return Colors.green; } } diff --git a/lib/ui/availability/availability_display.dart b/lib/ui/availability/availability_display.dart index dae96567e..cd7aad4e6 100644 --- a/lib/ui/availability/availability_display.dart +++ b/lib/ui/availability/availability_display.dart @@ -1,6 +1,6 @@ +import 'package:campus_mobile_experimental/app_constants.dart'; import 'package:campus_mobile_experimental/core/models/availability.dart'; import 'package:campus_mobile_experimental/ui/availability/availability_constants.dart'; -import 'package:campus_mobile_experimental/app_constants.dart'; import 'package:flutter/material.dart'; class AvailabilityDisplay extends StatelessWidget { @@ -70,7 +70,7 @@ class AvailabilityDisplay extends StatelessWidget { (100 * percentAvailability(subLocation)) .toInt() .toString() + - '% Availability', + '% Busy', // style: TextStyle(color: Colors.black), )), Align( @@ -124,14 +124,14 @@ class AvailabilityDisplay extends StatelessWidget { ); } - num percentAvailability(SubLocations location) => 1 - location.percentage!; + num percentAvailability(SubLocations location) => location.percentage!; setIndicatorColor(num percentage) { if (percentage >= .75) - return Colors.green; + return Colors.red; else if (percentage >= .25) return Colors.yellow; else - return Colors.red; + return Colors.green; } } diff --git a/lib/ui/common/card_container.dart b/lib/ui/common/card_container.dart index 39c06c41d..30640ea1c 100644 --- a/lib/ui/common/card_container.dart +++ b/lib/ui/common/card_container.dart @@ -118,7 +118,7 @@ class CardContainer extends StatelessWidget { )), ), ); - } else if (titleText == "Availability") { + } else if (titleText == "Busyness") { // web cards are still sized with static values return Container( width: double.infinity, From fc9c7e66e9e0abc33b75c8e08bac6e304f7bef9a Mon Sep 17 00:00:00 2001 From: "Bryant, Charles" Date: Fri, 30 Sep 2022 12:52:31 -0700 Subject: [PATCH 2/2] Migrate to mobile cards service v9 --- lib/core/services/cards.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/services/cards.dart b/lib/core/services/cards.dart index 3d94df353..3021bd998 100644 --- a/lib/core/services/cards.dart +++ b/lib/core/services/cards.dart @@ -24,7 +24,7 @@ class CardsService { /// API Manager Service try { String cardListEndpoint = - "https://api-qa.ucsd.edu:8243/mobilecardsservice/v1.0.0/mobilecardslist?version=8&ucsdaffiliation=" + + "https://api-qa.ucsd.edu:8243/mobilecardsservice/v1.0.0/mobilecardslist?version=9&ucsdaffiliation=" + ucsdAffiliation; String _response = await _networkHelper.authorizedFetch(cardListEndpoint, headers);