微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。