Flutter PDF插件:此小部件创建了20多个页面这可能是小部件或文档中的问题

问题描述

这是我的代码

build: (pw.Context context) => <pw.Widget>[
    pw.Header(
        level: 0,child:pw.Row(
            mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,children: <pw.Widget>[
              pw.Text(userDetailsInfo[0].name,style: pw.TextStyle(font: myFont,fontSize: 20
              ),textScaleFactor: 2),pw.Pdflogo( )
            ])),pw.SizedBox(height: 15),pw.Row(
       mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,children: [
         pw.Text('Total : ',style: pw.TextStyle(fontSize: 20)),pw.Text('$total dh',style: pw.TextStyle(fontSize: 20,color: PdfColors.green)),]
    ),pw.ListView.builder(itemBuilder: (context,index)
        {
          return pw.Column(
            children: [
          pw.Row(
          mainAxisAlignment: pw.MainAxisAlignment.spaceBetween,children: [
                pw.Text((index + 1).toString()),pw.Text(userDetailsInfo[index].product,fontSize: 15)),pw.Text("${userDetailsInfo[index].price.toString()} dh",style: pw.TextStyle(fontSize: 15,color: userDetailsInfo[index].condition == 'give' ? PdfColors.red: PdfColors.green)),pw.Text( DateFormat('dd/MM/yyyy').format(userDetailsInfo[index].creationDate),)),]
          ),pw.SizedBox(height: 10),pw.Divider( )
            ]
          );
        },itemCount: userDetailsInfo.length)

*当我的列表userDetailsInfo超过特定长度时,Flutter抛出异常:此小部件创建了20多个页面。这可能是小部件或文档中的问题。 *

我的问题是如何拆分listview.builder或针对此问题的另一种解决方

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)