64 lines
2.1 KiB
Dart
64 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../models/hospital.dart';
|
|
import '../services/medical_service.dart';
|
|
import 'department_screen.dart';
|
|
|
|
class HospitalListScreen extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text('在线挂号')),
|
|
body: ListView.builder(
|
|
padding: EdgeInsets.all(16),
|
|
itemCount: MedicalService.mockHospitals.length,
|
|
itemBuilder: (context, index) {
|
|
final hospital = MedicalService.mockHospitals[index];
|
|
return Card(
|
|
margin: EdgeInsets.only(bottom: 12),
|
|
child: InkWell(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (_) => DepartmentScreen(hospital: hospital),
|
|
),
|
|
);
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
hospital.name,
|
|
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
|
|
),
|
|
SizedBox(height: 8),
|
|
Row(
|
|
children: [
|
|
Icon(Icons.location_on, size: 16, color: Colors.grey),
|
|
SizedBox(width: 4),
|
|
Text(hospital.address, style: TextStyle(color: Colors.grey)),
|
|
],
|
|
),
|
|
SizedBox(height: 8),
|
|
Wrap(
|
|
spacing: 8,
|
|
children: hospital.departments
|
|
.map((d) => Chip(
|
|
label: Text(d, style: TextStyle(fontSize: 12)),
|
|
padding: EdgeInsets.zero,
|
|
))
|
|
.toList(),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|