rflexValue function

int rflexValue({
  1. int? mobile,
  2. int? tablet,
  3. int? desktop,
  4. int? ios,
  5. int? android,
  6. int? web,
})

Flex Value Responsive con variaciones por plataforma: Calcula valores de flex con valores específicos por dispositivo.

Ejemplos:

Expanded(
  flex: rflexValue(mobile: 2, tablet: 3, desktop: 4),
  child: widget,
)

Implementation

int rflexValue({
  int? mobile,
  int? tablet,
  int? desktop,
  int? ios,
  int? android,
  int? web,
}) {
  final screenInfo = ScreenInfoManager().info;

  // Usar fallbacks inteligentes
  switch (screenInfo.deviceType) {
    case DeviceType.ios:
      return ios ?? mobile ?? tablet ?? desktop ?? 1;
    case DeviceType.android:
      return android ?? mobile ?? tablet ?? desktop ?? 1;
    case DeviceType.mobile:
      return mobile ?? tablet ?? desktop ?? 1;
    case DeviceType.tablet:
      return tablet ?? mobile ?? desktop ?? 1;
    case DeviceType.desktop:
      return desktop ?? tablet ?? mobile ?? 1;
    case DeviceType.web:
      return web ?? desktop ?? tablet ?? mobile ?? 1;
  }
}