Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Redo merge stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
milenark committed Jan 25, 2024
1 parent 4487643 commit d2a984e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 70 deletions.
1 change: 1 addition & 0 deletions lib/views/components/base_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class BaseViewState extends ConsumerState<BaseView> {
),
]
: widget.actions,
surfaceTintColor: Colors.transparent,
),
body: widget.child,
drawer: !_isTablet(context) && widget.customAppBar==null ? _buildHamburgerMenu(context) : null,
Expand Down
40 changes: 21 additions & 19 deletions lib/views/course_view/course_detail_view/course_detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:gocast_mobile/providers.dart';
import 'package:gocast_mobile/views/components/custom_search_top_nav_bar_back_button.dart';
import 'package:gocast_mobile/views/course_view/components/pin_button.dart';
import 'package:gocast_mobile/views/course_view/components/stream_card.dart';
import 'package:gocast_mobile/views/video_view/video_player.dart';

import 'package:tuple/tuple.dart';

Expand Down Expand Up @@ -37,6 +38,7 @@ class CourseDetailState extends ConsumerState<CourseDetail> {
_initializeStreams();
searchController.addListener(_searchCourses);
}

// set the thumbnails streams and search results
void _initializeStreams() {
final videoViewModelNotifier = ref.read(videoViewModelProvider.notifier);
Expand Down Expand Up @@ -151,37 +153,37 @@ class CourseDetailState extends ConsumerState<CourseDetail> {
return Expanded(
child: streamsWithThumb.isNotEmpty
? Padding(
padding: EdgeInsets.symmetric(horizontal: isTablet ? width * 0.15 : 0),
child: ListView.builder(
itemCount: streamsWithThumb.length,
padding: const EdgeInsets.symmetric(horizontal: 10.0),
itemBuilder: (context, index) => _streamCardBuilder(
context,
index,
streamsWithThumb,
scaffoldMessenger,
padding:
EdgeInsets.symmetric(horizontal: isTablet ? width * 0.15 : 0),
child: ListView.builder(
itemCount: streamsWithThumb.length,
padding: const EdgeInsets.symmetric(horizontal: 10.0),
itemBuilder: (context, index) => _streamCardBuilder(
context,
index,
streamsWithThumb,
scaffoldMessenger,
),
),
),)
)
: const Center(child: Text('No courses available')),
);
}

/// Builds individual stream cards.
Widget _streamCardBuilder(BuildContext context,
int index,
List<Tuple2<Stream, String>> streamsWithThumb,
ScaffoldMessengerState scaffoldMessenger,) {
Widget _streamCardBuilder(
BuildContext context,
int index,
List<Tuple2<Stream, String>> streamsWithThumb,
ScaffoldMessengerState scaffoldMessenger,
) {
final streamWithThumb = streamsWithThumb[index];
final stream = streamWithThumb.item1;
final thumbnail = _getThumbnailUrl(streamWithThumb.item2);

return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: StreamCard(
imageName: thumbnail,
stream: stream,
onTap: () => _handleStreamTap(context, scaffoldMessenger, stream),
),
child: StreamCard(stream: stream),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class DownloadCoursesContentView extends ConsumerWidget {
final List<VideoCard> videoCards;
final CustomSearchTopNavBar customAppBar;


const DownloadCoursesContentView({
super.key,
required this.videoCards,
Expand All @@ -32,61 +31,36 @@ class DownloadCoursesContentView extends ConsumerWidget {
double width = MediaQuery.of(context).size.width;

return BaseView(
customAppBar: CustomSearchTopNavBar(
searchController: searchController,
title: title,
),
showLeading: false,
child: RefreshIndicator(
onRefresh: onRefresh ??
() async {
// Ensure the correct provider is used here
await ref
.read(downloadViewModelProvider.notifier)
.fetchDownloadedVideos();
},
child: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal:
width >= 600 ? MediaQuery.of(context).size.width * 0.15 : 0,
),
child: ListView.builder(
itemCount: videoCards.isEmpty ? 1 : videoCards.length,
itemBuilder: (BuildContext context, int index) {
if (videoCards.isEmpty) {
return const Center(
/* return BaseView(
customAppBar: customAppBar,
child: ListView.builder(
itemCount: videoCards.isEmpty ? 1 : videoCards.length,
itemBuilder: (BuildContext context, int index) {
if (videoCards.isEmpty) {
return const Center(
child: Padding(
padding: AppPadding.sectionPadding,
child: Center(*/
child: Padding(
padding: AppPadding.sectionPadding,
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 295.0),
child: Text('No Downloaded Courses'),
),
child: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0, top: 8.0),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal:
width >= 600 ? MediaQuery.of(context).size.width * 0.15 : 0,
),
child: ListView.builder(
itemCount: videoCards.isEmpty ? 1 : videoCards.length,
itemBuilder: (BuildContext context, int index) {
if (videoCards.isEmpty) {
return const Center(
child: Padding(
padding: AppPadding.sectionPadding,
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(vertical: 295.0),
child: Text('No Downloaded Courses'),
),
),
);
} else {
return Padding(
padding: EdgeInsets.only(bottom: width * 0.02),
child: videoCards[index],
);
}
},
),
),
);
} else {
return videoCards[index];
}
},
),
),
),
);
}
}

0 comments on commit d2a984e

Please sign in to comment.