188 lines
6.9 KiB
Dart
188 lines
6.9 KiB
Dart
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 '../../../app/theme/app_colors.dart';
|
|
import '../../../core/widgets/tool_card.dart';
|
|
import '../../../data/services/equran_service.dart';
|
|
|
|
class ToolsScreen extends ConsumerWidget {
|
|
const ToolsScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Alat Islami'),
|
|
centerTitle: false,
|
|
actions: [
|
|
IconButton(
|
|
onPressed: () {},
|
|
icon: const Icon(LucideIcons.bell),
|
|
),
|
|
IconButton(
|
|
onPressed: () => context.push('/settings'),
|
|
icon: const Icon(LucideIcons.settings),
|
|
),
|
|
const SizedBox(width: 8),
|
|
],
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'AKSES CEPAT',
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w700,
|
|
letterSpacing: 1.5,
|
|
color: AppColors.sage,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.bookOpen,
|
|
title: 'Al-Quran\nTerjemahan',
|
|
color: const Color(0xFF00b894),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/quran'),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.headphones,
|
|
title: 'Quran\nMurattal',
|
|
color: const Color(0xFF7B61FF),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/quran/1/murattal'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.compass,
|
|
title: 'Arah\nKiblat',
|
|
color: const Color(0xFF0984E3),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/tools/qibla'),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.sparkles,
|
|
title: 'Tasbih\nDigital',
|
|
color: AppColors.primary,
|
|
isDark: isDark,
|
|
onTap: () => context.push('/dzikir'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 32),
|
|
// Ayat Hari Ini
|
|
FutureBuilder<Map<String, dynamic>?>(
|
|
future: EQuranService.instance.getDailyAyat(),
|
|
builder: (context, snapshot) {
|
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: isDark ? AppColors.primary.withValues(alpha: 0.08) : const Color(0xFFF5F9F0),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: const Center(child: CircularProgressIndicator()),
|
|
);
|
|
}
|
|
|
|
if (!snapshot.hasData || snapshot.data == null) {
|
|
return const SizedBox.shrink(); // Hide if error/no internet
|
|
}
|
|
|
|
final data = snapshot.data!;
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(20),
|
|
decoration: BoxDecoration(
|
|
color: isDark ? AppColors.primary.withValues(alpha: 0.08) : const Color(0xFFF5F9F0),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'Ayat Hari Ini',
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w600,
|
|
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight,
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: Icon(LucideIcons.share2,
|
|
size: 18,
|
|
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight),
|
|
onPressed: () {},
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Align(
|
|
alignment: Alignment.centerRight,
|
|
child: Text(
|
|
data['teksArab'] ?? '',
|
|
style: const TextStyle(
|
|
fontFamily: 'Amiri',
|
|
fontSize: 24,
|
|
height: 1.8,
|
|
),
|
|
textAlign: TextAlign.right,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'"${data['teksIndonesia'] ?? ''}"',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontStyle: FontStyle.italic,
|
|
height: 1.5,
|
|
color: isDark ? Colors.white : Colors.black87,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'QS. ${data['surahName']}: ${data['nomorAyat']}',
|
|
style: const TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.primary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|