document.dart
4.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import 'dart:async';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/widgets.dart' as fw;
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart';
import 'package:printing/printing.dart';
import 'example_widgets.dart';
Future<Document> generateDocument(PdfPageFormat format) async {
final Document pdf = Document(title: 'My Résumé', author: 'David PHAM-VAN');
final PdfImage profileImage = kIsWeb
? null
: await pdfImageFromImageProvider(
pdf: pdf.document,
image: const fw.NetworkImage(
'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&s=200'),
onError: (dynamic exception, StackTrace stackTrace) {
print('Unable to download image');
});
final PageTheme pageTheme = myPageTheme(format);
pdf.addPage(Page(
pageTheme: pageTheme,
build: (Context context) => Row(children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
padding: const EdgeInsets.only(left: 30, bottom: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Parnella Charlesbois',
textScaleFactor: 2,
style: Theme.of(context)
.defaultTextStyle
.copyWith(fontWeight: FontWeight.bold)),
Padding(padding: const EdgeInsets.only(top: 10)),
Text('Electrotyper',
textScaleFactor: 1.2,
style: Theme.of(context).defaultTextStyle.copyWith(
fontWeight: FontWeight.bold, color: green)),
Padding(padding: const EdgeInsets.only(top: 20)),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('568 Port Washington Road'),
Text('Nordegg, AB T0M 2H0'),
Text('Canada, ON'),
]),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('+1 403-721-6898'),
UrlText('p.charlesbois@yahoo.com',
'mailto:p.charlesbois@yahoo.com'),
UrlText('wholeprices.ca',
'https://wholeprices.ca'),
]),
Padding(padding: EdgeInsets.zero)
]),
])),
Category(title: 'Work Experience'),
Block(title: 'Tour bus driver'),
Block(title: 'Logging equipment operator'),
Block(title: 'Foot doctor'),
Category(title: 'Education'),
Block(title: 'Bachelor Of Commerce'),
Block(title: 'Bachelor Interior Design'),
])),
Container(
height: double.infinity,
width: 2,
margin: const EdgeInsets.symmetric(horizontal: 5),
color: green,
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ClipOval(
child: Container(
width: 100,
height: 100,
color: lightGreen,
child: profileImage == null
? Container()
: Image(profileImage))),
Column(children: <Widget>[
Percent(size: 60, value: .7, title: Text('Word')),
Percent(size: 60, value: .4, title: Text('Excel')),
]),
QrCodeWidget(data: 'Parnella Charlesbois', size: 60),
],
)
]),
));
return pdf;
}