Anchor.forPos constructor

Anchor.forPos(
  1. AnchorPos? pos,
  2. double width,
  3. double height
)

Implementation

factory Anchor.forPos(AnchorPos<dynamic>? pos, double width, double height) {
  if (pos == null) return Anchor._(width, height, AnchorAlign.none);
  if (pos.value is AnchorAlign) {
    return Anchor._(width, height, pos.value as AnchorAlign);
  }
  if (pos.value is Anchor) return pos.value as Anchor;
  throw Exception('Unsupported AnchorPos value type: ${pos.runtimeType}.');
}