import 'package:flutter/material.dart'; void main() { runApp(const PlantApp()); } class PlantApp extends StatelessWidget { const PlantApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Plant', debugShowCheckedModeBanner: false, theme: ThemeData( scaffoldBackgroundColor: const Color(0xFFFBF9F6), // خلفية دافئة مريحة للعين colorScheme: ColorScheme.fromSeed( seedColor: const Color(0xFF6B8E23), // اللون الأخضر المريمي الأساسي primary: const Color(0xFF4A6B32), secondary: const Color(0xFF8A9A86), ), fontFamily: 'Roboto', // يمكنك تغييره للخط العربي المفضل لديك لاحقاً ), home: const HomeScreen(), ); } } // 1. الصفحة الرئيسية للتطبيق class HomeScreen extends StatelessWidget { const HomeScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Plant', style: TextStyle(fontWeight: FontWeight.bold, color: Color(0xFF2C3E2B))), backgroundColor: Colors.transparent, elevation: 0, centerTitle: true, ), body: Padding( padding: const EdgeInsets.all(24.0), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ const Spacer(), // قسم الترحيب والهوية Center( child: Column( children: [ Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( color: const Color(0xFFE8EFE6), shape: BoxShape.circle, ), child: const Icon(Icons.psychology_alt_outlined, size: 80, color: Color(0xFF4A6B32)), ), const SizedBox(height: 24), const Text( 'اكتشف عالم النباتات بالذكاء الاصطناعي', textAlign: TextAlign.center, style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Color(0xFF2C3E2B)), ), const SizedBox(height: 12), const Text( 'التقط صورة أو قم برفعها ليتعرف التطبيق على نوع النبتة وتفاصيل العناية بها فوراً', textAlign: TextAlign.center, style: TextStyle(fontSize: 14, color: Colors.grey), ), ], ), ), const Spacer(), // أزرار التحكم بالتقاط الصور ElevatedButton.icon( onPressed: () { // هنا يتم ربط الكاميرا مستقبلاً، وسننتقل الآن لصفحة النتيجة كمثال Navigator.push(context, MaterialPageRoute(builder: (context) => const PlantResultScreen())); }, icon: const Icon(Icons.camera_alt_rounded, color: Colors.white), label: const Text('التقط صورة بالنبتة', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.white)), style: ElevatedButton.styleFrom( backgroundColor: const Color(0xFF4A6B32), padding: const EdgeInsets.symmetric(vertical: 16), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), elevation: 0, ), ), const SizedBox(height: 12), OutlinedButton.icon( onPressed: () { Navigator.push(context, MaterialPageRoute(builder: (context) => const PlantResultScreen())); }, icon: const Icon(Icons.image_search_rounded, color: Color(0xFF4A6B32)), label: const Text('إضافة صورة من المعرض', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF4A6B32))), style: OutlinedButton.styleFrom( side: const BorderSide(color: Color(0xFF4A6B32), width: 1.5), padding: const EdgeInsets.symmetric(vertical: 16), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), ), ), const SizedBox(height: 20), ], ), ), ); } } // 2. صفحة نتيجة تحليل الذكاء الاصطناعي class PlantResultScreen extends StatelessWidget { const PlantResultScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('تحليل الذكاء الاصطناعي', style: TextStyle(color: Color(0xFF2C3E2B))), backgroundColor: Colors.transparent, elevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back_ios_new_rounded, color: Color(0xFF2C3E2B)), onPressed: () => Navigator.pop(context), ), ), body: SingleChildScrollView( padding: const EdgeInsets.all(24.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // محاكي لصورة النبتة المرفوعة بدلاً من استخدام ملفات حقيقية مؤقتاً Container( height: 220, width: double.infinity, decoration: BoxDecoration( color: const Color(0xFFE8EFE6), borderRadius: BorderRadius.circular(24), ), child: const Center( child: Icon(Icons.eco_rounded, size: 100, color: Color(0xFF4A6B32)), ), ), const SizedBox(height: 24), // الاسم والنوع const Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('نبتة المونستيرا (القفص الصدري)', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Color(0xFF2C3E2B))), SizedBox(height: 4), Text('Monstera Deliciosa', style: TextStyle(fontSize: 16, fontStyle: FontStyle.italic, color: Colors.grey)), ], ), Text('🌳 داخلي', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Color(0xFF4A6B32))), ], ), const SizedBox(height: 24), const Divider(color: Color(0xFFE0E0E0)), const SizedBox(height: 16), const Text('دليل العناية الذكي', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Color(0xFF2C3E2B))), const SizedBox(height: 16), // بطاقات العناية الذكية مرتبة بشكل مريح Row( children: [ _buildCareCard(Icons.water_drop_outlined, 'الري', 'معتدل (كل 7 أيام)'), const SizedBox(width: 12), _buildCareCard(Icons.wb_sunny_outlined, 'الإضاءة', 'غير مباشرة / ظل'), ], ), const SizedBox(height: 12), Row( children: [ _buildCareCard(Icons.device_thermostat_outlined, 'الطقس', '20°C - 30°C'), const SizedBox(width: 12), _buildCareCard(Icons.health_and_safety_outlined, 'الحالة الصحية', 'ممتازة 100%'), ], ), const SizedBox(height: 24), const Text('تفاصيل النبتة', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Color(0xFF2C3E2B))), const SizedBox(height: 12), Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow(color: Colors.black.withOpacity(0.02), blurRadius: 10, offset: const Offset(0, 4)), ], ), child: const Text( 'تعتبر المونستيرا من أشهر نباتات الزينة الداخلية، وتتميز بأوراقها الكبيرة والمخرمة التي تضفي لمسة جمالية على المكان. موطنها الأصلي الغابات الاستوائية في أمريكا الوسطى، وهي نبتة قوية وسهلة العناية للمبتدئين.', style: TextStyle(fontSize: 14, color: Color(0xFF555555), height: 1.6), ), ), ], ), ), ); } // ودجت مخصصة لبناء بطاقات العناية بشكل متناسق static Widget _buildCareCard(IconData icon, String title, String value) { return Expanded( child: Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), border: Border.all(color: const Color(0xFFE8EFE6), width: 1.5), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Icon(icon, color: const Color(0xFF4A6B32), size: 28), const SizedBox(height: 12), Text(title, style: const TextStyle(fontSize: 14, color: Colors.grey)), const SizedBox(height: 4), Text(value, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xFF2C3E2B))), ], ), ), ); } }