Skip to content

Commit

Permalink
Change Availability card to Busyness
Browse files Browse the repository at this point in the history
  • Loading branch information
c3bryant committed Sep 30, 2022
1 parent f606639 commit 89012a4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/app_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'
};
}

Expand Down Expand Up @@ -181,7 +181,7 @@ class CardTitleConstants {
'schedule': 'Classes',
'shuttle': "Shuttle",
'dining': 'Dining',
'availability': 'Availability',
'availability': 'Busyness',
'events': 'Events',
'news': 'News',
'parking': 'Parking',
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/availability/availability_detail_view.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
}
10 changes: 5 additions & 5 deletions lib/ui/availability/availability_display.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -70,7 +70,7 @@ class AvailabilityDisplay extends StatelessWidget {
(100 * percentAvailability(subLocation))
.toInt()
.toString() +
'% Availability',
'% Busy',
// style: TextStyle(color: Colors.black),
)),
Align(
Expand Down Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion lib/ui/common/card_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 89012a4

Please sign in to comment.