174 lines
6.4 KiB
Dart
174 lines
6.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import '../../../../core/theme/app_colors.dart';
|
|
import '../widgets/quick_actions_dropdown.dart';
|
|
|
|
class DashboardAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|
final String doctorName;
|
|
final String specialty;
|
|
final bool isSecretary;
|
|
final VoidCallback? onLogoutPressed;
|
|
final ValueChanged<QuickActionType>? onQuickActionSelected;
|
|
|
|
const DashboardAppBar({
|
|
super.key,
|
|
required this.doctorName,
|
|
required this.specialty,
|
|
this.isSecretary = false,
|
|
this.onLogoutPressed,
|
|
this.onQuickActionSelected,
|
|
});
|
|
|
|
@override
|
|
Size get preferredSize => const Size.fromHeight(70);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: preferredSize.height,
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
decoration: const BoxDecoration(
|
|
color: AppColors.surface,
|
|
border: Border(
|
|
bottom: BorderSide(color: AppColors.border, width: 1),
|
|
),
|
|
),
|
|
child: SafeArea(
|
|
bottom: false,
|
|
child: Row(
|
|
children: [
|
|
// 1. Parte Izquierda: Nombre del Doctor y Especialidad (Flexible)
|
|
Expanded(
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primaryContainer,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: const Icon(
|
|
Icons.medical_services_rounded,
|
|
color: AppColors.primary,
|
|
size: 22,
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
doctorName,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
fontSize: 15,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Flexible(
|
|
child: Text(
|
|
specialty,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(
|
|
fontSize: 12,
|
|
color: AppColors.textSecondary,
|
|
),
|
|
),
|
|
),
|
|
if (isSecretary) ...[
|
|
const SizedBox(width: 6),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1.5),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF00A65A).withValues(alpha: 0.12),
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
child: const Text(
|
|
'RECEPCIÓN',
|
|
style: TextStyle(
|
|
fontSize: 9.5,
|
|
fontWeight: FontWeight.w700,
|
|
color: Color(0xFF00A65A),
|
|
letterSpacing: 0.4,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
// 2. Parte Central: Logo de Hidalyx
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: SvgPicture.asset(
|
|
'assets/images/hidalyx_logo_blue.svg',
|
|
height: 32,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
|
|
// 3. Parte Derecha: Dropdown de Acciones Rápidas + Botón Cerrar Sesión
|
|
Expanded(
|
|
child: Align(
|
|
alignment: Alignment.centerRight,
|
|
child: FittedBox(
|
|
fit: BoxFit.scaleDown,
|
|
alignment: Alignment.centerRight,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
QuickActionsDropdown(
|
|
onActionSelected: onQuickActionSelected,
|
|
isSecretary: isSecretary,
|
|
),
|
|
const SizedBox(width: 10),
|
|
Tooltip(
|
|
message: 'Cerrar sesión',
|
|
child: Material(
|
|
color: Colors.transparent,
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(8),
|
|
onTap: onLogoutPressed,
|
|
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.logout_rounded,
|
|
color: AppColors.textSecondary,
|
|
size: 18,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|