Skip to content

Commit

Permalink
fix Section not displaying more then 2 courses
Browse files Browse the repository at this point in the history
  • Loading branch information
GravityDarkLab committed Jan 29, 2024
1 parent eebf259 commit 05647a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 6 additions & 2 deletions lib/views/course_view/components/course_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:gocast_mobile/utils/section_kind.dart';
import 'package:gocast_mobile/views/components/view_all_button.dart';
import 'package:gocast_mobile/views/course_view/components/course_card.dart';
import 'package:gocast_mobile/views/course_view/course_detail_view/course_detail_view.dart';
import 'dart:math' as math;


/// CourseSection
///
Expand All @@ -26,7 +28,7 @@ import 'package:gocast_mobile/views/course_view/course_detail_view/course_detail
class CourseSection extends StatelessWidget {
final String sectionTitle;
final SectionKind
sectionKind; //0 for livestreams, 1 cor mycourses, 2 for puliccourses
sectionKind;
final List<Course> courses;
final List<Stream> streams;
final VoidCallback? onViewAll;
Expand Down Expand Up @@ -74,9 +76,11 @@ class CourseSection extends StatelessWidget {

Widget _buildCourseList(BuildContext context) {
bool isTablet = MediaQuery.of(context).size.width >= 600 ? true : false;
int displayCount = math.min(courses.length, 3);
double cardHeight = 75;

return ConstrainedBox(
constraints: BoxConstraints(maxHeight: isTablet ? 600 : 400),
constraints: BoxConstraints(maxHeight: isTablet ? double.infinity : cardHeight * displayCount,),
child: ListView.builder(
physics: const ClampingScrollPhysics(),
shrinkWrap: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ class CoursesList extends ConsumerWidget {
final userPinned = ref.watch(pinnedCourseViewModelProvider).userPinned ?? [];
List<Course> liveCourses =
courses.where((course) => liveCourseIds.contains(course.id)).toList();
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: isTablet ? 600 : 400),
child: ListView.builder(
return ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
Expand Down Expand Up @@ -88,8 +86,6 @@ class CoursesList extends ConsumerWidget {
);
},
);
},
),
);
});
}
}

0 comments on commit 05647a5

Please sign in to comment.