Showing
3 changed files
with
60 additions
and
27 deletions
@@ -545,7 +545,7 @@ String _formatCurrency(double amount) { | @@ -545,7 +545,7 @@ String _formatCurrency(double amount) { | ||
545 | } | 545 | } |
546 | 546 | ||
547 | String _formatDate(DateTime date) { | 547 | String _formatDate(DateTime date) { |
548 | - final format = DateFormat.yMMMMd('en_US'); | 548 | + final format = DateFormat.yMMMd('en_US'); |
549 | return format.format(date); | 549 | return format.format(date); |
550 | } | 550 | } |
551 | 551 |
@@ -223,7 +223,7 @@ Future<Uint8List> generateReport(PdfPageFormat pageFormat) async { | @@ -223,7 +223,7 @@ Future<Uint8List> generateReport(PdfPageFormat pageFormat) async { | ||
223 | ), | 223 | ), |
224 | ), | 224 | ), |
225 | pw.Text( | 225 | pw.Text( |
226 | - 'Budget was originally \$1915. A total of \$1990 was spent on the month os January which exceeded the overall budget by \$75', | 226 | + 'Budget was originally \$1915. A total of \$1990 was spent on the month of January which exceeded the overall budget by \$75', |
227 | textAlign: pw.TextAlign.justify, | 227 | textAlign: pw.TextAlign.justify, |
228 | ) | 228 | ) |
229 | ], | 229 | ], |
@@ -26,6 +26,7 @@ import 'package:pdf/widgets.dart' as pw; | @@ -26,6 +26,7 @@ import 'package:pdf/widgets.dart' as pw; | ||
26 | 26 | ||
27 | const PdfColor green = PdfColor.fromInt(0xff9ce5d0); | 27 | const PdfColor green = PdfColor.fromInt(0xff9ce5d0); |
28 | const PdfColor lightGreen = PdfColor.fromInt(0xffcdf1e7); | 28 | const PdfColor lightGreen = PdfColor.fromInt(0xffcdf1e7); |
29 | +const sep = 120.0; | ||
29 | 30 | ||
30 | Future<Uint8List> generateResume(PdfPageFormat format) async { | 31 | Future<Uint8List> generateResume(PdfPageFormat format) async { |
31 | final pw.Document doc = | 32 | final pw.Document doc = |
@@ -38,10 +39,13 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | @@ -38,10 +39,13 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | ||
38 | 39 | ||
39 | final pw.PageTheme pageTheme = await _myPageTheme(format); | 40 | final pw.PageTheme pageTheme = await _myPageTheme(format); |
40 | 41 | ||
41 | - doc.addPage(pw.Page( | 42 | + doc.addPage( |
43 | + pw.MultiPage( | ||
42 | pageTheme: pageTheme, | 44 | pageTheme: pageTheme, |
43 | - build: (pw.Context context) => pw.Row(children: <pw.Widget>[ | ||
44 | - pw.Expanded( | 45 | + build: (pw.Context context) => [ |
46 | + pw.Partitions( | ||
47 | + children: [ | ||
48 | + pw.Partition( | ||
45 | child: pw.Column( | 49 | child: pw.Column( |
46 | crossAxisAlignment: pw.CrossAxisAlignment.start, | 50 | crossAxisAlignment: pw.CrossAxisAlignment.start, |
47 | children: <pw.Widget>[ | 51 | children: <pw.Widget>[ |
@@ -58,8 +62,11 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | @@ -58,8 +62,11 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | ||
58 | pw.Padding(padding: const pw.EdgeInsets.only(top: 10)), | 62 | pw.Padding(padding: const pw.EdgeInsets.only(top: 10)), |
59 | pw.Text('Electrotyper', | 63 | pw.Text('Electrotyper', |
60 | textScaleFactor: 1.2, | 64 | textScaleFactor: 1.2, |
61 | - style: pw.Theme.of(context).defaultTextStyle.copyWith( | ||
62 | - fontWeight: pw.FontWeight.bold, color: green)), | 65 | + style: pw.Theme.of(context) |
66 | + .defaultTextStyle | ||
67 | + .copyWith( | ||
68 | + fontWeight: pw.FontWeight.bold, | ||
69 | + color: green)), | ||
63 | pw.Padding(padding: const pw.EdgeInsets.only(top: 20)), | 70 | pw.Padding(padding: const pw.EdgeInsets.only(top: 20)), |
64 | pw.Row( | 71 | pw.Row( |
65 | crossAxisAlignment: pw.CrossAxisAlignment.start, | 72 | crossAxisAlignment: pw.CrossAxisAlignment.start, |
@@ -71,34 +78,44 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | @@ -71,34 +78,44 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | ||
71 | pw.Text('568 Port Washington Road'), | 78 | pw.Text('568 Port Washington Road'), |
72 | pw.Text('Nordegg, AB T0M 2H0'), | 79 | pw.Text('Nordegg, AB T0M 2H0'), |
73 | pw.Text('Canada, ON'), | 80 | pw.Text('Canada, ON'), |
74 | - ]), | 81 | + ], |
82 | + ), | ||
75 | pw.Column( | 83 | pw.Column( |
76 | crossAxisAlignment: pw.CrossAxisAlignment.start, | 84 | crossAxisAlignment: pw.CrossAxisAlignment.start, |
77 | children: <pw.Widget>[ | 85 | children: <pw.Widget>[ |
78 | pw.Text('+1 403-721-6898'), | 86 | pw.Text('+1 403-721-6898'), |
79 | _UrlText('p.charlesbois@yahoo.com', | 87 | _UrlText('p.charlesbois@yahoo.com', |
80 | 'mailto:p.charlesbois@yahoo.com'), | 88 | 'mailto:p.charlesbois@yahoo.com'), |
81 | - _UrlText('wholeprices.ca', | ||
82 | - 'https://wholeprices.ca'), | ||
83 | - ]), | 89 | + _UrlText( |
90 | + 'wholeprices.ca', 'https://wholeprices.ca'), | ||
91 | + ], | ||
92 | + ), | ||
84 | pw.Padding(padding: pw.EdgeInsets.zero) | 93 | pw.Padding(padding: pw.EdgeInsets.zero) |
85 | - ]), | ||
86 | - ])), | 94 | + ], |
95 | + ), | ||
96 | + ], | ||
97 | + ), | ||
98 | + ), | ||
87 | _Category(title: 'Work Experience'), | 99 | _Category(title: 'Work Experience'), |
88 | _Block(title: 'Tour bus driver'), | 100 | _Block(title: 'Tour bus driver'), |
89 | _Block(title: 'Logging equipment operator'), | 101 | _Block(title: 'Logging equipment operator'), |
90 | _Block(title: 'Foot doctor'), | 102 | _Block(title: 'Foot doctor'), |
103 | + _Block(title: 'Unicorn trainer'), | ||
104 | + _Block(title: 'Chief chatter'), | ||
105 | + pw.SizedBox(height: 20), | ||
91 | _Category(title: 'Education'), | 106 | _Category(title: 'Education'), |
92 | _Block(title: 'Bachelor Of Commerce'), | 107 | _Block(title: 'Bachelor Of Commerce'), |
93 | _Block(title: 'Bachelor Interior Design'), | 108 | _Block(title: 'Bachelor Interior Design'), |
94 | - ])), | ||
95 | - pw.Container( | ||
96 | - height: double.infinity, | ||
97 | - width: 2, | ||
98 | - margin: const pw.EdgeInsets.symmetric(horizontal: 5), | ||
99 | - color: green, | 109 | + ], |
100 | ), | 110 | ), |
101 | - pw.Column( | 111 | + ), |
112 | + pw.Partition( | ||
113 | + width: sep, | ||
114 | + child: pw.Column( | ||
115 | + children: [ | ||
116 | + pw.Container( | ||
117 | + height: pageTheme.pageFormat.availableHeight, | ||
118 | + child: pw.Column( | ||
102 | crossAxisAlignment: pw.CrossAxisAlignment.center, | 119 | crossAxisAlignment: pw.CrossAxisAlignment.center, |
103 | mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, | 120 | mainAxisAlignment: pw.MainAxisAlignment.spaceBetween, |
104 | children: <pw.Widget>[ | 121 | children: <pw.Widget>[ |
@@ -112,7 +129,8 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | @@ -112,7 +129,8 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | ||
112 | ), | 129 | ), |
113 | pw.Column(children: <pw.Widget>[ | 130 | pw.Column(children: <pw.Widget>[ |
114 | _Percent(size: 60, value: .7, title: pw.Text('Word')), | 131 | _Percent(size: 60, value: .7, title: pw.Text('Word')), |
115 | - _Percent(size: 60, value: .4, title: pw.Text('Excel')), | 132 | + _Percent( |
133 | + size: 60, value: .4, title: pw.Text('Excel')), | ||
116 | ]), | 134 | ]), |
117 | pw.BarcodeWidget( | 135 | pw.BarcodeWidget( |
118 | data: 'Parnella Charlesbois', | 136 | data: 'Parnella Charlesbois', |
@@ -121,19 +139,27 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | @@ -121,19 +139,27 @@ Future<Uint8List> generateResume(PdfPageFormat format) async { | ||
121 | barcode: pw.Barcode.qrCode(), | 139 | barcode: pw.Barcode.qrCode(), |
122 | ), | 140 | ), |
123 | ], | 141 | ], |
142 | + ), | ||
143 | + ), | ||
144 | + ], | ||
145 | + ), | ||
124 | ) | 146 | ) |
125 | - ]), | ||
126 | - )); | 147 | + ], |
148 | + ), | ||
149 | + ], | ||
150 | + ), | ||
151 | + ); | ||
127 | return doc.save(); | 152 | return doc.save(); |
128 | } | 153 | } |
129 | 154 | ||
130 | Future<pw.PageTheme> _myPageTheme(PdfPageFormat format) async { | 155 | Future<pw.PageTheme> _myPageTheme(PdfPageFormat format) async { |
131 | - return pw.PageTheme( | ||
132 | - pageFormat: format.applyMargin( | 156 | + format = format.applyMargin( |
133 | left: 2.0 * PdfPageFormat.cm, | 157 | left: 2.0 * PdfPageFormat.cm, |
134 | top: 4.0 * PdfPageFormat.cm, | 158 | top: 4.0 * PdfPageFormat.cm, |
135 | right: 2.0 * PdfPageFormat.cm, | 159 | right: 2.0 * PdfPageFormat.cm, |
136 | - bottom: 2.0 * PdfPageFormat.cm), | 160 | + bottom: 2.0 * PdfPageFormat.cm); |
161 | + return pw.PageTheme( | ||
162 | + pageFormat: format, | ||
137 | theme: pw.ThemeData.withFont( | 163 | theme: pw.ThemeData.withFont( |
138 | base: pw.Font.ttf(await rootBundle.load('assets/open-sans.ttf')), | 164 | base: pw.Font.ttf(await rootBundle.load('assets/open-sans.ttf')), |
139 | bold: pw.Font.ttf(await rootBundle.load('assets/open-sans-bold.ttf')), | 165 | bold: pw.Font.ttf(await rootBundle.load('assets/open-sans-bold.ttf')), |
@@ -173,7 +199,14 @@ Future<pw.PageTheme> _myPageTheme(PdfPageFormat format) async { | @@ -173,7 +199,14 @@ Future<pw.PageTheme> _myPageTheme(PdfPageFormat format) async { | ||
173 | ..moveTo(size.x - 30, 0) | 199 | ..moveTo(size.x - 30, 0) |
174 | ..lineTo(size.x - 110, 50) | 200 | ..lineTo(size.x - 110, 50) |
175 | ..lineTo(size.x - 150, 0) | 201 | ..lineTo(size.x - 150, 0) |
176 | - ..fillPath(); | 202 | + ..fillPath() |
203 | + ..setColor(green) | ||
204 | + ..setLineWidth(2) | ||
205 | + ..moveTo( | ||
206 | + size.x - sep - format.marginRight + 4, format.marginBottom) | ||
207 | + ..lineTo(size.x - sep - format.marginRight + 4, | ||
208 | + size.y - format.marginTop) | ||
209 | + ..strokePath(); | ||
177 | }, | 210 | }, |
178 | ), | 211 | ), |
179 | ); | 212 | ); |
-
Please register or login to post a comment