buildInfoCustomer function

Widget buildInfoCustomer(
  1. Context context,
  2. DocumentOptions options
)

Implementation

pw.Widget buildInfoCustomer(pw.Context context, DocumentOptions options) {
  Person customer = options.invoice.getCustomer();
  double widthLabel = 70;
  String regime = customer.getRegimeType().getName();
  String responsability = customer.getResponsabilityType().getName();
  return pw.Container(
    //padding: const pw.EdgeInsets.all(16),
    //color: PdfColors.blueGrey50,
    child: pw.DefaultTextStyle(
      style: pw.TextStyle( color: options.textColor, fontSize: 9 ),
      child: pw.Column(
        crossAxisAlignment: pw.CrossAxisAlignment.start,
        children: [
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Adquiriente:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(customer.getName()),
            ]
          ),
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('NIT/CC:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(customer.getIdentificationNumber()),
            ]
          ),
          if(regime.trim().isNotEmpty)
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Régimen:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(regime),
            ]
          ),
          if(responsability.trim().isNotEmpty)
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Obligación:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(responsability),
            ]
          ),
          if(customer.getMunicipalityId().trim().isNotEmpty)
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Ciudad:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(customer.getInfoGeo()),
            ]
          ),
          if(customer.getAddress().trim().isNotEmpty)
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Dirección:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(customer.getAddress()),
            ]
          ),
          if(customer.getPhone().trim().isNotEmpty)
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Teléfono:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(customer.getPhone()),
            ]
          ),
          if(customer.getEmail().trim().isNotEmpty)
          pw.Row(
            children: [
              pw.SizedBox(width: widthLabel, child: pw.Text('Email:', style: pw.TextStyle(fontWeight: pw.FontWeight.bold) )),
              pw.Text(customer.getEmail()),
            ]
          )
        ],
      ),
    ),
  );
}