import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:telemednet/screens/patientScreens/appoinmentBooking/speciality_screen.dart'; class PatientHomeScreen extends StatefulWidget { const PatientHomeScreen({super.key}); @override State createState() => _PatientHomeScreenState(); } class _PatientHomeScreenState extends State with SingleTickerProviderStateMixin { late AnimationController _animationController; @override void initState() { super.initState(); _animationController = AnimationController( vsync: this, duration: const Duration(milliseconds: 300), ); _animationController.forward(); } @override void dispose() { _animationController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: Column( children: [ _buildSearchBar(), Expanded( child: ListView( padding: const EdgeInsets.all(16), children: [ _buildRealTimeCard(), const SizedBox(height: 20), _buildConsultationsSection(), const SizedBox(height: 20), _buildFindDoctorSection(), ], ), ), // _buildBottomNavBar(), ], ), ), ); } Widget _buildSearchBar() { return Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( gradient: LinearGradient( colors: [ Colors.blue[400]!, Colors.blue[300]!, ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(30.0), bottomRight: Radius.circular(30.0), ), boxShadow: [ BoxShadow( color: Colors.blue.withOpacity(0.3), blurRadius: 10, offset: const Offset(0, 5), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(30), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), blurRadius: 10, offset: const Offset(0, 5), ), ], ), child: TextField( decoration: InputDecoration( hintText: 'Search Doctor/Hospital/Symptoms', hintStyle: GoogleFonts.poppins( color: Colors.grey[400], ), prefixIcon: const Icon(Icons.search, color: Colors.blue), border: OutlineInputBorder( borderRadius: BorderRadius.circular(30), borderSide: BorderSide.none, ), contentPadding: const EdgeInsets.symmetric(horizontal: 20), ), ), ), ], ), ); } Widget _buildRealTimeCard() { return Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( gradient: LinearGradient( colors: [Colors.blue[400]!, Colors.white], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: Colors.blue.withOpacity(0.3), blurRadius: 10, offset: const Offset(0, 5), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Real-time care\nat your fingertips.', style: GoogleFonts.poppins( fontSize: 30, fontWeight: FontWeight.bold, color: const Color.fromARGB(221, 67, 67, 67), ), ), const SizedBox(height: 12), ElevatedButton( onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const SpecialtyScreen()), ); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.white, foregroundColor: Colors.blue[700], padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 7), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), ), elevation: 5, ), child: Text( 'Start Consultation', style: GoogleFonts.poppins( fontWeight: FontWeight.bold, ), ), ), ], ), ); } Widget _buildConsultationsSection() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Upcoming Consultations', style: GoogleFonts.poppins( fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 16), SizedBox( height: 160, child: ListView( scrollDirection: Axis.horizontal, children: [ _consultationCard( 'Dr. Smith', '23/09/2024\n5:00 PM - 6:00 PM', 'Cardiologist'), const SizedBox(width: 16), _consultationCard('Dr. Johnson', '24/09/2024\n3:30 PM - 4:30 PM', 'Pediatrician'), ], ), ), ], ); } Widget _consultationCard(String name, String schedule, String speciality) { return Container( width: 280, padding: const EdgeInsets.all(16), decoration: BoxDecoration( gradient: LinearGradient( colors: [Colors.white, Colors.grey[50]!], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.2), blurRadius: 10, offset: const Offset(0, 5), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Container( width: 60, height: 60, decoration: BoxDecoration( color: Colors.blue[100], shape: BoxShape.circle, ), child: const Icon( Icons.person, size: 40, color: Colors.white, ), ), const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( name, style: GoogleFonts.poppins( fontSize: 16, fontWeight: FontWeight.bold, ), ), Text( speciality, style: GoogleFonts.poppins( color: Colors.grey[600], ), ), ], ), ), ], ), const SizedBox(height: 12), Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( color: Colors.blue[50], borderRadius: BorderRadius.circular(10), ), child: Text( schedule, style: GoogleFonts.poppins( color: Colors.blue[700], fontSize: 12, ), ), ), ], ), ); } Widget _buildFindDoctorSection() { final specialistData = [ { 'icon': Icons.local_hospital, 'label': 'General', 'color': Colors.blue, 'description': 'Primary Healthcare' }, { 'icon': Icons.remove_red_eye, 'label': 'Eye', 'color': Colors.indigo, 'description': 'Vision Care' }, { 'icon': Icons.medical_services, 'label': 'Dental', 'color': Colors.amber, 'description': 'Oral Health' }, { 'icon': Icons.favorite, 'label': 'Cardio', 'color': Colors.red, 'description': 'Heart Specialist' }, { 'icon': Icons.psychology, 'label': 'Mental', 'color': Colors.green, 'description': 'Mental Health' }, { 'icon': Icons.child_care, 'label': 'Pediatric', 'color': Colors.purple, 'description': 'Child Care' }, { 'icon': Icons.elderly, 'label': 'Geriatric', 'color': Colors.teal, 'description': 'Senior Care' }, { 'icon': Icons.fitness_center, 'label': 'Physio', 'color': Colors.orange, 'description': 'Physical Therapy' }, ]; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: Text( 'Find Specialists', style: GoogleFonts.poppins( fontSize: 20, fontWeight: FontWeight.bold, ), ), ), const SizedBox(height: 16), Row( children: [ Expanded( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( children: [ for (final data in specialistData) Padding( padding: const EdgeInsets.symmetric(horizontal: 8), child: _specialistCard( icon: data['icon'] as IconData, label: data['label'] as String, color: data['color'] as Color, description: data['description'] as String, ), ), const SizedBox(width: 8), ], ), ), ), IconButton( icon: const Icon(Icons.arrow_forward, color: Colors.blue), onPressed: () { Navigator.push( context, MaterialPageRoute( builder: (context) => const SpecialtyScreen()), ); }, ), ], ), ], ); } Widget _specialistCard({ required IconData icon, required String label, required Color color, required String description, }) { return GestureDetector( onTap: () { // Replace with your desired navigation action }, child: Container( width: 140, padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: color.withOpacity(0.1), blurRadius: 10, offset: const Offset(0, 4), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: color.withOpacity(0.1), borderRadius: BorderRadius.circular(12), ), child: Icon(icon, color: color, size: 24), ), const SizedBox(height: 8), Text( label, style: GoogleFonts.poppins( color: Colors.black87, fontSize: 16, fontWeight: FontWeight.bold, ), ), Text( description, style: GoogleFonts.poppins( color: Colors.grey[600], fontSize: 12, ), ), ], ), ), ); } }