Added new constant classes to timings.dart: - ImageSizes: defaultSize (256), highRes (512), max (1024) - VolumeConstants: min (0), max (100), range (100) - PlayerStates: playing, paused, idle, off - RepeatModes: off, all, one Updated MusicAssistantProvider and QueueControls to use these constants instead of magic numbers and string literals. This improves code maintainability by: - Eliminating magic numbers - Providing single source of truth for common values - Making code more self-documenting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
822 B
Dart
31 lines
822 B
Dart
import '../constants/timings.dart';
|
|
|
|
/// Utility methods for queue playback controls.
|
|
///
|
|
/// Extracted from MusicAssistantProvider to isolate queue control logic.
|
|
class QueueControls {
|
|
/// Get the next repeat mode in the cycle.
|
|
///
|
|
/// Cycle order: off → all → one → off
|
|
static String getNextRepeatMode(String? currentMode) {
|
|
switch (currentMode) {
|
|
case RepeatModes.off:
|
|
case null:
|
|
return RepeatModes.all;
|
|
case RepeatModes.all:
|
|
return RepeatModes.one;
|
|
case RepeatModes.one:
|
|
return RepeatModes.off;
|
|
default:
|
|
return RepeatModes.off;
|
|
}
|
|
}
|
|
|
|
/// Check if a repeat mode is valid.
|
|
static bool isValidRepeatMode(String? mode) {
|
|
return mode == RepeatModes.off ||
|
|
mode == RepeatModes.all ||
|
|
mode == RepeatModes.one;
|
|
}
|
|
}
|