refactor(state): extract recording and search state, scope screen rebuilds
- New EstadoGrabacion owns the recording service, subscription, directory/size preferences and open-file actions - New EstadoBusqueda owns search, nearby stations, pagination and the min-bitrate filter - New orden_emisoras.dart with the OrdenEmisoras enum, shared sorter and list identity memoization so context.select comparisons work on derived lists - Large screens (inicio, buscar, favoritos, ajustes, reproductor) consume scoped selects/dedicated notifiers instead of root context.watch<EstadoRadio>, so audio buffer events no longer rebuild whole screens - Remove all 15 TODO(S4b) compat members from EstadoRadio; consumers use the dedicated providers. EstadoRadio drops from ~1121 to 753 lines, keeping playback/stations/favorites orchestration - 8 new tests including a rebuild-scoping probe (110 total green), flutter analyze clean
This commit is contained in:
+12
-3
@@ -2,7 +2,9 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'estado/estado_busqueda.dart';
|
||||
import 'estado/estado_ecualizador.dart';
|
||||
import 'estado/estado_grabacion.dart';
|
||||
import 'estado/estado_radio.dart';
|
||||
import 'estado/estado_alarmas.dart';
|
||||
import 'estado/estado_idioma.dart';
|
||||
@@ -36,12 +38,19 @@ class PluriWaveApp extends StatelessWidget {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (_) => EstadoRadio(prefs: prefs)),
|
||||
// EQ notifier (S4-R1). Created and disposed by EstadoRadio during
|
||||
// the S4 transition; this provider only exposes the instance, so it
|
||||
// declares no dispose callback.
|
||||
// Domain notifiers (S4-R1/R2/R3). Created and disposed by EstadoRadio
|
||||
// (they need its services and callbacks at construction); these
|
||||
// providers only expose the instances, so they declare no dispose
|
||||
// callback.
|
||||
ListenableProvider<EstadoEcualizador>(
|
||||
create: (context) => context.read<EstadoRadio>().ecualizador,
|
||||
),
|
||||
ListenableProvider<EstadoGrabacion>(
|
||||
create: (context) => context.read<EstadoRadio>().grabacion,
|
||||
),
|
||||
ListenableProvider<EstadoBusqueda>(
|
||||
create: (context) => context.read<EstadoRadio>().busqueda,
|
||||
),
|
||||
ChangeNotifierProvider(create: (_) => EstadoAlarmas(prefs: prefs)),
|
||||
ChangeNotifierProvider(
|
||||
create: (_) => EstadoIdioma(sharedPreferences: prefs),
|
||||
|
||||
Reference in New Issue
Block a user