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
Marcos Rodriguez
2020-05-26 15:23:43 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2020-05-27 17:57:21 -0400
Commit
b0f45edf0e91692c33239573d6fa6ec067ea3d31
b0f45edf
1 parent
4dc83518
Added pdfPreviewPageDecoration, scrollViewDecoration properties to PDFPreview Widget.
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
printing/CHANGELOG.md
printing/lib/src/pdf_preview.dart
printing/pubspec.yaml
printing/CHANGELOG.md
View file @
b0f45ed
# Changelog
## 3.5.0
-
Add decoration options to the PdfPreview Widget
[
Marcos Rodriguez
]
## 3.4.0
-
Add PdfPreview Widget
...
...
printing/lib/src/pdf_preview.dart
View file @
b0f45ed
...
...
@@ -26,6 +26,8 @@ class PdfPreview extends StatefulWidget {
this
.
onError
,
this
.
onPrinted
,
this
.
onShared
,
this
.
scrollViewDecoration
,
this
.
pdfPreviewPageDecoration
,
})
:
super
(
key:
key
);
/// Called when a pdf document is needed
...
...
@@ -61,6 +63,12 @@ class PdfPreview extends StatefulWidget {
/// Called if the user shares the pdf document
final
void
Function
(
BuildContext
context
)
onShared
;
/// Decoration of scrollView
final
Decoration
scrollViewDecoration
;
/// Decoration of _PdfPreviewPage
final
Decoration
pdfPreviewPageDecoration
;
@override
_PdfPreviewState
createState
()
=>
_PdfPreviewState
();
}
...
...
@@ -110,9 +118,15 @@ class _PdfPreviewState extends State<PdfPreview> {
await
for
(
final
PdfRaster
page
in
Printing
.
raster
(
_doc
,
dpi:
dpi
))
{
setState
(()
{
if
(
pages
.
length
<=
pageNum
)
{
pages
.
add
(
_PdfPreviewPage
(
page:
page
));
pages
.
add
(
_PdfPreviewPage
(
page:
page
,
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
));
}
else
{
pages
[
pageNum
]
=
_PdfPreviewPage
(
page:
page
);
pages
[
pageNum
]
=
_PdfPreviewPage
(
page:
page
,
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
);
}
});
...
...
@@ -220,7 +234,8 @@ class _PdfPreviewState extends State<PdfPreview> {
final
theme
=
Theme
.
of
(
context
);
final
Widget
scrollView
=
Container
(
decoration:
BoxDecoration
(
decoration:
widget
.
scrollViewDecoration
??
BoxDecoration
(
gradient:
LinearGradient
(
colors:
<
Color
>[
Colors
.
grey
.
shade400
,
Colors
.
grey
.
shade200
],
begin:
Alignment
.
topCenter
,
...
...
@@ -380,9 +395,11 @@ class _PdfPreviewPage extends StatelessWidget {
const
_PdfPreviewPage
({
Key
key
,
this
.
page
,
this
.
pdfPreviewPageDecoration
,
})
:
super
(
key:
key
);
final
PdfRaster
page
;
final
Decoration
pdfPreviewPageDecoration
;
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -395,7 +412,8 @@ class _PdfPreviewPage extends StatelessWidget {
right:
8
,
bottom:
12
,
),
decoration:
const
BoxDecoration
(
decoration:
pdfPreviewPageDecoration
??
const
BoxDecoration
(
color:
Colors
.
white
,
boxShadow:
<
BoxShadow
>[
BoxShadow
(
...
...
printing/pubspec.yaml
View file @
b0f45ed
...
...
@@ -4,7 +4,7 @@ description: Plugin that allows Flutter apps to generate and print documents to
homepage
:
https://github.com/DavBfr/dart_pdf/tree/master/printing
repository
:
https://github.com/DavBfr/dart_pdf
issue_tracker
:
https://github.com/DavBfr/dart_pdf/issues
version
:
3.
4
.0
version
:
3.
5
.0
environment
:
sdk
:
"
>=2.3.0
<3.0.0"
...
...
Please
register
or
login
to post a comment