- Added state management for startup retry and custom station handling in `EstadoRadio`. - Created tasks for implementing strict TDD with RED tests for HTTP failure retries and EQ persistence. - Developed verification report to ensure compliance with TDD practices. - Introduced fake services for testing, including `FakeServicioAudio`, `FakeServicioFavoritos`, and `FakeServicioRadio`. - Implemented widget tests for `PantallaInicio` and `PantallaFavoritos` to validate UI behavior with custom stations. - Enhanced `ServicioRadio` to support host rotation and retry logic for API calls. - Established a new configuration file to enforce project constraints and testing rules.
46 lines
2.0 KiB
Dart
46 lines
2.0 KiB
Dart
/// Modelo de preset de ecualizador.
|
|
/// 5 bandas: 60Hz, 250Hz, 1kHz, 4kHz, 16kHz
|
|
class PresetEcualizador {
|
|
final String nombre;
|
|
final List<double> bandas; // 5 valores entre -12.0 y +12.0 dB
|
|
|
|
const PresetEcualizador({required this.nombre, required this.bandas})
|
|
: assert(bandas.length == 5);
|
|
|
|
static final flat = PresetEcualizador(nombre: 'Flat', bandas: [0.0, 0.0, 0.0, 0.0, 0.0]);
|
|
static final rock = PresetEcualizador(nombre: 'Rock', bandas: [2.0, 1.0, -1.0, 2.0, 3.0]);
|
|
static final pop = PresetEcualizador(nombre: 'Pop', bandas: [1.0, 1.5, 0.5, 1.0, 1.5]);
|
|
static final bassBoost = PresetEcualizador(nombre: 'Bass Boost', bandas: [5.0, 3.0, -1.0, 0.5, 0.0]);
|
|
static final jazz = PresetEcualizador(nombre: 'Jazz', bandas: [3.0, -1.0, -1.5, 2.0, 4.0]);
|
|
static final voz = PresetEcualizador(nombre: 'Voz', bandas: [-2.0, -1.0, 2.0, 3.0, 1.0]);
|
|
|
|
static final presets = [flat, rock, pop, bassBoost, jazz, voz];
|
|
|
|
factory PresetEcualizador.desdeJson(Map<String, dynamic> json) {
|
|
final raw = (json['bandas'] as List?)?.map((e) => (e as num).toDouble()).toList() ?? <double>[];
|
|
final bandas = List<double>.generate(5, (i) => i < raw.length ? raw[i] : 0.0);
|
|
return PresetEcualizador(nombre: json['nombre'] as String? ?? 'Personalizado', bandas: bandas);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {'nombre': nombre, 'bandas': bandas};
|
|
|
|
PresetEcualizador copyWithBandas(List<double> bandas) =>
|
|
PresetEcualizador(nombre: 'Personalizado', bandas: bandas);
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
if (other is! PresetEcualizador) return false;
|
|
if (nombre != other.nombre || bandas.length != other.bandas.length) {
|
|
return false;
|
|
}
|
|
for (int i = 0; i < bandas.length; i++) {
|
|
if (bandas[i] != other.bandas[i]) return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(nombre, Object.hashAll(bandas));
|
|
}
|