Added underlines and horizontal layout of historical timestamps

This commit is contained in:
Marc Rejohn Castillano 2026-02-22 00:05:19 +08:00
parent 6b16dc234b
commit 2d527b86aa

View File

@ -148,26 +148,130 @@ Future<Uint8List> buildTaskPdfBytes(
), ),
pw.SizedBox(height: 12), pw.SizedBox(height: 12),
pw.Row( pw.Row(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [ children: [
pw.Text('Task Number: ${task.taskNumber ?? task.id}'), pw.Expanded(
pw.Spacer(), child: pw.Column(
pw.Text('Filed At: $created'), crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Row(
children: [
pw.Text('Task Number: '),
pw.Container(
padding: pw.EdgeInsets.only(bottom: 2),
decoration: pw.BoxDecoration(
border: pw.Border(
bottom: pw.BorderSide(
width: 0.8,
color: pdf.PdfColors.black,
),
),
),
child: pw.Text(task.taskNumber ?? task.id),
),
], ],
), ),
pw.SizedBox(height: 8), pw.SizedBox(height: 8),
pw.Row( pw.Row(
children: [ children: [
pw.Text('Service: $serviceName'), pw.Text('Service: '),
pw.SizedBox(width: 12), pw.Container(
pw.Text('Office: $officeName'), padding: pw.EdgeInsets.only(bottom: 2),
decoration: pw.BoxDecoration(
border: pw.Border(
bottom: pw.BorderSide(
width: 0.8,
color: pdf.PdfColors.black,
),
),
),
child: pw.Text(serviceName),
),
], ],
), ),
pw.SizedBox(height: 8), pw.SizedBox(height: 8),
pw.Row( pw.Row(
children: [ children: [
pw.Text('Type: ${task.requestType ?? ''}'), pw.Text('Type: '),
pw.Container(
padding: pw.EdgeInsets.only(bottom: 2),
decoration: pw.BoxDecoration(
border: pw.Border(
bottom: pw.BorderSide(
width: 0.8,
color: pdf.PdfColors.black,
),
),
),
child: pw.Text(task.requestType ?? ''),
),
],
),
],
),
),
pw.SizedBox(width: 12), pw.SizedBox(width: 12),
pw.Text('Category: ${task.requestCategory ?? ''}'), pw.Container(
width: 180,
child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Row(
children: [
pw.Text('Filed At: '),
pw.Container(
padding: pw.EdgeInsets.only(bottom: 2),
decoration: pw.BoxDecoration(
border: pw.Border(
bottom: pw.BorderSide(
width: 0.8,
color: pdf.PdfColors.black,
),
),
),
child: pw.Text(created),
),
],
),
pw.SizedBox(height: 8),
pw.Row(
children: [
pw.Text('Office: '),
pw.Container(
padding: pw.EdgeInsets.only(bottom: 2),
decoration: pw.BoxDecoration(
border: pw.Border(
bottom: pw.BorderSide(
width: 0.8,
color: pdf.PdfColors.black,
),
),
),
child: pw.Text(officeName),
),
],
),
pw.SizedBox(height: 8),
pw.Row(
children: [
pw.Text('Category: '),
pw.Container(
padding: pw.EdgeInsets.only(bottom: 2),
decoration: pw.BoxDecoration(
border: pw.Border(
bottom: pw.BorderSide(
width: 0.8,
color: pdf.PdfColors.black,
),
),
),
child: pw.Text(task.requestCategory ?? ''),
),
],
),
],
),
),
], ],
), ),
pw.SizedBox(height: 12), pw.SizedBox(height: 12),
@ -229,21 +333,29 @@ Future<Uint8List> buildTaskPdfBytes(
child: pw.Text(actionTakenText), child: pw.Text(actionTakenText),
), ),
pw.SizedBox(height: 12), pw.SizedBox(height: 12),
// Historical timestamps: always show the labels; values may be empty // Historical timestamps side-by-side: Created / Started / Closed
pw.Row( pw.Row(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [
pw.Expanded(
child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [ children: [
pw.Text('Created At:'), pw.Text('Created At:'),
pw.SizedBox(width: 8), pw.SizedBox(height: 4),
pw.Text( pw.Text(
'${AppTime.formatDate(task.createdAt)} ${AppTime.formatTime(task.createdAt)}', '${AppTime.formatDate(task.createdAt)} ${AppTime.formatTime(task.createdAt)}',
), ),
], ],
), ),
pw.SizedBox(height: 6), ),
pw.Row( pw.SizedBox(width: 12),
pw.Expanded(
child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [ children: [
pw.Text('Started At:'), pw.Text('Started At:'),
pw.SizedBox(width: 8), pw.SizedBox(height: 4),
pw.Text( pw.Text(
task.startedAt == null task.startedAt == null
? '' ? ''
@ -251,11 +363,14 @@ Future<Uint8List> buildTaskPdfBytes(
), ),
], ],
), ),
pw.SizedBox(height: 6), ),
pw.Row( pw.SizedBox(width: 12),
pw.Expanded(
child: pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: [ children: [
pw.Text('Closed At:'), pw.Text('Closed At:'),
pw.SizedBox(width: 8), pw.SizedBox(height: 4),
pw.Text( pw.Text(
task.completedAt == null task.completedAt == null
? '' ? ''
@ -263,7 +378,10 @@ Future<Uint8List> buildTaskPdfBytes(
), ),
], ],
), ),
pw.SizedBox(height: 12), ),
],
),
pw.SizedBox(height: 36),
// Signature lines row (fixed) stays aligned regardless of name length // Signature lines row (fixed) stays aligned regardless of name length
pw.Row( pw.Row(
children: [ children: [