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