147 lines
4.7 KiB
Dart
147 lines
4.7 KiB
Dart
import 'package:flutter/material.dart';
|
|||
|
|
import '../../../../core/theme/app_colors.dart';
|
||
|
|
|
||
|
|
enum QuickActionType {
|
||
|
|
nuevoPaciente,
|
||
|
|
buscarPaciente,
|
||
|
|
configuracion,
|
||
|
|
}
|
||
|
|
|
||
|
|
typedef QuickActionBar = QuickActionsDropdown;
|
||
|
|
|
||
|
|
class QuickActionsDropdown extends StatelessWidget {
|
||
|
|
final ValueChanged<QuickActionType>? onActionSelected;
|
||
|
|
final bool isSecretary;
|
||
|
|
|
||
|
|
const QuickActionsDropdown({
|
||
|
|
super.key,
|
||
|
|
this.onActionSelected,
|
||
|
|
this.isSecretary = false,
|
||
|
|
});
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Row(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
children: [
|
||
|
|
// 1. Botón Buscar Paciente (Acción Secundaria / Buscador Rápido)
|
||
|
|
Tooltip(
|
||
|
|
message: 'Buscar paciente por nombre, cédula o teléfono',
|
||
|
|
child: Material(
|
||
|
|
color: Colors.transparent,
|
||
|
|
child: InkWell(
|
||
|
|
borderRadius: BorderRadius.circular(8),
|
||
|
|
onTap: () => onActionSelected?.call(QuickActionType.buscarPaciente),
|
||
|
|
child: Container(
|
||
|
|
height: 36,
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: AppColors.background,
|
||
|
|
borderRadius: BorderRadius.circular(8),
|
||
|
|
border: Border.all(color: AppColors.border),
|
||
|
|
),
|
||
|
|
child: const Row(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
children: [
|
||
|
|
Icon(
|
||
|
|
Icons.search_rounded,
|
||
|
|
color: AppColors.textSecondary,
|
||
|
|
size: 17,
|
||
|
|
),
|
||
|
|
SizedBox(width: 7),
|
||
|
|
Text(
|
||
|
|
'Buscar Paciente',
|
||
|
|
style: TextStyle(
|
||
|
|
fontSize: 13,
|
||
|
|
fontWeight: FontWeight.w500,
|
||
|
|
color: AppColors.textSecondary,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
|
||
|
|
const SizedBox(width: 8),
|
||
|
|
|
||
|
|
// 2. Botón Nuevo Paciente (Acción Primaria Destacada de 1 clic)
|
||
|
|
Tooltip(
|
||
|
|
message: 'Registrar nuevo paciente',
|
||
|
|
child: Material(
|
||
|
|
color: Colors.transparent,
|
||
|
|
child: InkWell(
|
||
|
|
borderRadius: BorderRadius.circular(8),
|
||
|
|
onTap: () => onActionSelected?.call(QuickActionType.nuevoPaciente),
|
||
|
|
child: Container(
|
||
|
|
height: 36,
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: AppColors.primary,
|
||
|
|
borderRadius: BorderRadius.circular(8),
|
||
|
|
boxShadow: [
|
||
|
|
BoxShadow(
|
||
|
|
color: AppColors.primary.withValues(alpha: 0.22),
|
||
|
|
blurRadius: 6,
|
||
|
|
offset: const Offset(0, 2),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
child: const Row(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
children: [
|
||
|
|
Icon(
|
||
|
|
Icons.person_add_rounded,
|
||
|
|
color: Colors.white,
|
||
|
|
size: 17,
|
||
|
|
),
|
||
|
|
SizedBox(width: 7),
|
||
|
|
Text(
|
||
|
|
'Nuevo Paciente',
|
||
|
|
style: TextStyle(
|
||
|
|
fontSize: 13,
|
||
|
|
fontWeight: FontWeight.w600,
|
||
|
|
color: Colors.white,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
|
||
|
|
// 3. Botón Configuración (Solo Doctor / Administrador, oculto para Secretaria)
|
||
|
|
if (!isSecretary) ...[
|
||
|
|
const SizedBox(width: 8),
|
||
|
|
Tooltip(
|
||
|
|
message: 'Configuración del Consultorio',
|
||
|
|
child: Material(
|
||
|
|
color: Colors.transparent,
|
||
|
|
child: InkWell(
|
||
|
|
borderRadius: BorderRadius.circular(8),
|
||
|
|
onTap: () => onActionSelected?.call(QuickActionType.configuracion),
|
||
|
|
child: Container(
|
||
|
|
height: 36,
|
||
|
|
width: 36,
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: AppColors.background,
|
||
|
|
borderRadius: BorderRadius.circular(8),
|
||
|
|
border: Border.all(color: AppColors.border),
|
||
|
|
),
|
||
|
|
child: const Icon(
|
||
|
|
Icons.settings_outlined,
|
||
|
|
color: AppColors.textSecondary,
|
||
|
|
size: 18,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|