mangayomi-mirror/lib/modules/calendar/models/upcoming_ui_model.dart
Moustapha Kodjo Amadou 95a55d5f81 feat: Implement upcoming manga calendar feature
- Added UpcomingUIModel for managing upcoming manga list items with headers and items.
- Introduced CalendarDay widget to display individual days with event indicators.
- Created CalendarHeader widget for navigating between months.
- Developed CalendarIndicator for visualizing events on specific days.
- Implemented UpcomingCalendar to manage the calendar view and event loading.
- Added UpcomingItem widget for displaying individual upcoming manga with cover images.
- Introduced FetchInterval utility to calculate fetch intervals based on chapter upload dates.
- Refactored updateMangaDetail to utilize FetchInterval for smart update days.
- Enhanced MedianExtension to ensure correct median calculation.
- Removed unused imports and commented-out code for cleaner implementation.
2026-03-05 12:05:29 +01:00

41 lines
1 KiB
Dart

import 'package:mangayomi/models/manga.dart';
/// Sealed model for upcoming manga list items.
///
/// The list alternates between [Header] (date separator with count badge)
/// and [Item] (individual manga) entries.
sealed class UpcomingUIModel {
const UpcomingUIModel();
}
class UpcomingHeader extends UpcomingUIModel {
final DateTime date;
final int mangaCount;
const UpcomingHeader({required this.date, required this.mangaCount});
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is UpcomingHeader &&
date == other.date &&
mangaCount == other.mangaCount;
@override
int get hashCode => Object.hash(date, mangaCount);
}
class UpcomingItem extends UpcomingUIModel {
final Manga manga;
final DateTime expectedDate;
const UpcomingItem({required this.manga, required this.expectedDate});
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is UpcomingItem && manga.id == other.manga.id;
@override
int get hashCode => manga.id.hashCode;
}