- Murattal: Spotify-style 5-button controls [Shuffle, Prev, Play, Next, Playlist] - Murattal: Animated 7-bar equalizer visualization in player circle - Murattal: Unsplash API background with frosted glass player overlay - Murattal: Transparent AppBar with backdrop blur - Murattal: Surah playlist bottom sheet with full 114 Surah list - Murattal: Auto-play disabled on screen open, enabled on navigation - Murattal: Shuffle mode for random Surah playback - Murattal: Photographer attribution per Unsplash guidelines - Dashboard: Auto-scroll prayer schedule to next active prayer - Fix: setState lifecycle errors on Reading & Murattal screens - Setup: flutter_dotenv, cached_network_image, url_launcher deps
87 lines
1.8 KiB
Dart
87 lines
1.8 KiB
Dart
import 'package:hive_flutter/hive_flutter.dart';
|
|
import 'shalat_log.dart';
|
|
import 'tilawah_log.dart';
|
|
import 'dzikir_log.dart';
|
|
import 'puasa_log.dart';
|
|
|
|
part 'daily_worship_log.g.dart';
|
|
|
|
/// Daily worship completion log, keyed by date string 'yyyy-MM-dd'.
|
|
@HiveType(typeId: 2)
|
|
class DailyWorshipLog extends HiveObject {
|
|
@HiveField(0)
|
|
String date;
|
|
|
|
@HiveField(1)
|
|
Map<String, ShalatLog> shalatLogs; // e.g., 'subuh' -> ShalatLog
|
|
|
|
@HiveField(5)
|
|
TilawahLog? tilawahLog;
|
|
|
|
@HiveField(6)
|
|
DzikirLog? dzikirLog;
|
|
|
|
@HiveField(7)
|
|
PuasaLog? puasaLog;
|
|
|
|
@HiveField(2)
|
|
int totalItems;
|
|
|
|
@HiveField(3)
|
|
int completedCount;
|
|
|
|
@HiveField(4)
|
|
double completionPercent;
|
|
|
|
DailyWorshipLog({
|
|
required this.date,
|
|
Map<String, ShalatLog>? shalatLogs,
|
|
this.tilawahLog,
|
|
this.dzikirLog,
|
|
this.puasaLog,
|
|
this.totalItems = 0,
|
|
this.completedCount = 0,
|
|
this.completionPercent = 0.0,
|
|
}) : shalatLogs = shalatLogs ?? {};
|
|
|
|
/// Dynamically calculates the "Poin Ibadah" for this day.
|
|
int get totalPoints {
|
|
int points = 0;
|
|
|
|
// 1. Shalat Fardhu
|
|
for (final sLog in shalatLogs.values) {
|
|
if (sLog.completed) {
|
|
if (sLog.location == 'Masjid') {
|
|
points += 25;
|
|
} else {
|
|
points += 10;
|
|
}
|
|
}
|
|
if (sLog.qabliyah == true) points += 5;
|
|
if (sLog.badiyah == true) points += 5;
|
|
}
|
|
|
|
// 2. Tilawah
|
|
if (tilawahLog != null) {
|
|
// 1 point per Ayat read
|
|
points += tilawahLog!.rawAyatRead;
|
|
|
|
// Bonus 20 points for completing daily target
|
|
if (tilawahLog!.isCompleted) {
|
|
points += 20;
|
|
}
|
|
}
|
|
|
|
// 3. Dzikir & Puasa
|
|
if (dzikirLog != null) {
|
|
if (dzikirLog!.pagi) points += 10;
|
|
if (dzikirLog!.petang) points += 10;
|
|
}
|
|
if (puasaLog != null && puasaLog!.completed) {
|
|
points += 30;
|
|
}
|
|
|
|
return points;
|
|
}
|
|
}
|