feat(patient): implement doctor-only patient deletion, alert theme styling, and test auto-cleanup

This commit is contained in:
=
2026-09-22 13:41:14 -04:00
parent 73b69722a0
commit 654a7f402d
10 changed files with 616 additions and 16 deletions
@@ -50,25 +50,64 @@ class _DashboardViewState extends State<DashboardView> {
context: context,
barrierDismissible: false,
builder: (dialogContext) => AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
title: const Row(
backgroundColor: Colors.white,
surfaceTintColor: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
side: const BorderSide(color: AppColors.border),
),
titlePadding: const EdgeInsets.fromLTRB(24, 24, 24, 12),
contentPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
actionsPadding: const EdgeInsets.fromLTRB(24, 12, 24, 20),
title: Row(
children: [
Icon(Icons.logout_rounded, color: AppColors.error),
SizedBox(width: 10),
Text('Cerrar Sesión', style: TextStyle(fontWeight: FontWeight.bold)),
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppColors.error.withValues(alpha: 0.12),
shape: BoxShape.circle,
),
child: const Icon(Icons.logout_rounded, color: AppColors.error, size: 22),
),
const SizedBox(width: 12),
const Text('Cerrar Sesión', style: TextStyle(fontSize: 17, fontWeight: FontWeight.w700, color: AppColors.textPrimary)),
],
),
content: const Text('¿Está seguro de que desea salir del sistema Hidalyx Med?'),
content: Container(
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
color: AppColors.primaryContainer.withValues(alpha: 0.45),
borderRadius: BorderRadius.circular(10),
border: Border.all(color: AppColors.primary.withValues(alpha: 0.2)),
),
child: const Row(
children: [
Icon(Icons.info_outline_rounded, color: AppColors.primary, size: 20),
SizedBox(width: 10),
Expanded(
child: Text(
'¿Está seguro de que desea salir del sistema Hidalyx Med?',
style: TextStyle(fontSize: 13, color: AppColors.textPrimary, fontWeight: FontWeight.w500),
),
),
],
),
),
actions: [
TextButton(
onPressed: () => Navigator.of(dialogContext).pop(),
child: const Text('Cancelar'),
child: const Text('Cancelar', style: TextStyle(color: AppColors.textSecondary, fontWeight: FontWeight.w600)),
),
ElevatedButton(
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.error,
foregroundColor: Colors.white,
elevation: 0,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
),
icon: const Icon(Icons.logout_rounded, size: 16),
label: const Text('Salir del Sistema', style: TextStyle(fontWeight: FontWeight.w700)),
onPressed: () async {
Navigator.of(dialogContext).pop();
await AuthService().logout();
@@ -76,7 +115,6 @@ class _DashboardViewState extends State<DashboardView> {
context.go('/login');
}
},
child: const Text('Salir'),
),
],
),
@@ -276,6 +314,7 @@ class _DashboardViewState extends State<DashboardView> {
patientId: patient.id,
isSecretary: _isSecretary,
onSaved: (_) => _store.loadDashboardData(),
onDeleted: (_) => _store.loadDashboardData(),
),
);
}