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
2020-04-30 18:16:30 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
af9158b28ca9981ff80b6c9e69069e2647154570
af9158b2
1 parent
642beba7
Improve Page preview
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
printing/lib/src/pdf_preview.dart
printing/lib/src/pdf_preview.dart
View file @
af9158b
...
...
@@ -17,6 +17,7 @@ class PdfPreview extends StatefulWidget {
this
.
initialPageFormat
,
this
.
allowPrinting
=
true
,
this
.
allowSharing
=
true
,
this
.
maxPageWidth
,
this
.
canChangePageFormat
=
true
,
this
.
actions
,
this
.
pageFormats
,
...
...
@@ -33,6 +34,8 @@ class PdfPreview extends StatefulWidget {
final
bool
allowSharing
;
final
double
maxPageWidth
;
final
bool
canChangePageFormat
;
final
List
<
PdfPreviewAction
>
actions
;
...
...
@@ -148,8 +151,8 @@ class _PdfPreviewState extends State<PdfPreview> {
}
final
MediaQueryData
mq
=
MediaQuery
.
of
(
context
);
dpi
=
(
mq
.
size
.
width
-
16
)
*
min
(
mq
.
devicePixelRatio
,
2
)
/
dpi
=
(
min
(
mq
.
size
.
width
-
16
,
widget
.
maxPageWidth
))
*
mq
.
devicePixelRatio
/
pageFormat
.
width
*
72
;
...
...
@@ -205,7 +208,6 @@ class _PdfPreviewState extends State<PdfPreview> {
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
Widget
scrollView
=
Container
(
width:
double
.
infinity
,
decoration:
BoxDecoration
(
gradient:
LinearGradient
(
colors:
<
Color
>[
Colors
.
grey
.
shade400
,
Colors
.
grey
.
shade200
],
...
...
@@ -213,7 +215,14 @@ class _PdfPreviewState extends State<PdfPreview> {
end:
Alignment
.
bottomCenter
,
),
),
child:
_createPreview
(),
width:
double
.
infinity
,
alignment:
Alignment
.
center
,
child:
Container
(
constraints:
widget
.
maxPageWidth
!=
null
?
BoxConstraints
(
maxWidth:
widget
.
maxPageWidth
)
:
null
,
child:
_createPreview
(),
),
);
final
List
<
Widget
>
actions
=
<
Widget
>[];
...
...
Please
register
or
login
to post a comment