andoriyaprashant / andoriyaprashant/OpSo

feat: add a "Deadline Countdown" and calendar reminder feature to program detail screens — users currently see application dates as static text but have no way to track upcoming deadlines or add them to their device calendar

Ouverte
#481 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Dart
Étoiles
53
Forks
108
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## 🚀 Problem Statement

Open-source programs like GSoC, LFX, and Outreachy have **strict application deadlines** that students frequently miss. OpSo shows dates as static text on program detail screens, but:

1. There is no visual countdown showing "Application closes in 12 days"
2. There is no way to add a deadline reminder to the device calendar
3. There is no in-app notification system for upcoming deadlines
4. Missed deadlines = missed opportunities — this is exactly the problem OpSo should solve

For an app whose purpose is helping developers discover and apply to programs, deadline awareness is the single most impactful missing feature.

## ✅ Proposed Solution

### 1. Create a `DeadlineCountdown` widget

````dart
// lib/components/deadline_countdown.dart
import 'package:flutter/material.dart';
import 'dart:async';

class DeadlineCountdown extends StatefulWidget {
final DateTime deadline;
final String label;

const DeadlineCountdown({Key? key, required this.deadline, required this.label})
: super(key: key);

@override
State createState() => _DeadlineCountdownState();
}

class _DeadlineCountdownState extends State {
late Timer _timer;
late Duration _remaining;

@override
void initState() {
super.initState();
_remaining = widget.deadline.difference(DateTime.now());
_timer = Timer.periodic(const Duration(seconds: 1), (_) {
setState(() {
_remaining = widget.deadline.difference(DateTime.now());
});
});
}

@override
void dispose() { _timer.cancel(); super.dispose(); }

Color get urgencyColor {
if (_remaining.inDays < 3) return Colors.red;
if (_remaining.inDays < 7) return Colors.orange;
return Colors.green;
}

@override
Widget build(BuildContext context) {
if (_remaining.isNegative) {
return Chip(
label: const Text('Deadline Passed'),
backgroundColor: Colors.grey[300],
);
}

return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: urgencyColor.withOpacity(0.1),
border: Border.all(color: urgencyColor),
borderRadius: BorderRadius.circular(8),
),
child: Row(children: [
Icon(Icons.timer, color: urgencyColor),
const SizedBox(width: 8),
Text(
'${_remaining.inDays}d ${_remaining.inHours % 24}h ${_remaining.inMinutes % 60}m',
style: TextStyle(color: urgencyColor, fontWeight: FontWeight.bold, fontSize: 18),
),
const Spacer(),
Text(widget.label, style: TextStyle(color: urgencyColor)),
]),
);
}
}
````

### 2. Add "Add to Calendar" button using `add_2_calendar` package

````yaml
# pubspec.yaml
dependencies:
add_2_calendar: ^3.0.1
````

````dart
// lib/components/add_to_calendar_button.dart
import 'package:add_2_calendar/add_2_calendar.dart';

void addDeadlineToCalendar({
required String programName,
required DateTime deadline,
required String description,
}) {
final Event event = Event(
title: '$programName — Application Deadline',
description: description,
location: 'Online',
startDate: deadline.subtract(const Duration(hours: 1)),
endDate: deadline,
allDay: false,
);
Add2Calendar.addEvent2Cal(event);
}
````

### 3. Integrate into program detail screens

````dart
// In each program's detail screen
Column(children: [
DeadlineCountdown(
deadline: program.applicationDeadline,
label: 'Applications Close',
),
const SizedBox(height: 8),
ElevatedButton.icon(
icon: const Icon(Icons.calendar_today),
label: const Text('Add Reminder to Calendar'),
onPressed: () => addDeadlineToCalendar(
programName: program.name,
deadline: program.applicationDeadline,
description: 'Apply at: ${program.website}',
),
),
])
````

## 📁 Files to Modify

| File | Change |
|---|---|
| `pubspec.yaml` | Add `add_2_calendar` dependency |
| `lib/components/deadline_countdown.dart` | Create animated countdown widget |
| `lib/components/add_to_calendar_button.dart` | Create calendar integration button |
| All program detail screens in `lib/screens/` | Integrate deadline + calendar button |

**Suggested labels:** `enhancement`, `flutter`, `ux`, `feature`, `level: beginner`

I would like to work on this. Could you please assign it to me?

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.