WidgetAlignment constructor

WidgetAlignment(
  1. LayoutType modelLayoutType,
  2. bool? center,
  3. String? halign,
  4. String? valign,
)

Implementation

WidgetAlignment(LayoutType modelLayoutType, bool? center, String? halign, String? valign)
{
  center = center ?? false;

  HorizontalAlignmentType myHalign = WidgetAlignment.getHorizontalAlignmentType(halign) ?? (center ? HorizontalAlignmentType.center : HorizontalAlignmentType.left);
  VerticalAlignmentType   myValign = WidgetAlignment.getVerticalAlignmentType(valign)   ?? (center ? VerticalAlignmentType.center   : VerticalAlignmentType.top);

  // determine the alignment for the layout type based on the axes;
  switch (modelLayoutType)
  {
    case LayoutType.row:
      _setRowAlignment(myHalign, myValign);
      break;

    case LayoutType.column:
      _setColumnAlignment(myHalign, myValign);
      break;

    case LayoutType.stack:
    default:
      break;
  }

  _setBoxAlignment(center, myHalign, myValign);
}