hWithContext method

  1. @Deprecated('Usa .h en su lugar (sin context). Será eliminado en v3.0.0')
double hWithContext(
  1. BuildContext context, {
  2. num? web,
  3. num? ios,
  4. num? android,
  5. num? mobile,
  6. num? tablet,
  7. num? desktop,
})

Alto Responsive (DEPRECATED): Usa .h en su lugar (sin context).

Esta versión con context será eliminada en futuras versiones. Migra tu código a usar .h directamente sin pasar context.

Implementation

@Deprecated('Usa .h en su lugar (sin context). Será eliminado en v3.0.0')
double hWithContext(BuildContext context, {
  num? web,
  num? ios,
  num? android,
  num? mobile,
  num? tablet,
  num? desktop,
}) {
  final screenInfo = _getInfo(context);

  // Si no se especifican parámetros multi-plataforma, usar comportamiento básico
  if (web == null && ios == null && android == null &&
      mobile == null && tablet == null && desktop == null) {
    final normalizedValue = _normalizeValue(this);
    return screenInfo.height * normalizedValue;
  }

  // Usar lógica multi-plataforma con 'this' como fallback
  final values = <DeviceType, num>{};
  if (web != null) values[DeviceType.web] = web;
  if (ios != null) values[DeviceType.ios] = ios;
  if (android != null) values[DeviceType.android] = android;
  if (mobile != null) values[DeviceType.mobile] = mobile;
  if (tablet != null) values[DeviceType.tablet] = tablet;
  if (desktop != null) values[DeviceType.desktop] = desktop;

  final normalizedValue = _getValueForDevice(screenInfo, values, this);
  return screenInfo.height * normalizedValue;
}