import 'package:flutter/material.dart'; import '../models/hospital.dart'; import '../services/medical_service.dart'; import 'booking_screen.dart'; class DoctorListScreen extends StatelessWidget { final Hospital hospital; final String department; const DoctorListScreen({ required this.hospital, required this.department, }); @override Widget build(BuildContext context) { final doctors = MedicalService.getDoctorsByDepartment(department); return Scaffold( appBar: AppBar(title: Text('$department - 选择医生')), body: doctors.isEmpty ? Center(child: Text('暂无医生')) : ListView.builder( padding: EdgeInsets.all(16), itemCount: doctors.length, itemBuilder: (context, index) { final doctor = doctors[index]; return Card( margin: EdgeInsets.only(bottom: 12), child: InkWell( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (_) => BookingScreen( hospital: hospital, doctor: doctor, ), ), ); }, child: Padding( padding: EdgeInsets.all(16), child: Row( children: [ CircleAvatar( radius: 30, child: Text(doctor.name[0]), ), SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( doctor.name, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500), ), SizedBox(height: 4), Text(doctor.title, style: TextStyle(color: Colors.grey)), ], ), ), Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ Text('挂号费', style: TextStyle(fontSize: 12, color: Colors.grey)), Text( '¥${doctor.fee}', style: TextStyle(fontSize: 18, color: Color(0xFF333333)), ), ], ), ], ), ), ), ); }, ), ); } }