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-19 17:40:14 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
David PHAM-VAN
2024-01-27 12:11:28 -0400
Commit
ff7a059432a3dee9b03e388c3e5f44e02ea98266
ff7a0594
1 parent
ef8bfa9f
Update `scrollToPage`
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
printing/lib/src/preview/custom.dart
printing/lib/src/preview/custom.dart
View file @
ff7a059
...
...
@@ -174,16 +174,17 @@ class PdfPreviewCustomState extends State<PdfPreviewCustom>
super
.
didChangeDependencies
();
}
void
scrollToPage
(
Future
<
void
>
scrollToPage
(
int
index
,
{
Duration
duration
=
Duration
.
zero
,
Duration
duration
=
const
Duration
(
milliseconds:
300
)
,
Curve
curve
=
Curves
.
ease
,
ScrollPositionAlignmentPolicy
alignmentPolicy
=
ScrollPositionAlignmentPolicy
.
explicit
,
})
{
assert
(
index
>=
0
);
final
pageKey
=
_pageGlobalKeys
[
index
];
Scrollable
.
ensureVisible
(
pageKey
.
currentContext
!,
assert
(
index
>=
0
,
'Index of page cannot be negative'
);
final
pageContext
=
_pageGlobalKeys
[
index
].
currentContext
;
assert
(
pageContext
!=
null
,
'Context of GlobalKey cannot be null'
);
return
Scrollable
.
ensureVisible
(
pageContext
!,
duration:
duration
,
curve:
curve
,
alignmentPolicy:
alignmentPolicy
);
}
...
...
Please
register
or
login
to post a comment