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
Aleksei
2024-01-22 10:24:39 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2024-01-27 12:11:28 -0400
Commit
8bfcced0490ba5ca8d5eb5b045637a723bda4271
8bfcced0
1 parent
24c7f1ce
Minor optimization
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
32 deletions
printing/lib/src/preview/custom.dart
printing/lib/src/preview/custom.dart
View file @
8bfcced
...
...
@@ -114,7 +114,7 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
with
PdfPreviewRaster
{
final
listView
=
GlobalKey
();
late
List
<
GlobalKey
>
_pageGlobalKeys
;
List
<
GlobalKey
>
_pageGlobalKeys
=
<
GlobalKey
>[]
;
bool
infoLoaded
=
false
;
...
...
@@ -221,36 +221,41 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
);
}
_pageGlobalKeys
=
List
.
generate
(
pages
.
length
,
(
index
)
=>
GlobalKey
());
if
(
widget
.
enableScrollToPage
)
{
_pageGlobalKeys
=
List
.
generate
(
pages
.
length
,
(
_
)
=>
GlobalKey
());
}
if
(
widget
.
pagesBuilder
!=
null
)
{
return
widget
.
pagesBuilder
!(
context
,
pages
);
}
Widget
pageWidget
(
int
index
,
{
Key
?
key
})
=>
GestureDetector
(
onDoubleTap:
()
{
setState
(()
{
updatePosition
=
scrollController
.
position
.
pixels
;
preview
=
index
;
transformationController
.
value
.
setIdentity
();
});
},
child:
PdfPreviewPage
(
key:
key
,
pageData:
pages
[
index
],
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
pageMargin:
widget
.
previewPageMargin
,
),
);
return
widget
.
enableScrollToPage
?
Scrollbar
(
controller:
scrollController
,
child:
SingleChildScrollView
(
controller:
scrollController
,
physics:
widget
.
scrollPhysics
,
padding:
widget
.
padding
,
child:
Column
(
children:
List
.
generate
(
pages
.
length
,
(
index
)
=>
GestureDetector
(
onDoubleTap:
()
{
setState
(()
{
updatePosition
=
scrollController
.
position
.
pixels
;
preview
=
index
;
transformationController
.
value
.
setIdentity
();
});
},
child:
PdfPreviewPage
(
key:
getPageKey
(
index
),
pageData:
pages
[
index
],
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
pageMargin:
widget
.
previewPageMargin
,
),
),
(
index
)
=>
pageWidget
(
index
,
key:
getPageKey
(
index
)),
),
),
),
...
...
@@ -261,21 +266,7 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
physics:
widget
.
scrollPhysics
,
padding:
widget
.
padding
,
itemCount:
pages
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
GestureDetector
(
onDoubleTap:
()
{
setState
(()
{
updatePosition
=
scrollController
.
position
.
pixels
;
preview
=
index
;
transformationController
.
value
.
setIdentity
();
});
},
child:
PdfPreviewPage
(
key:
getPageKey
(
index
),
pageData:
pages
[
index
],
pdfPreviewPageDecoration:
widget
.
pdfPreviewPageDecoration
,
pageMargin:
widget
.
previewPageMargin
,
),
),
itemBuilder:
(
BuildContext
context
,
int
index
)
=>
pageWidget
(
index
),
);
}
...
...
Please
register
or
login
to post a comment