Skip to content

Commit

Permalink
Fixed library colors & max percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
jlcrodrigues committed Oct 3, 2023
1 parent 85d7277 commit 8619391
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions uni/lib/model/entities/library_occupation.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math';

/// Overall occupation of the library
class LibraryOccupation {
LibraryOccupation(this.occupation, this.capacity) {
Expand All @@ -14,8 +16,8 @@ class LibraryOccupation {
}

int get percentage {
if (capacity == 0) return 0;
return (occupation * 100 / capacity).round();
if (capacity <= 0) return 0;
return min(100, (occupation * 100 / capacity).round());
}

FloorOccupation getFloor(int number) {
Expand All @@ -32,8 +34,8 @@ class FloorOccupation {
final int capacity;

int get percentage {
if (capacity == 0) return 0;
return (occupation * 100 / capacity).round();
if (capacity <= 0) return 0;
return min(100, (occupation * 100 / capacity).round());
}

Map<String, dynamic> toMap() {
Expand Down
2 changes: 1 addition & 1 deletion uni/lib/view/library/library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class LibraryPage extends StatelessWidget {
style: Theme.of(context)
.textTheme
.titleLarge
?.copyWith(color: Theme.of(context).colorScheme.background),
?.copyWith(color: Theme.of(context).colorScheme.secondary),
),
LinearPercentIndicator(
lineHeight: 7,
Expand Down

0 comments on commit 8619391

Please sign in to comment.