Skip to content

Commit

Permalink
Added reusable widgets,constants,corrrected name for bookmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ge59dil committed Nov 24, 2023
1 parent 3641e4b commit 0d4c8bb
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 411 deletions.
49 changes: 0 additions & 49 deletions lib/View/bookmarks_screen.dart

This file was deleted.

208 changes: 90 additions & 118 deletions lib/View/courseoverview_screen.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:gocast_mobile/View/utils/custom_bottom_nav_bar.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gocast_mobile/View/mycourses_screen.dart';
import 'package:gocast_mobile/View/publiccourses_screen.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gocast_mobile/View/utils/viewall_button_view.dart';
import 'settings_screen.dart';
import 'package:gocast_mobile/View/settings_screen.dart';
import 'package:gocast_mobile/View/utils/constants.dart';
import 'package:gocast_mobile/View/utils/course_card_view.dart';
import 'package:gocast_mobile/View/utils/custom_bottom_nav_bar.dart';
import 'package:gocast_mobile/View/utils/viewall_button_view.dart';

final currentIndexProvider = StateProvider<int>((ref) => 0);

Expand All @@ -15,130 +16,101 @@ class CourseOverview extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white, // Replace with the exact color
title: const Text(
'GoCast',
style: TextStyle(color: Colors.black),
), // Replace with the exact color
actions: [
IconButton(
icon: const Icon(
Icons.settings,
color: Colors.black,
), // Replace with the exact color
onPressed: () {
// Settings action
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsScreen(),
),
);
},
),
],
),
appBar: _buildAppBar(context),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'My Courses',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
ViewAllButton(
onViewAll: () { Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MyCourses(),
),
);
}, // Use the reusable ViewAllButton widget
),
],
),
_buildCourseSection(
context: context,
title: 'My Courses',
onViewAll: () => _navigateToScreen(context, const MyCourses()),
),
// Horizontal list view for My Courses
SizedBox(
height: 200, // Adjust the height as needed
child: ListView(
scrollDirection: Axis.horizontal,
children: const [
CourseCard(
title: 'PSY101',
subtitle: 'Introduction to Psychology',
path: 'assets/images/course1.png',
),
CourseCard(
title: 'CS202',
subtitle: 'Introduction to Computer Science',
path: 'assets/images/course2.png',
),
// Add more courses as needed
],
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Public Courses',
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
ViewAllButton(
onViewAll: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const PublicCourses(),
),
);
},
),
],
),
),
// Horizontal list view for Public Courses
SizedBox(
height: 200, // Adjust the height as needed
child: ListView(
scrollDirection: Axis.horizontal,
children: const [
CourseCard(
title: 'PSY101',
subtitle: 'Public Psychology Course',
path: 'assets/images/course1.png',
),
CourseCard(
title: 'PSY101',
subtitle: 'Public Psychology Course',
path: 'assets/images/course2.png',
),
// Add more courses as needed
],
),
_buildCourseSection(
context: context,
title: 'Public Courses',
onViewAll: () => _navigateToScreen(context, const PublicCourses()),
),
],
),
),
bottomNavigationBar: const CustomBottomNavBar(),
);
}
}

AppBar _buildAppBar(BuildContext context) {
return AppBar(
backgroundColor: appBarBackgroundColor,
title: const Text('GoCast', style: TextStyle(color: appBarTextColor)),
actions: [
IconButton(
icon: const Icon(Icons.settings, color: appBarIconColor),
onPressed: () => _navigateToScreen(context, const SettingsScreen()),
),
],
);
}

Widget _buildCourseSection({
required BuildContext context,
required String title,
required VoidCallback onViewAll,
}) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionTitle(title, onViewAll),
SizedBox(
height: 200,
child: _buildCourseListView(),
),
],
),
);
}

Row _buildSectionTitle(String title, VoidCallback onViewAll) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
ViewAllButton(onViewAll: onViewAll),
],
);
}

ListView _buildCourseListView() {
return ListView(
scrollDirection: Axis.horizontal,
children: const [
CourseCard(
title: 'PSY101',
subtitle: 'Introduction to Psychology',
path: courseImage1,
),
CourseCard(
title: 'PSY101',
subtitle: 'Introduction to Computer Science',
path: courseImage2,
),
// ... Add more courses as needed
],
);
}

void _navigateToScreen(BuildContext context, Widget screen) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => screen),
);
}
}
51 changes: 13 additions & 38 deletions lib/View/download_screen.dart
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
// DownloadsScreen.dart
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gocast_mobile/View/utils/custom_bottom_nav_bar.dart';
import 'utils/courselist_screen.dart';
import 'package:gocast_mobile/View/utils/video_card_view.dart';

class DownloadsScreen extends ConsumerWidget {
const DownloadsScreen({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
appBar: AppBar(
title: const Text('Downloads'),
actions: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () {
// Implement search functionality
},
),
IconButton(
icon: const Icon(Icons.filter_list),
onPressed: () {
// Implement more options functionality
},
),
],
),
body: ListView(
children: const <Widget>[
VideoCard(
imageName: 'assets/images/course1.png',
title: 'Lineare Algebra für Informatik [MA0901]',
date: 'July 24, 2019',
duration: '02:00:00',
),
VideoCard(
imageName: 'assets/images/course2.png',
title: 'Computer Science [CS202]',
date: 'July 23, 2019',
duration: '02:00:00',
),
// Add more DownloadItem widgets as needed
],
),
bottomNavigationBar: const CustomBottomNavBar()
,
return const CourseListScreen(
title: 'Downloads',
videoCards: [
VideoCard(
imageName: 'assets/images/course1.png',
title: 'Lineare Algebra für Informatik [MA0901]',
date: 'July 24, 2019',
duration: '02:00:00',
),
// Add more VideoCard widgets as needed
],
);
}
}
Loading

0 comments on commit 0d4c8bb

Please sign in to comment.