feat: complete Simple Mode contextual routing and navigation state synchronization
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:lucide_icons/lucide_icons.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
@@ -17,7 +18,14 @@ import '../../../core/providers/tilawah_tracking_provider.dart';
|
||||
class QuranReadingScreen extends ConsumerStatefulWidget {
|
||||
final String surahId;
|
||||
final int? initialVerse;
|
||||
const QuranReadingScreen({super.key, required this.surahId, this.initialVerse});
|
||||
final bool isSimpleModeTab;
|
||||
|
||||
const QuranReadingScreen({
|
||||
super.key,
|
||||
required this.surahId,
|
||||
this.initialVerse,
|
||||
this.isSimpleModeTab = false,
|
||||
});
|
||||
|
||||
@override
|
||||
ConsumerState<QuranReadingScreen> createState() => _QuranReadingScreenState();
|
||||
@@ -49,6 +57,14 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
bool _isHafalanPlaying = false;
|
||||
StreamSubscription? _playerStateSubscription;
|
||||
|
||||
void _navigateToMurattal() {
|
||||
if (widget.isSimpleModeTab) {
|
||||
context.push('/quran/${widget.surahId}/murattal');
|
||||
} else {
|
||||
context.push('/tools/quran/${widget.surahId}/murattal');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -274,7 +290,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.push_pin, color: AppColors.primary),
|
||||
leading: const Icon(LucideIcons.pin, color: AppColors.primary),
|
||||
title: const Text('Tandai Terakhir Dibaca', style: TextStyle(fontWeight: FontWeight.w600)),
|
||||
subtitle: const Text('Jadikan ayat ini sebagai titik lanjut membaca anda'),
|
||||
onTap: () {
|
||||
@@ -284,7 +300,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.favorite, color: Colors.pink),
|
||||
leading: const Icon(LucideIcons.heart, color: Colors.pink),
|
||||
title: const Text('Tambah ke Favorit', style: TextStyle(fontWeight: FontWeight.w600)),
|
||||
subtitle: const Text('Simpan ayat ini ke daftar favorit anda'),
|
||||
onTap: () {
|
||||
@@ -416,7 +432,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.auto_stories, size: 20, color: AppColors.primary),
|
||||
const Icon(LucideIcons.bookOpen, size: 20, color: AppColors.primary),
|
||||
const SizedBox(width: 8),
|
||||
Text('Total Dibaca: $calculatedAyat Ayat', style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15)),
|
||||
],
|
||||
@@ -558,7 +574,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.psychology,
|
||||
LucideIcons.brain,
|
||||
color: _isHafalanMode ? AppColors.primary : (isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight),
|
||||
),
|
||||
tooltip: 'Mode Hafalan',
|
||||
@@ -572,7 +588,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings_display),
|
||||
icon: const Icon(LucideIcons.settings2),
|
||||
onPressed: _showDisplaySettings,
|
||||
),
|
||||
],
|
||||
@@ -643,7 +659,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8),
|
||||
child: Icon(Icons.diamond,
|
||||
child: Icon(LucideIcons.gem,
|
||||
size: 10,
|
||||
color: AppColors.primary
|
||||
.withValues(alpha: 0.3)),
|
||||
@@ -724,8 +740,8 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
color: AppColors.primary,
|
||||
),
|
||||
)
|
||||
: Icon(Icons.stop_circle, color: AppColors.primary, size: 24))
|
||||
: Icon(Icons.play_circle_outline,
|
||||
: Icon(LucideIcons.stopCircle, color: AppColors.primary, size: 24))
|
||||
: Icon(LucideIcons.playCircle,
|
||||
color: isDark
|
||||
? AppColors.textSecondaryDark
|
||||
: AppColors.textSecondaryLight,
|
||||
@@ -755,8 +771,8 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
},
|
||||
icon: Icon(
|
||||
trackingSession == null
|
||||
? Icons.flag_outlined
|
||||
: Icons.stop_circle,
|
||||
? LucideIcons.flag
|
||||
: LucideIcons.stopCircle,
|
||||
color: trackingSession == null
|
||||
? (isDark
|
||||
? AppColors.textSecondaryDark
|
||||
@@ -767,7 +783,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
IconButton(
|
||||
onPressed: () => _showBookmarkOptions(i),
|
||||
icon: Icon(
|
||||
isLastRead ? Icons.push_pin : (isFav ? Icons.favorite : Icons.bookmark_outline),
|
||||
isLastRead ? LucideIcons.pin : (isFav ? LucideIcons.heart : LucideIcons.bookmark),
|
||||
color: isLastRead
|
||||
? AppColors.primary
|
||||
: (isFav ? Colors.pink : (isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight)),
|
||||
@@ -958,7 +974,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
],
|
||||
),
|
||||
child: Icon(
|
||||
_isHafalanPlaying ? Icons.stop_rounded : Icons.play_arrow_rounded,
|
||||
_isHafalanPlaying ? LucideIcons.square : LucideIcons.play,
|
||||
color: Colors.white,
|
||||
size: 28,
|
||||
),
|
||||
@@ -1015,7 +1031,7 @@ class _QuranReadingScreenState extends ConsumerState<QuranReadingScreen> {
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: onChanged,
|
||||
icon: const Icon(Icons.expand_more, size: 16),
|
||||
icon: const Icon(LucideIcons.chevronDown, size: 16),
|
||||
isDense: true,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user