Skip to content

Commit

Permalink
Use DrawerMotion() in the slide
Browse files Browse the repository at this point in the history
  • Loading branch information
GravityDarkLab committed Jan 27, 2024
1 parent 8162628 commit 647d7b8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
28 changes: 2 additions & 26 deletions lib/views/course_view/components/course_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ import 'package:gocast_mobile/base/networking/api/gocast/api_v2.pb.dart';
import 'package:gocast_mobile/views/components/view_all_button.dart';
import 'package:url_launcher/url_launcher.dart';

/// Course card view
///
/// A reusable stateless widget to display a course card.
///
/// It takes a [title], [tumID] and [path] to display the course details.
/// This widget can be reused for various course sections by providing different
/// titles, subtitles and paths.

class CourseCard extends StatelessWidget {
final String title;
final String tumID;
Expand Down Expand Up @@ -69,7 +63,6 @@ class CourseCard extends StatelessWidget {
elevation: 1,
shadowColor: themeData.shadowColor,
color: themeData.cardTheme.color,
// Use card color from theme
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
side: BorderSide(
Expand Down Expand Up @@ -125,7 +118,6 @@ class CourseCard extends StatelessWidget {
_buildCourseSubtitle(themeData.textTheme),
const SizedBox(height: 15),
_buildLocation(),
//_buildCourseIsLive(),
],
),
),
Expand All @@ -146,6 +138,7 @@ class CourseCard extends StatelessWidget {
) {
return Slidable(
key: ValueKey(course.id),
closeOnScroll: true,
endActionPane: ActionPane(
motion: const DrawerMotion(),
dragDismissible: true,
Expand Down Expand Up @@ -243,11 +236,6 @@ class CourseCard extends StatelessWidget {
),
),
),
/*Positioned(
bottom: 3, // Adjust this value based on your layout
right: 3, // Adjust this value based on your layout
child: _buildCourseViewerCount(),
),*/
],
);
}
Expand All @@ -273,7 +261,6 @@ class CourseCard extends StatelessWidget {
size: 20,
),
Text(roomName ?? "Location"),
//const SizedBox(width: 2),
Transform.scale(
scale: 0.6, // Adjust the scale factor as needed
child: ViewAllButton(onViewAll: () {}),
Expand All @@ -300,7 +287,6 @@ class CourseCard extends StatelessWidget {
title,
overflow: TextOverflow.ellipsis,
maxLines: 2,
//if courses are ever no longer displayed as list, check this for overflows
softWrap: true,
style: textTheme.titleMedium?.copyWith(
fontSize: 16,
Expand Down Expand Up @@ -378,16 +364,6 @@ class CourseCard extends StatelessWidget {
}

Color _colorPicker() {
/** Colors:
* Informatik - IN: blue
* Mathe - MA: purple
* Chemie - CH
* Physik - PH
* Maschinenwesen - MW
* nothing/ other: gray
* Elektrotechnik - EL
*
*/
if (tumID.length < 2) return Colors.grey;
switch (tumID.substring(0, 2)) {
case 'IN':
Expand Down
2 changes: 1 addition & 1 deletion lib/views/course_view/components/course_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class CourseSection extends StatelessWidget {
AppImages.course2,
];
imagePath = imagePaths[random.nextInt(imagePaths.length)];
final userPinned = ref.watch(userViewModelProvider).displayedPinnedCourses ?? [];
final userPinned = ref.watch(userViewModelProvider).userPinned ?? [];
final isPinned = userPinned.contains(course);
return CourseCard(
course: course,
Expand Down
1 change: 1 addition & 0 deletions lib/views/course_view/courses_overview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CourseOverviewState extends ConsumerState<CourseOverview> {
if (ref.read(userViewModelProvider).user != null) {
userViewModelNotifier.fetchUserCourses();
videoViewModelNotifier.fetchLiveNowStreams();
userViewModelNotifier.fetchUserPinned();
}
// Fetch public courses regardless of user's login status
userViewModelNotifier.fetchPublicCourses();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CoursesList extends ConsumerWidget {
Widget _buildCourseListView(BuildContext context, bool isTablet, WidgetRef ref) {
final liveStreams = ref.watch(videoViewModelProvider).liveStreams ?? [];
var liveCourseIds = liveStreams.map((stream) => stream.courseID).toSet();
final userPinned = ref.watch(userViewModelProvider).displayedPinnedCourses ?? [];
final userPinned = ref.watch(userViewModelProvider).userPinned ?? [];
List<Course> liveCourses = courses.where((course) => liveCourseIds.contains(course.id)).toList();
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: isTablet ? 600 : 400),
Expand Down

0 comments on commit 647d7b8

Please sign in to comment.