import 'package:flutter/material.dart'; import 'widgets/patrol_chart.dart'; class DashboardHome extends StatelessWidget { const DashboardHome({super.key}); @override Widget build(BuildContext context) { return SafeArea( child: Padding( padding: const EdgeInsets.all(16), child: ListView( children: [ // HEADER Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [ Text( 'Dashboard', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold), ), Icon(Icons.security, size: 28), ], ), const SizedBox(height: 20), // STATUS PATROLI Card( color: Colors.blue, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), child: const Padding( padding: EdgeInsets.all(16), child: Row( children: [ Icon(Icons.check_circle, color: Colors.white, size: 40), SizedBox(width: 12), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Status Patroli', style: TextStyle(color: Colors.white70), ), Text( 'Aktif', style: TextStyle( color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold, ), ), Text( 'Update terakhir: 10:30', style: TextStyle(color: Colors.white70, fontSize: 12), ), ], ), ], ), ), ), const SizedBox(height: 20), // RINGKASAN Row( children: const [ _SummaryCard( title: 'Total Patroli', value: '12', icon: Icons.directions_walk, color: Colors.green, ), SizedBox(width: 10), _SummaryCard( title: 'Laporan', value: '3', icon: Icons.report, color: Colors.orange, ), ], ), const SizedBox(height: 25), // GRAFIK const Text( 'Grafik Aktivitas', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), ), const SizedBox(height: 10), // GRAFIK PATROLI SizedBox(height: 220, child: PatrolChart()), ], ), ), ); } } // ================= SUMMARY CARD ================= class _SummaryCard extends StatelessWidget { final String title; final String value; final IconData icon; final Color color; const _SummaryCard({ required this.title, required this.value, required this.icon, required this.color, }); @override Widget build(BuildContext context) { return Expanded( child: Card( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), child: Padding( padding: const EdgeInsets.all(16), child: Column( children: [ Icon(icon, color: color, size: 30), const SizedBox(height: 10), Text( value, style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), Text(title, style: const TextStyle(color: Colors.grey)), ], ), ), ), ); } }