import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:medora/data/models/doctor.dart'; import 'package:medora/route/route_names.dart'; class DoctorDetailsScreen extends StatelessWidget { final Doctor doctor; const DoctorDetailsScreen({ super.key, required this.doctor, }); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFFF5F7FF), body: Column( children: [ _buildAppBar(context), Expanded( child: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _buildDoctorCard(), const SizedBox(height: 24), _buildDescription(), const SizedBox(height: 24), _buildQualifications(), ], ), ), ), ), Padding( padding: const EdgeInsets.all(16.0), child: SizedBox( width: double.infinity, child: ElevatedButton( onPressed: () { Navigator.pushNamed( context, RouteNames.consultationCenterScreen, arguments: { 'doctor': doctor, }); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.blue, padding: const EdgeInsets.symmetric(vertical: 16), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), disabledBackgroundColor: Colors.grey[300], ), child: Text( 'Confirm Booking', style: GoogleFonts.poppins( fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, ), ), ), ), ), ], ), ); } Widget _buildAppBar(BuildContext context) { return Container( color: Colors.white, child: AppBar( backgroundColor: Colors.white, elevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back, color: Colors.black87), onPressed: () => Navigator.pop(context), ), title: Text( 'Doctor', style: GoogleFonts.poppins( color: Colors.black87, fontWeight: FontWeight.w600, fontSize: 20, ), ), centerTitle: true, ), ); } Widget _buildDoctorCard() { return Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.1), blurRadius: 10, offset: const Offset(0, 2), ), ], ), child: Column( children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ ClipRRect( borderRadius: BorderRadius.circular(12), child: Image.network( doctor.profileImage!, width: 100, height: 100, fit: BoxFit.cover, errorBuilder: (context, error, stackTrace) { return Container( width: 100, height: 100, color: Colors.grey[300], child: Icon(Icons.person, size: 50, color: Colors.grey[600]), ); }, ), ), const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( doctor.firstName ?? '', style: GoogleFonts.poppins( fontSize: 20, fontWeight: FontWeight.w600, ), ), Text( doctor.speciality!, style: GoogleFonts.poppins( fontSize: 14, color: Colors.grey[600], ), ), const SizedBox(height: 8), Row( children: [ Icon(Icons.medical_services, size: 16, color: Colors.blue[400]), const SizedBox(width: 4), Expanded( child: Text( doctor.speciality!, style: GoogleFonts.poppins( fontSize: 14, color: Colors.grey[600], ), ), ), ], ), Row( children: [ Icon(Icons.location_on, size: 16, color: Colors.blue[400]), const SizedBox(width: 4), Expanded( child: Text( doctor.city!, style: GoogleFonts.poppins( fontSize: 14, color: Colors.grey[600], ), ), ), ], ), Row( children: [ Icon(Icons.star, size: 16, color: Colors.blue[400]), const SizedBox(width: 4), Text( '${doctor.yearsOfExperience} Years', style: GoogleFonts.poppins( fontSize: 14, color: Colors.grey[600], ), ), ], ), ], ), ), ], ), ], ), ); } Widget _buildDescription() { return Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.1), blurRadius: 10, offset: const Offset(0, 2), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Description', style: GoogleFonts.poppins( fontSize: 18, fontWeight: FontWeight.w600, ), ), const SizedBox(height: 8), Text( doctor.profileDescription!, style: GoogleFonts.poppins( fontSize: 14, color: Colors.grey[600], ), maxLines: 3, overflow: TextOverflow.ellipsis, ), TextButton( onPressed: () {}, child: Text( 'Read more', style: GoogleFonts.poppins( color: Colors.blue, fontWeight: FontWeight.w500, ), ), ), ], ), ); } Widget _buildQualifications() { return Container( padding: const EdgeInsets.all(16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.1), blurRadius: 10, offset: const Offset(0, 2), ), ], ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Qualifications', style: GoogleFonts.poppins( fontSize: 18, fontWeight: FontWeight.w600, ), ), const SizedBox(height: 8), ...doctor.qualifications!.map((qual) => Padding( padding: const EdgeInsets.only(bottom: 4), child: Text( qual.toString(), style: GoogleFonts.poppins( fontSize: 14, color: Colors.grey[600], ), ), )), ], ), ); } }