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 { 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((ref) { return TilawahTrackingNotifier(); });