ControlBase.deserialize constructor

ControlBase.deserialize(
  1. XmlElement node
)

Implementation

ControlBase.deserialize(XmlElement node) {
  condition = node.getAttribute('if');
  double x = double.tryParse(node.getAttribute('x') ?? '') ?? 0;
  double y = double.tryParse(node.getAttribute('y') ?? '') ?? 0;
  var widthStr = node.getAttribute('width') ?? '';
  double? width;
  if (widthStr != 'auto') {
     width = double.tryParse(widthStr) ?? double.infinity;
  }
  var heightStr = node.getAttribute('height') ?? '';
  double? height;
  if (heightStr != 'auto') {
     height = double.tryParse(heightStr) ?? double.infinity;
  }

  offset = PrinterOffset(x, y);

  size = PrinterSize(width, height);
}