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
2021-04-23 06:47:02 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7ea1c572e86d030a08148839bae05b91532a0303
7ea1c572
1 parent
0e06f297
Fix icon colors
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
33 deletions
printing/CHANGELOG.md
printing/lib/src/pdf_preview.dart
printing/CHANGELOG.md
View file @
7ea1c57
...
...
@@ -6,6 +6,7 @@
-
Add previewPageMargin and padding parameters
[
Deepak
]
-
Fix Scrollbar positionning and default margins
-
Add shouldRepaint parameter
-
Fix icon colors
## 5.1.0
...
...
printing/lib/src/pdf_preview.dart
View file @
7ea1c57
...
...
@@ -362,19 +362,19 @@ class _PdfPreviewState extends State<PdfPreview> {
}
return
ListView
.
builder
(
controller:
scrollController
,
padding:
widget
.
padding
,
itemCount:
pages
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
GestureDetector
(
onDoubleTap:
()
{
setState
(()
{
updatePosition
=
scrollController
.
position
.
pixels
;
preview
=
index
;
transformationController
.
value
.
setIdentity
();
});
},
child:
pages
[
index
],
),
controller:
scrollController
,
padding:
widget
.
padding
,
itemCount:
pages
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
GestureDetector
(
onDoubleTap:
()
{
setState
(()
{
updatePosition
=
scrollController
.
position
.
pixels
;
preview
=
index
;
transformationController
.
value
.
setIdentity
();
});
},
child:
pages
[
index
],
),
);
}
...
...
@@ -396,6 +396,7 @@ class _PdfPreviewState extends State<PdfPreview> {
@override
Widget
build
(
BuildContext
context
)
{
final
theme
=
Theme
.
of
(
context
);
final
iconColor
=
theme
.
primaryIconTheme
.
color
??
Colors
.
white
;
Widget
page
;
...
...
@@ -437,7 +438,6 @@ class _PdfPreviewState extends State<PdfPreview> {
actions
.
add
(
IconButton
(
icon:
const
Icon
(
Icons
.
print
),
color:
theme
.
accentIconTheme
.
color
,
onPressed:
_print
,
),
);
...
...
@@ -448,7 +448,6 @@ class _PdfPreviewState extends State<PdfPreview> {
IconButton
(
key:
shareWidget
,
icon:
const
Icon
(
Icons
.
share
),
color:
theme
.
accentIconTheme
.
color
,
onPressed:
_share
,
),
);
...
...
@@ -462,7 +461,7 @@ class _PdfPreviewState extends State<PdfPreview> {
dropdownColor:
theme
.
primaryColor
,
icon:
Icon
(
Icons
.
arrow_drop_down
,
color:
theme
.
accentIconTheme
.
c
olor
,
color:
iconC
olor
,
),
value:
pageFormat
,
items:
List
<
DropdownMenuItem
<
PdfPageFormat
>>.
generate
(
...
...
@@ -472,8 +471,7 @@ class _PdfPreviewState extends State<PdfPreview> {
final
val
=
_pageFormats
[
key
];
return
DropdownMenuItem
<
PdfPageFormat
>(
value:
val
,
child:
Text
(
key
,
style:
TextStyle
(
color:
theme
.
accentIconTheme
.
color
)),
child:
Text
(
key
,
style:
TextStyle
(
color:
iconColor
)),
);
},
),
...
...
@@ -490,15 +488,15 @@ class _PdfPreviewState extends State<PdfPreview> {
if
(
widget
.
canChangeOrientation
)
{
horizontal
??=
pageFormat
.
width
>
pageFormat
.
height
;
final
color
=
theme
.
accentIconTheme
.
color
!;
final
disabledColor
=
color
.
withAlpha
(
120
);
final
disabledColor
=
iconColor
.
withAlpha
(
120
);
actions
.
add
(
ToggleButtons
(
renderBorder:
false
,
borderColor:
disabledColor
,
color:
disabledColor
,
selectedBorderColor:
color
,
selectedColor:
color
,
selectedBorderColor:
iconColor
,
selectedColor:
iconColor
,
onPressed:
(
int
index
)
{
setState
(()
{
horizontal
=
index
==
1
;
...
...
@@ -521,7 +519,6 @@ class _PdfPreviewState extends State<PdfPreview> {
actions
.
add
(
IconButton
(
icon:
action
.
icon
,
color:
theme
.
accentIconTheme
.
color
,
onPressed:
action
.
onPressed
==
null
?
null
:
()
=>
action
.
onPressed
!(
...
...
@@ -563,19 +560,23 @@ class _PdfPreviewState extends State<PdfPreview> {
?
Scrollbar
(
controller:
scrollController
,
child:
scrollView
)
:
scrollView
),
if
(
actions
.
isNotEmpty
&&
widget
.
useActions
)
Material
(
elevation:
4
,
color:
theme
.
primaryColor
,
child:
SizedBox
(
width:
double
.
infinity
,
child:
SafeArea
(
child:
Wrap
(
alignment:
WrapAlignment
.
spaceAround
,
children:
actions
,
IconTheme
.
merge
(
data:
IconThemeData
(
color:
iconColor
,
),
child:
Material
(
elevation:
4
,
color:
theme
.
primaryColor
,
child:
SizedBox
(
width:
double
.
infinity
,
child:
SafeArea
(
child:
Wrap
(
alignment:
WrapAlignment
.
spaceAround
,
children:
actions
,
),
),
),
),
),
)
],
);
...
...
Please
register
or
login
to post a comment