Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
dart_pdf
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
David PHAM-VAN
2019-07-11 09:01:28 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5904927568213277dbee5a2d0384d95663993ee8
59049275
1 parent
991ec871
Apply dart 2.4.0 formatting
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
129 deletions
pdf/lib/src/archive.dart
pdf/test/widget_clip_test.dart
pdf/test/widget_container_test.dart
pdf/test/widget_table_test.dart
pdf/test/widget_theme_test.dart
printing/example/lib/document.dart
pdf/lib/src/archive.dart
View file @
5904927
...
...
@@ -2,4 +2,4 @@ import 'package:archive/archive.dart';
import
'package:pdf/pdf.dart'
;
DeflateCallback
defaultDeflate
=
ZLibEncoder
().
encode
;
DeflateCallback
defaultDeflate
=
ZLibEncoder
().
encode
;
...
...
pdf/test/widget_clip_test.dart
View file @
5904927
...
...
@@ -31,41 +31,41 @@ void main() {
test
(
'Clip Widgets ClipRect'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
ClipRect
(
child:
Transform
.
rotate
(
angle:
0.1
,
child:
Container
(
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
),
),
child:
Transform
.
rotate
(
angle:
0.1
,
child:
Container
(
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
),
),
),
),
));
});
test
(
'Clip Widgets ClipRRect'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
ClipRRect
(
horizontalRadius:
30
,
verticalRadius:
30
,
child:
Container
(
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
),
),
horizontalRadius:
30
,
verticalRadius:
30
,
child:
Container
(
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
),
),
),
));
});
test
(
'Clip Widgets ClipOval'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
ClipOval
(
child:
Container
(
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
),
),
child:
Container
(
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
),
),
),
));
});
...
...
pdf/test/widget_container_test.dart
View file @
5904927
...
...
@@ -49,24 +49,24 @@ void main() {
test
(
'Container Widgets Flat'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
Container
(
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
all
(
30
),
padding:
const
EdgeInsets
.
all
(
20
),
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
borderRadius:
20
,
border:
BoxBorder
(
color:
PdfColors
.
blue800
,
top:
true
,
left:
true
,
right:
true
,
bottom:
true
,
width:
2
,
)),
width:
200
,
height:
400
,
// child: Placeholder(),
),
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
all
(
30
),
padding:
const
EdgeInsets
.
all
(
20
),
decoration:
const
BoxDecoration
(
color:
PdfColors
.
blue
,
borderRadius:
20
,
border:
BoxBorder
(
color:
PdfColors
.
blue800
,
top:
true
,
left:
true
,
right:
true
,
bottom:
true
,
width:
2
,
)),
width:
200
,
height:
400
,
// child: Placeholder(),
),
));
});
...
...
@@ -77,16 +77,16 @@ void main() {
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
Container
(
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
all
(
30
),
padding:
const
EdgeInsets
.
all
(
20
),
decoration:
BoxDecoration
(
image:
DecorationImage
(
image:
image
,
fit:
BoxFit
.
cover
),
),
width:
200
,
height:
400
,
// child: Placeholder(),
),
alignment:
Alignment
.
center
,
margin:
const
EdgeInsets
.
all
(
30
),
padding:
const
EdgeInsets
.
all
(
20
),
decoration:
BoxDecoration
(
image:
DecorationImage
(
image:
image
,
fit:
BoxFit
.
cover
),
),
width:
200
,
height:
400
,
// child: Placeholder(),
),
));
});
...
...
pdf/test/widget_table_test.dart
View file @
5904927
...
...
@@ -74,10 +74,10 @@ void main() {
test
(
'Table Widget filled'
,
()
{
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
Table
(
children:
buildTable
(
context:
context
,
count:
20
),
border:
const
TableBorder
(),
tableWidth:
TableWidth
.
max
,
),
children:
buildTable
(
context:
context
,
count:
20
),
border:
const
TableBorder
(),
tableWidth:
TableWidth
.
max
,
),
));
});
...
...
pdf/test/widget_theme_test.dart
View file @
5904927
...
...
@@ -60,13 +60,13 @@ void main() {
pdf
.
addPage
(
Page
(
build:
(
Context
context
)
=>
ListView
(
children:
<
Widget
>[
Text
(
style
.
font
.
fontName
,
style:
style
,
),
],
children:
<
Widget
>[
Text
(
style
.
font
.
fontName
,
style:
style
,
),
],
),
));
});
...
...
printing/example/lib/document.dart
View file @
5904927
...
...
@@ -124,79 +124,71 @@ Future<Document> generateDocument(PdfPageFormat format) async {
right:
2.0
*
PdfPageFormat
.
cm
,
bottom:
2.0
*
PdfPageFormat
.
cm
),
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'
),
Text
(
'p.charlesbois@yahoo.com'
),
Text
(
'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:
10
,
decoration:
const
BoxDecoration
(
border:
BoxBorder
(
left:
true
,
color:
green
,
width:
2
)),
),
Column
(
Expanded
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
ClipOval
(
child:
Container
(
width:
100
,
height:
100
,
color:
lightGreen
,
child:
profileImage
==
null
?
Container
()
:
Image
(
profileImage
)))
])
]),
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'
),
Text
(
'p.charlesbois@yahoo.com'
),
Text
(
'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:
10
,
decoration:
const
BoxDecoration
(
border:
BoxBorder
(
left:
true
,
color:
green
,
width:
2
)),
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
ClipOval
(
child:
Container
(
width:
100
,
height:
100
,
color:
lightGreen
,
child:
profileImage
==
null
?
Container
()
:
Image
(
profileImage
)))
])
]),
));
return
pdf
;
}
...
...
Please
register
or
login
to post a comment