offset method

  1. @widgetFactory
Widget offset({
  1. double? x,
  2. double? y,
  3. Offset? offset,
  4. bool transformHitTests = true,
  5. FilterQuality? filterQuality,
  6. bool fractional = false,
})

Offsets this widget by x and y or an offset.

Implementation

@widgetFactory
Widget offset({
  double? x,
  double? y,
  Offset? offset,
  bool transformHitTests = true,
  FilterQuality? filterQuality,
  bool fractional = false,
}) {
  assert(
    !fractional || filterQuality == null,
    'offset cannot be fractional and specify filterQuality.',
  );
  assert(() {
    _debugCheckParameterCombinations(modifier: 'offset', [
      {'x': x, 'y': y},
      {'offset': offset},
    ]);
    return true;
  }());

  offset ??= Offset(x ?? 0, y ?? 0);

  if (fractional) {
    return FleetFractionalTranslation(
      translation: offset,
      transformHitTests: transformHitTests,
      child: this,
    );
  } else {
    return FleetTransform.translate(
      offset: offset,
      transformHitTests: transformHitTests,
      filterQuality: filterQuality,
      child: this,
    );
  }
}