fix(pdf): maintain exact media-carta height and anchor footer for short clinical texts

This commit is contained in:
=
2026-09-22 10:42:31 -04:00
parent 20b3255893
commit fffa8e18f0
4 changed files with 71 additions and 69 deletions
@@ -68,13 +68,11 @@ class DepartmentReferralPdfService {
return pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.stretch,
children: [
// Mitad superior de la hoja (máximo 5.5 pulgadas / 396 pt)
pw.ConstrainedBox(
constraints: const pw.BoxConstraints(
maxHeight: 5.5 * PdfPageFormat.inch - 32,
),
// Mitad superior de la hoja: altura fija de media carta (5.5 pulgadas / 396 pt)
// para que el pie de página siempre quede anclado al final de la media hoja.
pw.SizedBox(
height: 5.5 * PdfPageFormat.inch - 32,
child: pw.Column(
mainAxisSize: pw.MainAxisSize.min,
crossAxisAlignment: pw.CrossAxisAlignment.stretch,
children: [
// 1. Cabecera con Nombre del Doctor y Badge Sutil de Hidalyx Med
@@ -170,22 +168,25 @@ class DepartmentReferralPdfService {
),
pw.SizedBox(height: 8),
// 2. Contenido del Referimiento (Idéntico a AlfaMedical)
pw.Container(
padding: const pw.EdgeInsets.symmetric(vertical: 6),
child: pw.Text(
referralText.trim().isNotEmpty
? referralText.trim()
: 'Sin detalles de referimiento.',
style: pw.TextStyle(
font: regular,
fontSize: 10.5,
lineSpacing: 3.5,
color: PdfColor.fromHex('1E293B'),
// 2. Contenido del Referimiento (ocupa el espacio central disponible)
pw.Expanded(
child: pw.Container(
alignment: pw.Alignment.topLeft,
padding: const pw.EdgeInsets.symmetric(vertical: 4),
child: pw.Text(
referralText.trim().isNotEmpty
? referralText.trim()
: 'Sin detalles de referimiento.',
style: pw.TextStyle(
font: regular,
fontSize: 10.5,
lineSpacing: 3.5,
color: PdfColor.fromHex('1E293B'),
),
),
),
),
pw.SizedBox(height: 10),
pw.SizedBox(height: 6),
// Línea divisoria decorativa previa al pie
pw.Container(