deserialize method

  1. @override
void deserialize(
  1. XmlElement xml
)
override

Deserializes the FML template elements, attributes and children

Implementation

@override
void deserialize(XmlElement xml)
{
  // deserialize
  super.deserialize(xml);

  /// Attributes
  ///
  /// Constraint Attributes
  /// Layout Attributes
  center = Xml.get(node: xml, tag: 'center');

  // expand="false" is same as adding attribute shrink
  var expand = Xml.get(node: xml, tag: 'expand');
  if (expand == null && Xml.hasAttribute(node: xml, tag: 'shrink')) expand = 'false';
  this.expand = expand;

  ////////////////////////////
  /* Sort Children by Depth */
  ////////////////////////////
  if (children != null) children?.sort((a, b)
  {
    if(a.depth != null && b.depth != null) return a.depth?.compareTo(b.depth!) ?? 0;
    return 0;
  }
  );
}