-
-
Notifications
You must be signed in to change notification settings - Fork 702
Description
This could actually also be a bug report, now that I tried to debug it.
I use this to render the items as shown by the image below.
Container(
margin: EdgeInsets.only(bottom: 12),
color: ltGrey,
child: RichText(...)
)
Item 16 doesn't fit page 7, so it is moved to page 8. However, there's still a bit of container background on page 7 which I don't want. I tried to add a NewPage(freeSpace: 15.6) because that seems to be the height of my 12pt font. This doesn't work, though. The visible container has a height of 12.24.
Here's an example of item 16, which doesn't fit on page 7 and is wrapped to page 8. The black bar is the page separator of the PDF viewer and not part of the drawing.

It looks like that the bottom margin is added not only to the bottom of the spanned container but to each container part on each page. Isn't this wrong? At least, that's not what I expected.
As a workaround, I shouldn't use margins at all and instead add a SizedBox(height: 12). However, this way, it could happen that this is the first child on a page and break the layout. Margins should be applied only between elements not at the start or the end of a page, I think. It would be nice if the context would provide that information.
The only way right now, I see, is that I add a top margin to all block level elements and the remove that margin from the page's top margin so that it still looks right. Then, I also add that margin to the NewPage widget.
My original feature request was to add support for margins similar to how HTML works, always using the maximum of the top and the bottom margin of adjacent widgets.