Skip to content

Commit

Permalink
Fix card adders popup (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisDuarte1 authored Jul 27, 2023
2 parents 9804c0d + 7ee23b3 commit b8e833c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 0 additions & 7 deletions uni/lib/model/providers/startup/session_provider.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:collection';

import 'package:uni/controller/background_workers/notifications.dart';
import 'package:uni/controller/load_static/terms_and_conditions.dart';
Expand All @@ -14,7 +13,6 @@ import 'package:uni/model/request_status.dart';

class SessionProvider extends StateProviderNotifier {
late Session _session;
late List<String> _faculties;

SessionProvider()
: super(
Expand All @@ -24,9 +22,6 @@ class SessionProvider extends StateProviderNotifier {

Session get session => _session;

UnmodifiableListView<String> get faculties =>
UnmodifiableListView<String>(_faculties);

@override
Future<void> loadFromStorage() async {}

Expand All @@ -46,8 +41,6 @@ class SessionProvider extends StateProviderNotifier {

Future<void> postAuthentication(String username, String password,
List<String> faculties, persistentSession) async {
_faculties = faculties;

updateStatus(RequestStatus.busy);

Session? session;
Expand Down
5 changes: 3 additions & 2 deletions uni/lib/view/home/widgets/main_cards_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,13 @@ class MainCardsList extends StatelessWidget {
}

List<Widget> getCardAdders(BuildContext context) {
final userSession = Provider.of<SessionProvider>(context, listen: false);
final session =
Provider.of<SessionProvider>(context, listen: false).session;
final List<FavoriteWidgetType> favorites =
Provider.of<HomePageProvider>(context, listen: false).favoriteCards;

final possibleCardAdditions = cardCreators.entries
.where((e) => e.key.isVisible(userSession.faculties))
.where((e) => e.key.isVisible(session.faculties))
.where((e) => !favorites.contains(e.key))
.map((e) => Container(
decoration: const BoxDecoration(),
Expand Down

0 comments on commit b8e833c

Please sign in to comment.