Welcome to the Flutter feedback portal. We’re happy you’re here! If you have feedback on how to improve the Flutter, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

5
Votes

When using PdfTextElement to layout multiple columns of text in a document, the object (PdfTextElement) should in my view be re-usable to layout the remainder of any text (if any). I did personally find a solution, which involves a bit of type casting, which I think could be supported in a more elegant way.


My approach:

PdfTextElement textElement = PdfTextElement(
text: text,
font: _robotoRegular10,
brush: __textBrush,
format: pdfStringFormat,
);
dynamic layoutResult = textElement.draw(
page: currentPage,
format: pdfLayoutFormat,
bounds: Rect.fromLTWH(
__left, __top + __topContent, __columnWidth, textColHeight),
);
text = layoutResult?.remainder?.trim();

if (text != null && text.isNotEmpty) {
textElement = PdfTextElement(
text: text,
font: _robotoRegular10,
brush: __textBrush,
format: pdfStringFormat,
);
layoutResult = textElement.draw(
page: currentPage,
format: pdfLayoutFormat,
bounds: Rect.fromLTWH(__left + __columnWidth + __columnSpacer,
__top + __topContent, __columnWidth, textColHeight),
);
text = layoutResult?.remainder?.trim();
}



What I would believe to be more elegant:

  • have the textElement expose some way of knowing, if there is still remaining text to be layed out (hasMoreText?)
  • upon a second call of .draw() on the same, original object, continue with the remainder of the text


Thank you for your consideration :)


kind regards, and stay safe,

Christoph Schwarz