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
deepak786
2021-04-23 13:56:25 +0530
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2021-04-23 06:37:10 -0300
Commit
594ca5d837e9766251a75653551623ad74256bb7
594ca5d8
1 parent
e51ed3f3
added parameters previewPageMargin and padding
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
printing/lib/src/pdf_preview.dart
printing/lib/src/pdf_preview.dart
View file @
594ca5d
...
...
@@ -39,6 +39,8 @@ class PdfPreview extends StatefulWidget {
this
.
shareActionExtraBody
,
this
.
shareActionExtraSubject
,
this
.
shareActionExtraEmails
,
this
.
previewPageMargin
,
this
.
padding
,
})
:
super
(
key:
key
);
/// Called when a pdf document is needed
...
...
@@ -111,6 +113,14 @@ class PdfPreview extends StatefulWidget {
/// This will work only for Android platform.
final
List
<
String
>?
shareActionExtraEmails
;
/// margin for the document preview page
///
/// defaults to [EdgeInsets.only(left: 8, top: 8, right: 8, bottom: 12,)],
final
EdgeInsets
?
previewPageMargin
;
/// padding for the pdf_preview widget
final
EdgeInsets
?
padding
;
@override
_PdfPreviewState
createState
()
=>
_PdfPreviewState
();
}
...
...
@@ -224,11 +234,13 @@ class _PdfPreviewState extends State<PdfPreview> {
pages
.
add
(
_PdfPreviewPage
(
page:
page
,
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
pageMargin:
widget
.
previewPageMargin
,
));
}
else
{
pages
[
pageNum
]
=
_PdfPreviewPage
(
page:
page
,
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
pageMargin:
widget
.
previewPageMargin
,
);
}
});
...
...
@@ -346,6 +358,7 @@ class _PdfPreviewState extends State<PdfPreview> {
return
Scrollbar
(
child:
ListView
.
builder
(
controller:
scrollController
,
padding:
widget
.
padding
,
itemCount:
pages
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
GestureDetector
(
onDoubleTap:
()
{
...
...
@@ -620,22 +633,25 @@ class _PdfPreviewPage extends StatelessWidget {
Key
?
key
,
this
.
page
,
this
.
pdfPreviewPageDecoration
,
this
.
pageMargin
,
})
:
super
(
key:
key
);
final
PdfRaster
?
page
;
final
Decoration
?
pdfPreviewPageDecoration
;
final
EdgeInsets
?
pageMargin
;
@override
Widget
build
(
BuildContext
context
)
{
final
im
=
PdfRasterImage
(
page
!);
return
Container
(
margin:
const
EdgeInsets
.
only
(
left:
8
,
top:
8
,
right:
8
,
bottom:
12
,
),
margin:
pageMargin
??
const
EdgeInsets
.
only
(
left:
8
,
top:
8
,
right:
8
,
bottom:
12
,
),
decoration:
pdfPreviewPageDecoration
??
const
BoxDecoration
(
color:
Colors
.
white
,
...
...
Please
register
or
login
to post a comment