- 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
55 lines
1.4 KiB
Dart
55 lines
1.4 KiB
Dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
/// Models an active reading session for Tilawah
|
|
class TilawahSession {
|
|
final int startSurahId;
|
|
final String startSurahName;
|
|
final int startVerseId;
|
|
|
|
const TilawahSession({
|
|
required this.startSurahId,
|
|
required this.startSurahName,
|
|
required this.startVerseId,
|
|
});
|
|
|
|
TilawahSession copyWith({
|
|
int? startSurahId,
|
|
String? startSurahName,
|
|
int? startVerseId,
|
|
}) {
|
|
return TilawahSession(
|
|
startSurahId: startSurahId ?? this.startSurahId,
|
|
startSurahName: startSurahName ?? this.startSurahName,
|
|
startVerseId: startVerseId ?? this.startVerseId,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// A state notifier to manage the global start state of a reading session.
|
|
/// If state is null, no active tracking is occurring.
|
|
class TilawahTrackingNotifier extends StateNotifier<TilawahSession?> {
|
|
TilawahTrackingNotifier() : super(null);
|
|
|
|
/// Start a new tracking session
|
|
void startTracking({
|
|
required int surahId,
|
|
required String surahName,
|
|
required int verseId
|
|
}) {
|
|
state = TilawahSession(
|
|
startSurahId: surahId,
|
|
startSurahName: surahName,
|
|
startVerseId: verseId,
|
|
);
|
|
}
|
|
|
|
/// Stop tracking (after recording)
|
|
void stopTracking() {
|
|
state = null;
|
|
}
|
|
}
|
|
|
|
final tilawahTrackingProvider = StateNotifierProvider<TilawahTrackingNotifier, TilawahSession?>((ref) {
|
|
return TilawahTrackingNotifier();
|
|
});
|