generateWidget method
Use generateWidget to create whole widgets that are commonly pasted into a document, giving you full control of the new widgets generated
Implementation
@override
Future<pw.Widget> generateWidget({
double? maxWidth,
double? maxHeight,
}) async {
final Document? document = RichTextParser().parseDelta(this.document);
if(document == null){
throw StateError('The Delta passed is not valid to be parsed. Please, first ensure the Delta to have not empty content.');
}
final List<pw.Widget> widgets = await blockGenerators(document);
final pw.Widget content = pw.Column(
crossAxisAlignment: pw.CrossAxisAlignment.start,
children: widgets,
);
pw.Container widget = pw.Container(
width: maxWidth,
height: maxHeight,
child: content,
);
return widget;
}