object method

T object(
  1. dynamic value
)

Set object fit - accepts BoxFit or String ('cover', 'contain', 'fill', 'scaleDown', 'none')

Examples:

  • object('cover') - scales to fill, may crop (equivalent to object-cover in Tailwind)
  • object('contain') - scales to fit entirely (equivalent to object-contain in Tailwind)
  • object('fill') - stretches to fill exactly (equivalent to object-fill in Tailwind)
  • object('scaleDown') - scales down only if needed (equivalent to object-scale-down in Tailwind)
  • object('none') - no scaling (equivalent to object-none in Tailwind)

Implementation

T object(dynamic value) {
  if (value is BoxFit) {
    return copyWith(flyStyle.copyWith(object: value));
  } else if (value is String) {
    return copyWith(
      flyStyle.copyWith(object: FlyObjectUtils.parseBoxFitFromString(value)),
    );
  } else {
    throw ArgumentError(
      'Object fit value must be BoxFit or String, got: $value',
    );
  }
}