237 lines
8.5 KiB
Dart
237 lines
8.5 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/muslim_api_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: SingleChildScrollView(
|
|
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('/tools/quran'),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.headphones,
|
|
title: 'Quran\nMurattal',
|
|
color: const Color(0xFF7B61FF),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/tools/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: 'Dzikir\nHarian',
|
|
color: AppColors.primary,
|
|
isDark: isDark,
|
|
onTap: () => context.push('/tools/dzikir'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.heart,
|
|
title: 'Kumpulan\nDoa',
|
|
color: const Color(0xFFE17055),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/tools/doa'),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.library,
|
|
title: "Hadits\nArba'in",
|
|
color: const Color(0xFF6C5CE7),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/tools/hadits'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ToolCard(
|
|
icon: LucideIcons.sparkles,
|
|
title: 'Quran\nEnrichment',
|
|
color: const Color(0xFF00CEC9),
|
|
isDark: isDark,
|
|
onTap: () => context.push('/tools/quran/enrichment'),
|
|
),
|
|
),
|
|
const Expanded(child: SizedBox()),
|
|
],
|
|
),
|
|
const SizedBox(height: 28),
|
|
FutureBuilder<Map<String, dynamic>?>(
|
|
future: MuslimApiService.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();
|
|
}
|
|
|
|
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,
|
|
fontWeight: FontWeight.w400,
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|