Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added past programs #166

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:opso/opso_timeline.dart';
import 'package:opso/past_programs.dart';
import 'package:opso/programs%20screen/girl_script.dart';
import 'package:opso/programs%20screen/google_season_of_docs_screen.dart';
import 'package:opso/programs%20screen/google_summer_of_code_screen.dart';
Expand Down Expand Up @@ -216,7 +217,9 @@ class _HomePageState extends State<HomePage> {
const BookMarkScreen()));
},
),

const SizedBox(height: 15),

ListTile(
leading: Transform.rotate(
angle: 90 * math.pi / 180,
Expand All @@ -235,6 +238,25 @@ class _HomePageState extends State<HomePage> {
);
},
),

const SizedBox(height: 15),

ListTile(
leading:
const Icon(FontAwesomeIcons.circleInfo),
title: const Text('Past programs'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const PastPrograms(),
),
);
},
),

const SizedBox(height: 15),

SizedBox(height: ScreenUtil().setHeight(15)),
ListTile(
leading:
Expand Down
29 changes: 22 additions & 7 deletions lib/opso_timeline.dart
Original file line number Diff line number Diff line change
@@ -1,82 +1,97 @@
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:timeline_tile/timeline_tile.dart';
import 'package:opso/services/notificationService.dart';
import 'widgets/event_card.dart';

class OpsoTimeLineScreen extends StatelessWidget {
const OpsoTimeLineScreen({super.key});

@override
Widget build(BuildContext context) {
final List<Map<String, dynamic>> events = [
static List<Map<String, dynamic>> events = [
{
'title' : "Outreachy",
'description':
"Outreachy(May Internships)\nApplication Period - 15/01/2024 to 31/01/2024",
'startDate': DateTime.utc(2024, 1, 15),
'endDate': DateTime.utc(2024, 1, 31),
},
{
'title' : "Linux Foundation Mentorship",
'description':
"Linux Foundation Mentorship(Spring Term)\nApplication Period - 15/01/2024 to 15/02/2024",
'startDate': DateTime.utc(2024, 1, 15),
'endDate': DateTime.utc(2024, 2, 15),
},
{
'title' : "Summer of Bitcoin",
'description':
"Summer of Bitcoin\nApplication Period - 01/02/2024 to 19/02/2024",
'startDate': DateTime.utc(2024, 2, 1),
'endDate': DateTime.utc(2024, 2, 19),
},
{
'title' : "Google Season of Docs",
'description':
"Google Season of Docs\nApplication Period - 22/02/2024 to 02/04/2024",
'startDate': DateTime.utc(2024, 2, 22),
'endDate': DateTime.utc(2024, 4, 2),
},
{
'title' : "Google Summer of Code",
'description':
"Google Summer of Code\nApplication Period - 18/03/2024 to 02/04/2024",
'startDate': DateTime.utc(2024, 3, 18),
'endDate': DateTime.utc(2024, 4, 2),
},
{
'title' : "MLH Fellowship(Summer Term-B)",
'description':
"MLH Fellowship(Summer Term-B)\nApplication Period - 31/03/2024 to 15/04/2024",
'startDate': DateTime.utc(2024, 3, 31),
'endDate': DateTime.utc(2024, 4, 15),
},
{
'title' : "MLH Fellowship(Fall Term)",
'description':
"MLH Fellowship(Fall Term)\nApplication Period - 15/04/2024 to 31/05/2024",
'startDate': DateTime.utc(2024, 4, 15),
'endDate': DateTime.utc(2024, 5, 31),
},
{
'title' : "Linux Foundation Mentorship(Summer Term)",
'description':
"Linux Foundation Mentorship(Summer Term)\nApplication Period - 15/04/2024 to 15/05/2024",
'startDate': DateTime.utc(2024, 4, 15),
'endDate': DateTime.utc(2024, 5, 15),
},
{
'description':
'title' : "GirlScript Summer of Code",
'description':
"GirlScript Summer of Code\nApplication Period - 01/05/2024 to 10/05/2024",
'startDate': DateTime.utc(2024, 5, 1),
'endDate': DateTime.utc(2024, 5, 10),
},
{
'description':
"Linux Foundation Mentorship(Fall Term)\nApplication Period - 15/07/2024 to 15/08/2024",
'title' : "Linux Foundation Mentorship(Fall Term)",
'description':
"Linux Foundation Mentorship(Fall Term)\c Period - 15/07/2024 to 15/08/2024",
'startDate': DateTime.utc(2024, 7, 15),
'endDate': DateTime.utc(2024, 8, 15),
},
{
'title' : "Outreachy",
'description':
"Outreachy(December Internships)\nApplication Period - 01/08/2024 to 31/08/2024",
'startDate': DateTime.utc(2024, 8, 1),
'endDate': DateTime.utc(2024, 8, 31),
},
];

@override
Widget build(BuildContext context) {

final DateTime now = DateTime.now();

for (var event in events) {
NotificationService.scheduleNotificationsForEvent(
event['description']!,
Expand Down
62 changes: 62 additions & 0 deletions lib/past_programs.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'opso_timeline.dart';

class PastPrograms extends StatefulWidget {
const PastPrograms({super.key});

@override
State<PastPrograms> createState() => _PastProgramsState();
}

class _PastProgramsState extends State<PastPrograms> {
// Method to get only past events
List<Map<String, dynamic>> getPastEvents() {
DateTime now = DateTime.now();
return OpsoTimeLineScreen.events.where((event) {
DateTime endDate = event['endDate'];
return endDate.isBefore(now);
}).toList();
}

@override
Widget build(BuildContext context) {
// Get the filtered list of past events
List<Map<String, dynamic>> pastEvents = getPastEvents();

return Scaffold(
appBar: AppBar(
title: const Text("Past Programs"),
),
body: ListView.builder(
itemCount: pastEvents.length,
itemBuilder: (context, index) {
final event = pastEvents[index];
// final DateTime endDate = event['endDate'];

return ListTile(
title: Text(event['title'] as String),
onTap: () {
// Handle tap event if needed
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(event['title'] as String),
content: Text(event['description'] as String),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Close'),
),
],
);
},
);
},
);
},
),
);
}
}
44 changes: 41 additions & 3 deletions lib/programs screen/google_summer_of_code_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:opso/modals/book_mark_model.dart';
import 'package:opso/widgets/gsoc/GsocProjectWidget.dart';
import 'package:url_launcher/url_launcher.dart';
import '../modals/GSoC/Gsoc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

Expand All @@ -20,6 +20,9 @@ class _GoogleSummerOfCodeScreenState extends State<GoogleSummerOfCodeScreen> {
List<Organization> gsoc2023 = [];
List<Organization> gsoc2022 = [];
List<Organization> gsoc2021 = [];
bool isBookmarked = true;
String currentProject = "Google Summer Of Code";
String currectPage = "/google_summer_of_code";
int selectedYear = 2024;
List<String> languages = [
'js',
Expand All @@ -45,9 +48,18 @@ class _GoogleSummerOfCodeScreenState extends State<GoogleSummerOfCodeScreen> {
@override
void initState() {
super.initState();
_checkBookmarkStatus();
_dataFetchFuture = getProjectData();
}

Future<void> _checkBookmarkStatus() async {
bool bookmarkStatus = await HandleBookmark.isBookmarked(currentProject);
setState(() {
isBookmarked = bookmarkStatus;
});
}


Future<void> getProjectData() async {
ApiService apiService = ApiService();
try {
Expand Down Expand Up @@ -150,8 +162,34 @@ class _GoogleSummerOfCodeScreenState extends State<GoogleSummerOfCodeScreen> {
onRefresh: _refresh,
child: Scaffold(
appBar: AppBar(
title: Text('Google Summer of Code'),
),
title: const Text('OpSo'),
actions: <Widget>[
IconButton(
icon: (isBookmarked)
? const Icon(Icons.bookmark_add_rounded)
: const Icon(Icons.bookmark_add_outlined),
onPressed: () {
setState(() {
isBookmarked = !isBookmarked;
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(isBookmarked ? 'Bookmark added' : 'Bookmark removed'),
duration:
const Duration(seconds: 2), // Adjust the duration as needed
),
);
if (isBookmarked) {
print("Adding");
HandleBookmark.addBookmark(currentProject, currectPage);
} else {
print("Deleting");
HandleBookmark.deleteBookmark(currentProject);
}
},
)
]),
body: FutureBuilder<void>(
future: _dataFetchFuture,
builder: (context, snapshot) {
Expand Down
4 changes: 3 additions & 1 deletion lib/programs screen/linux_foundation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ class _LinuxFoundationState extends State<LinuxFoundation> {
return RefreshIndicator(
onRefresh: _refresh,
child: Scaffold(
appBar: AppBar(title: const Text('OpSo'), actions: <Widget>[
appBar: AppBar(
title: const Text('OpSo'),
actions: <Widget>[
IconButton(
icon: (isBookmarked)
? const Icon(Icons.bookmark_add_rounded)
Expand Down
43 changes: 41 additions & 2 deletions lib/programs screen/summer_of_bitcoin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:opso/modals/book_mark_model.dart';
import 'package:opso/modals/sob_project_modal.dart';
import 'package:opso/widgets/sob_project_widget.dart';
import 'package:opso/widgets/year_button.dart';
Expand All @@ -16,6 +17,9 @@ class SummerOfBitcoin extends StatefulWidget {
}

class _SummerOfBitcoinState extends State<SummerOfBitcoin> {
String currectPage = "/summer_of_bitcoin";
String currentProject = "Summer Of Bitcoin";
bool isBookmarked = true;
List<SobProjectModal> sob2023 = [];
List<SobProjectModal> sob2022 = [];
List<SobProjectModal> sob2021 = [];
Expand Down Expand Up @@ -49,6 +53,15 @@ class _SummerOfBitcoinState extends State<SummerOfBitcoin> {
void initState() {
getProjectFunction = initializeProjectLists();
super.initState();
_checkBookmarkStatus();
}


Future<void> _checkBookmarkStatus() async {
bool bookmarkStatus = await HandleBookmark.isBookmarked(currentProject);
setState(() {
isBookmarked = bookmarkStatus;
});
}

void searchTag(String searchTag) {
Expand Down Expand Up @@ -121,8 +134,34 @@ class _SummerOfBitcoinState extends State<SummerOfBitcoin> {
onRefresh: _refresh,
child: Scaffold(
appBar: AppBar(
title: const Text('Summer of Bitcoin'),
),
title: const Text('OpSo'),
actions: <Widget>[
IconButton(
icon: (isBookmarked)
? const Icon(Icons.bookmark_add_rounded)
: const Icon(Icons.bookmark_add_outlined),
onPressed: () {
setState(() {
isBookmarked = !isBookmarked;
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content:
Text(isBookmarked ? 'Bookmark added' : 'Bookmark removed'),
duration:
const Duration(seconds: 2), // Adjust the duration as needed
),
);
if (isBookmarked) {
print("Adding");
HandleBookmark.addBookmark(currentProject, currectPage);
} else {
print("Deleting");
HandleBookmark.deleteBookmark(currentProject);
}
},
)
]),
body: FutureBuilder<void>(
future: getProjectFunction,
builder: (context, snapshot) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ packages:
source: hosted
version: "4.1.7"
intl:
dependency: transitive
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies:
adaptive_theme: ^3.6.0
timeline_tile: ^2.0.0
flutter_svg: ^2.0.10+1
intl: ^0.19.0
flutter_screenutil: ^5.9.1

dev_dependencies:
Expand Down
Loading