| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- import 'package:flutter/material.dart';
- import 'analysis_screen.dart';
- import 'live_analysis_screen.dart';
- import 'static_capture_screen.dart';
- import 'history_screen.dart';
- class HomeScreen extends StatelessWidget {
- const HomeScreen({super.key});
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text('Palm Oil Ripeness AI'),
- centerTitle: true,
- elevation: 2,
- ),
- body: Container(
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [Colors.green.shade50, Colors.white],
- ),
- ),
- child: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- _buildNavCard(
- context,
- title: 'Analyze Gallery',
- subtitle: 'Detect ripeness from photos',
- icon: Icons.photo_library,
- color: Colors.green,
- onTap: () => Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => const AnalysisScreen()),
- ),
- ),
- const SizedBox(height: 24),
- _buildNavCard(
- context,
- title: 'Snap & Analyze',
- subtitle: 'Manual high-res capture',
- icon: Icons.camera_alt,
- color: Colors.teal,
- onTap: () => Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => const StaticCaptureScreen()),
- ),
- ),
- const SizedBox(height: 24),
- _buildNavCard(
- context,
- title: 'Live Inference',
- subtitle: 'Real-time "Point-and-Scan"',
- icon: Icons.camera,
- color: Colors.orange,
- onTap: () => Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => const LiveAnalysisScreen()),
- ),
- ),
- const SizedBox(height: 24),
- _buildNavCard(
- context,
- title: 'History Vault',
- subtitle: 'View previous detections',
- icon: Icons.history,
- color: Colors.blue,
- onTap: () => Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => const HistoryScreen()),
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- Widget _buildNavCard(
- BuildContext context, {
- required String title,
- required String subtitle,
- required IconData icon,
- required Color color,
- required VoidCallback onTap,
- }) {
- return GestureDetector(
- onTap: onTap,
- child: Container(
- width: MediaQuery.of(context).size.width * 0.85,
- padding: const EdgeInsets.all(20),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(20),
- boxShadow: [
- BoxShadow(
- color: color.withOpacity(0.1),
- blurRadius: 15,
- offset: const Offset(0, 8),
- ),
- ],
- border: Border.all(color: color.withOpacity(0.2), width: 1),
- ),
- child: Row(
- children: [
- Container(
- padding: const EdgeInsets.all(12),
- decoration: BoxDecoration(
- color: color.withOpacity(0.1),
- borderRadius: BorderRadius.circular(15),
- ),
- child: Icon(icon, color: color, size: 30),
- ),
- const SizedBox(width: 20),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- title,
- style: TextStyle(
- fontSize: 18,
- fontWeight: FontWeight.bold,
- color: Colors.grey.shade800,
- ),
- ),
- const SizedBox(height: 4),
- Text(
- subtitle,
- style: TextStyle(
- fontSize: 14,
- color: Colors.grey.shade600,
- ),
- ),
- ],
- ),
- ),
- Icon(Icons.arrow_forward_ios, color: Colors.grey.shade400, size: 16),
- ],
- ),
- ),
- );
- }
- }
|