diff options
Diffstat (limited to 'lib/data/data_providers/radio_notifier.dart')
-rw-r--r-- | lib/data/data_providers/radio_notifier.dart | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/data/data_providers/radio_notifier.dart b/lib/data/data_providers/radio_notifier.dart new file mode 100644 index 0000000..90e0df5 --- /dev/null +++ b/lib/data/data_providers/radio_notifier.dart @@ -0,0 +1,31 @@ +import 'package:flutter_ics_homescreen/export.dart'; + +class RadioStateNotifier extends Notifier<RadioState> { + @override + RadioState build() { + return RadioState.initial(); + } + + void updateBandParameters( + {required int freqMin, required freqMax, required freqStep}) { + state = + state.copyWith(freqMin: freqMin, freqMax: freqMax, freqStep: freqStep); + } + + void updateFrequency(int frequency) { + state = state.copyWith(freqCurrent: frequency); + } + + void setFrequency(int frequency) { + state = state.copyWith(freqCurrent: frequency); + ref.read(radioClientProvider).setFrequency(frequency); + } + + void updatePlaying(bool playing) { + state = state.copyWith(playing: playing); + } + + void updateScanning(bool scanning) { + state = state.copyWith(scanning: scanning); + } +} |