constraintOf static method

ConstraintDimen constraintOf(
  1. String name,
  2. Size size, {
  3. ConstraintDimenData? defaults,
  4. bool defaultScalable = false,
})

Implementation

static ConstraintDimen constraintOf(
  String name,
  Size size, {
  ConstraintDimenData? defaults,
  bool defaultScalable = false,
}) {
  final device = i.device(size);
  final scaleFactor = device.sizeScaleFactor;
  final x = _of(name)?.detect(device.type);
  final y = x is ConstraintDimen ? x : const ConstraintDimen.none();
  final z = defaultScalable && defaults != null ? y : y.scale(scaleFactor);
  final m = defaults != null ? z.defaults(defaults) : z;
  return defaultScalable ? m.scale(scaleFactor) : m;
}