build method

  1. @override
void build(
  1. PdfPage page,
  2. PdfObject<PdfDataType> object,
  3. PdfDict<PdfDataType> params
)
override

Implementation

@override
void build(PdfPage page, PdfObject object, PdfDict params) {
  super.build(page, object, params);
  // What is /F?
  //params['/F'] = const PdfNum(4);
  params['/Ff'] = PdfNum(fieldFlagsValue);
  params['/Opt'] =
      PdfArray<PdfString>(items.map((e) => PdfString.fromString(e)).toList());

  if (defaultValue != null) {
    params['/DV'] = PdfString.fromString(defaultValue!);
  }

  if (value != null) {
    params['/V'] = PdfString.fromString(value!);
  } else {
    params['/V'] = const PdfNull();
  }

  final buf = PdfStream();
  final g = PdfGraphics(page, buf);
  g.setFillColor(textColor);
  g.setFont(font, fontSize);

  params['/DA'] = PdfString.fromStream(buf);

  // What is /TU? Tooltip?
  //params['/TU'] = PdfString.fromString('Select from list');
}