position method

  1. @widgetFactory
Widget position({
  1. double? start,
  2. double? end,
  3. double? left,
  4. double? right,
  5. double? top,
  6. double? bottom,
  7. double? height,
  8. double? width,
  9. bool? fill,
  10. Rect? rect,
  11. RelativeRect? relativeRect,
})

Positions this widget within its parent Stack widget.

Implementation

@widgetFactory
Widget position({
  double? start,
  double? end,
  double? left,
  double? right,
  double? top,
  double? bottom,
  double? height,
  double? width,
  bool? fill,
  Rect? rect,
  RelativeRect? relativeRect,
}) {
  assert(() {
    _debugCheckParameterCombinations(modifier: 'position', [
      {'start': start, 'end': end},
      {'left': left, 'right': right},
    ]);
    _debugCheckParameterCombinations(modifier: 'position', [
      {
        'start': start,
        'end': end,
        'left': left,
        'right': right,
        'top': top,
        'bottom': bottom,
        'height': height,
        'width': width,
        'fill': fill,
      },
      {'rect': rect},
      {'relativeRect': relativeRect},
    ]);
    return true;
  }());

  if (rect != null) {
    return FleetPositioned.fromRect(
      rect: rect,
      child: this,
    );
  } else if (relativeRect != null) {
    return FleetPositioned.fromRelativeRect(
      rect: relativeRect,
      child: this,
    );
  } else {
    if (fill ?? false) {
      top ??= 0;
      bottom ??= 0;
    }

    if (start != null || end != null) {
      if (fill ?? false) {
        start ??= 0;
        end ??= 0;
      }
      return FleetPositionedDirectional(
        start: start,
        end: end,
        top: top,
        bottom: bottom,
        height: height,
        width: width,
        child: this,
      );
    } else {
      if (fill ?? false) {
        left ??= 0;
        right ??= 0;
      }
      return FleetPositioned(
        left: left,
        top: top,
        right: right,
        bottom: bottom,
        height: height,
        width: width,
        child: this,
      );
    }
  }
}