87 lines
3.6 KiB
Dart
87 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'medical_screen.dart';
|
|
|
|
class ServicesScreen extends StatelessWidget {
|
|
const ServicesScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('生活服务')),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
const Text('服务分类', style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600)),
|
|
const SizedBox(height: 16),
|
|
Row(
|
|
children: [
|
|
_serviceCard(context, '🏥', '医疗健康', true, () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (_) => const MedicalScreen()));
|
|
}),
|
|
const SizedBox(width: 12),
|
|
_serviceCard(context, '🏠', '家政服务', false, null),
|
|
const SizedBox(width: 12),
|
|
_serviceCard(context, '🛒', '生活消费', false, null),
|
|
const SizedBox(width: 12),
|
|
_serviceCard(context, '🔒', '更多', false, null),
|
|
],
|
|
),
|
|
const SizedBox(height: 32),
|
|
// Quick access
|
|
const Text('快捷入口', style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600)),
|
|
const SizedBox(height: 16),
|
|
_quickAccess(context, Icons.local_hospital, '在线挂号', '预约三甲医院专家号', () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (_) => const MedicalScreen()));
|
|
}),
|
|
_quickAccess(context, Icons.chat_bubble_outline, '在线问诊', '¥19.9/次 专业医生解答', () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (_) => const MedicalScreen()));
|
|
}),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _serviceCard(BuildContext context, String emoji, String label, bool active, VoidCallback? onTap) {
|
|
return Expanded(
|
|
child: GestureDetector(
|
|
onTap: active ? onTap : () {
|
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('$label即将开放', style: const TextStyle(fontSize: 16))));
|
|
},
|
|
child: Container(
|
|
height: 100,
|
|
decoration: BoxDecoration(
|
|
color: active ? const Color(0xFFE3F2FD) : const Color(0xFFF5F5F5),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(emoji, style: const TextStyle(fontSize: 28)),
|
|
const SizedBox(height: 8),
|
|
Text(label, style: TextStyle(fontSize: 13, color: active ? const Color(0xFF1976D2) : const Color(0xFF999999))),
|
|
if (!active) const Text('即将开放', style: TextStyle(fontSize: 11, color: Color(0xFFCCCCCC))),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _quickAccess(BuildContext context, IconData icon, String title, String subtitle, VoidCallback onTap) {
|
|
return Card(
|
|
margin: const EdgeInsets.only(bottom: 12),
|
|
child: ListTile(
|
|
onTap: onTap,
|
|
leading: CircleAvatar(backgroundColor: const Color(0xFFE3F2FD), child: Icon(icon, color: const Color(0xFF1976D2))),
|
|
title: Text(title, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600)),
|
|
subtitle: Text(subtitle, style: const TextStyle(fontSize: 14, color: Color(0xFF999999))),
|
|
trailing: const Icon(Icons.chevron_right),
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
),
|
|
);
|
|
}
|
|
}
|