How can I add a little space to the last page? #131
-
I have implemented my own controls placed on top of the pdfrx widget.
The problem is that on the last page my controls are overlapping the PDF content. Is it possible to add a padding on the last page only? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 14 replies
-
Or not space, any widget.Using current version it's only possible to display any widget over the page, but I want smith like Column() widget behaviour or padding to page. |
Beta Was this translation helpful? Give feedback.
-
For extra paddings, you can use PdfViewerParams.layoutPages to add extra paddings on the bottom: PdfViewerParams(
layoutPages: (pages, params) {
final width =
pages.fold(0.0, (w, p) => max(w, p.width)) + params.margin * 2;
final pageLayout = <Rect>[];
var y = params.margin;
for (int i = 0; i < pages.length; i++) {
final page = pages[i];
final rect =
Rect.fromLTWH((width - page.width) / 2, y, page.width, page.height);
pageLayout.add(rect);
y += page.height + params.margin;
}
// extra padding on the bottom
const extra = 100.0;
return PdfPageLayout(
pageLayouts: pageLayout,
documentSize: Size(width, y + extra),
);
},
), |
Beta Was this translation helpful? Give feedback.
-
The code above does not take the zoom into consideration. |
Beta Was this translation helpful? Give feedback.
-
The blocker behind the issue is that the room on the bottom is affected by zoom ratio. In my understanding, you want to place some fixed size margin on the bottom of the last page. Is it correct? |
Beta Was this translation helpful? Give feedback.
-
@TarasBounty |
Beta Was this translation helpful? Give feedback.
@TarasBounty
1.0.70 contains an update for the issue that calls
layoutPages
for every zoom change. Please evaluate it and give me any feedback.