pdf changes
This commit is contained in:
parent
745742010e
commit
3ec22aa137
@ -91,7 +91,7 @@ class _ClaimsLiveIndicatorState extends State<ClaimsLiveIndicator>
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
'MIS Creation Date',
|
||||
'Generated at',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
@ -102,8 +102,8 @@ class _ClaimsLiveIndicatorState extends State<ClaimsLiveIndicator>
|
||||
Text(
|
||||
'· $createdAt',
|
||||
style: GoogleFonts.poppins(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: ClaimsOverviewTheme.green,
|
||||
),
|
||||
),
|
||||
|
||||
@ -384,6 +384,10 @@ class _ClaimsOverviewDashboardState extends State<ClaimsOverviewDashboard>
|
||||
viewData: _viewData,
|
||||
enrollmentViewData: _enrollmentViewData,
|
||||
policyId: _selectedPolicyId ?? '',
|
||||
dashboardInfo: ClaimsPdfDashboardInfo(
|
||||
policyLabel: _selectedPolicyLabel(),
|
||||
misCreationDate: _viewData.liveUpdatedAt,
|
||||
),
|
||||
clientLogoBytes: _clientLogoBytes,
|
||||
onProgress: (_, __, label) {
|
||||
updateProgressDialog?.call(() {
|
||||
|
||||
@ -53,6 +53,16 @@ const _logoAsset = 'assets/Nhance-Logo-Final 1.png';
|
||||
|
||||
typedef ClaimsPdfExportProgress = void Function(int current, int total, String label);
|
||||
|
||||
class ClaimsPdfDashboardInfo {
|
||||
final String policyLabel;
|
||||
final String? misCreationDate;
|
||||
|
||||
const ClaimsPdfDashboardInfo({
|
||||
required this.policyLabel,
|
||||
this.misCreationDate,
|
||||
});
|
||||
}
|
||||
|
||||
class _TabCapture {
|
||||
final String tabName;
|
||||
final Uint8List png;
|
||||
@ -64,10 +74,12 @@ class _PdfBuildInput {
|
||||
final List<_TabCapture> captures;
|
||||
final Uint8List? logoBytes;
|
||||
final Uint8List? clientLogoBytes;
|
||||
final ClaimsPdfDashboardInfo dashboardInfo;
|
||||
|
||||
const _PdfBuildInput({
|
||||
required this.captures,
|
||||
required this.logoBytes,
|
||||
required this.dashboardInfo,
|
||||
this.clientLogoBytes,
|
||||
});
|
||||
}
|
||||
@ -125,7 +137,11 @@ Future<Uint8List> _buildPdfBytesSync(_PdfBuildInput input) async {
|
||||
build: (ctx) => pw.Column(
|
||||
crossAxisAlignment: pw.CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_pdfPageHeader(clientLogo: clientLogo, logo: logo),
|
||||
_pdfDashboardHeader(
|
||||
clientLogo: clientLogo,
|
||||
logo: logo,
|
||||
info: input.dashboardInfo,
|
||||
),
|
||||
pw.SizedBox(height: 8),
|
||||
pw.Expanded(
|
||||
child: pw.Center(
|
||||
@ -174,7 +190,11 @@ Future<Uint8List> _buildPdfBytesWithYields(
|
||||
build: (ctx) => pw.Column(
|
||||
crossAxisAlignment: pw.CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_pdfPageHeader(clientLogo: clientLogo, logo: logo),
|
||||
_pdfDashboardHeader(
|
||||
clientLogo: clientLogo,
|
||||
logo: logo,
|
||||
info: input.dashboardInfo,
|
||||
),
|
||||
pw.SizedBox(height: 8),
|
||||
pw.Expanded(
|
||||
child: pw.Center(
|
||||
@ -378,25 +398,105 @@ Future<Uint8List?> _captureTabPng({
|
||||
}
|
||||
}
|
||||
|
||||
pw.Widget _pdfPageHeader({
|
||||
const _pdfTextPrimary = PdfColor.fromInt(0xFF1E293B);
|
||||
const _pdfTextSecondary = PdfColor.fromInt(0xFF64748B);
|
||||
const _pdfGreen = PdfColor.fromInt(0xFF22C55E);
|
||||
const _pdfPrimary = PdfColor.fromInt(0xFF14A39A);
|
||||
|
||||
pw.Widget _pdfDashboardHeader({
|
||||
pw.MemoryImage? clientLogo,
|
||||
pw.MemoryImage? logo,
|
||||
required ClaimsPdfDashboardInfo info,
|
||||
}) {
|
||||
return pw.Row(
|
||||
crossAxisAlignment: pw.CrossAxisAlignment.center,
|
||||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
||||
final misDate = info.misCreationDate?.trim();
|
||||
final hasMisDate = misDate != null && misDate.isNotEmpty;
|
||||
|
||||
return pw.Column(
|
||||
crossAxisAlignment: pw.CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (clientLogo != null)
|
||||
pw.Container(
|
||||
height: 28,
|
||||
constraints: const pw.BoxConstraints(maxWidth: 120),
|
||||
alignment: pw.Alignment.centerLeft,
|
||||
child: pw.Image(clientLogo, fit: pw.BoxFit.contain),
|
||||
)
|
||||
else
|
||||
pw.SizedBox.shrink(),
|
||||
if (logo != null)
|
||||
pw.Image(logo, height: 28, fit: pw.BoxFit.contain),
|
||||
pw.Row(
|
||||
crossAxisAlignment: pw.CrossAxisAlignment.center,
|
||||
mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (clientLogo != null)
|
||||
pw.Container(
|
||||
height: 28,
|
||||
constraints: const pw.BoxConstraints(maxWidth: 120),
|
||||
alignment: pw.Alignment.centerLeft,
|
||||
child: pw.Image(clientLogo, fit: pw.BoxFit.contain),
|
||||
)
|
||||
else
|
||||
pw.SizedBox.shrink(),
|
||||
if (logo != null)
|
||||
pw.Image(logo, height: 28, fit: pw.BoxFit.contain),
|
||||
],
|
||||
),
|
||||
pw.SizedBox(height: 10),
|
||||
pw.Text(
|
||||
'Claims Overview',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: pw.FontWeight.bold,
|
||||
color: _pdfTextPrimary,
|
||||
),
|
||||
),
|
||||
pw.SizedBox(height: 4),
|
||||
pw.Row(
|
||||
crossAxisAlignment: pw.CrossAxisAlignment.end,
|
||||
children: [
|
||||
pw.Expanded(
|
||||
child: pw.Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 2,
|
||||
crossAxisAlignment: pw.WrapCrossAlignment.center,
|
||||
children: [
|
||||
pw.Text(
|
||||
'Real-time policy & claims analytics',
|
||||
style: const pw.TextStyle(
|
||||
fontSize: 9,
|
||||
color: _pdfTextSecondary,
|
||||
),
|
||||
),
|
||||
if (hasMisDate) ...[
|
||||
pw.Text(
|
||||
'·',
|
||||
style: const pw.TextStyle(
|
||||
fontSize: 9,
|
||||
color: _pdfTextSecondary,
|
||||
),
|
||||
),
|
||||
pw.Text(
|
||||
'Generated at',
|
||||
style: const pw.TextStyle(
|
||||
fontSize: 8,
|
||||
color: _pdfGreen,
|
||||
),
|
||||
),
|
||||
pw.Text(
|
||||
'· $misDate',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 9,
|
||||
fontWeight: pw.FontWeight.bold,
|
||||
color: _pdfGreen,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
pw.SizedBox(width: 12),
|
||||
pw.Text(
|
||||
'Branch : ${info.policyLabel}',
|
||||
style: pw.TextStyle(
|
||||
fontSize: 9,
|
||||
fontWeight: pw.FontWeight.bold,
|
||||
color: _pdfTextPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
pw.SizedBox(height: 6),
|
||||
pw.Divider(color: _pdfPrimary, thickness: 0.5),
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -437,6 +537,7 @@ Future<void> exportClaimsOverviewChartsPdf({
|
||||
required ClaimsOverviewViewData viewData,
|
||||
required EnrollmentOverviewViewData enrollmentViewData,
|
||||
required String policyId,
|
||||
required ClaimsPdfDashboardInfo dashboardInfo,
|
||||
Uint8List? clientLogoBytes,
|
||||
ClaimsPdfExportProgress? onProgress,
|
||||
}) async {
|
||||
@ -497,6 +598,7 @@ Future<void> exportClaimsOverviewChartsPdf({
|
||||
captures: captures,
|
||||
logoBytes: logoBytes,
|
||||
clientLogoBytes: clientLogoBytes,
|
||||
dashboardInfo: dashboardInfo,
|
||||
);
|
||||
|
||||
final Uint8List bytes;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user