diff --git a/lib/drawer/drawer.dart b/lib/drawer/drawer.dart index 8d6ce2b7bfb3dcf154059690ae4a0d4706c04753..9fe2ed74f06b41467009ca1c6e019041dc93b07f 100644 --- a/lib/drawer/drawer.dart +++ b/lib/drawer/drawer.dart @@ -20,6 +20,18 @@ class _ClassDrawerState extends State<ClassDrawer> { late final searchTextController = TextEditingController(text: activeQuery); List<Class> get availableClasses => widget.appContext.classes ?? []; + Set<Class> get selectedClasses => + widget.appContext.profile.value!.selectedClasses + .map((id) => availableClasses.firstWhere((cls) => cls.id == id)) + .toSet(); + + String get headerText { + final classes = selectedClasses; + final selectedNames = + classes.map((cls) => cls.codeWithoutFaculty).join(', '); + + return selectedNames; + } @override void initState() { @@ -109,13 +121,26 @@ class _ClassDrawerState extends State<ClassDrawer> { return Drawer( child: Column( children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: TextField( - controller: searchTextController, - decoration: const InputDecoration( - hintText: 'Suche...', - ), + DrawerHeader( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + headerText, + style: TextStyle( + // fontWeight: FontWeight.bold, + color: Theme.of(context).primaryColor, + ), + ), + Expanded(child: Container()), + TextField( + controller: searchTextController, + decoration: const InputDecoration( + hintText: 'Suche...', + ), + ), + ], ), ), Expanded(