style: apply dart formatting fixes across lib/ and test/
11 files had formatting inconsistencies that caused the --set-exit-if-changed gate to fail. Automated formatting via dart format now passes cleanly.
This commit is contained in:
@@ -25,36 +25,52 @@ class AppThemeColors {
|
|||||||
|
|
||||||
/// Website: `primary` → headings (h1–h6)
|
/// Website: `primary` → headings (h1–h6)
|
||||||
final Color headingColor;
|
final Color headingColor;
|
||||||
|
|
||||||
/// Website: `accent` → links & accent highlights
|
/// Website: `accent` → links & accent highlights
|
||||||
final Color accentColor;
|
final Color accentColor;
|
||||||
|
|
||||||
/// Page background gradient start — website: `background` (cream)
|
/// Page background gradient start — website: `background` (cream)
|
||||||
final Color scaffoldGradientStart;
|
final Color scaffoldGradientStart;
|
||||||
|
|
||||||
/// Page background gradient end — website: `light`
|
/// Page background gradient end — website: `light`
|
||||||
final Color scaffoldGradientEnd;
|
final Color scaffoldGradientEnd;
|
||||||
|
|
||||||
/// Top header card surface
|
/// Top header card surface
|
||||||
final Color shellSurface;
|
final Color shellSurface;
|
||||||
|
|
||||||
/// Top header card border
|
/// Top header card border
|
||||||
final Color shellBorder;
|
final Color shellBorder;
|
||||||
|
|
||||||
/// Website: `medium` → muted / secondary text
|
/// Website: `medium` → muted / secondary text
|
||||||
final Color mutedText;
|
final Color mutedText;
|
||||||
|
|
||||||
/// Website: `white` → text on dark surfaces
|
/// Website: `white` → text on dark surfaces
|
||||||
final Color textOnDark;
|
final Color textOnDark;
|
||||||
|
|
||||||
/// Website: `light` → secondary text on dark surfaces
|
/// Website: `light` → secondary text on dark surfaces
|
||||||
final Color textOnDarkSecondary;
|
final Color textOnDarkSecondary;
|
||||||
|
|
||||||
/// Controls bar / card surface gradient start — website: `primary_dark`
|
/// Controls bar / card surface gradient start — website: `primary_dark`
|
||||||
final Color controlsGradientStart;
|
final Color controlsGradientStart;
|
||||||
|
|
||||||
/// Controls bar / card surface gradient end — website: `primary_dark`
|
/// Controls bar / card surface gradient end — website: `primary_dark`
|
||||||
final Color controlsGradientEnd;
|
final Color controlsGradientEnd;
|
||||||
|
|
||||||
/// Shadow color for elevated surfaces
|
/// Shadow color for elevated surfaces
|
||||||
final Color controlsShadow;
|
final Color controlsShadow;
|
||||||
|
|
||||||
/// Website: `text` → body text
|
/// Website: `text` → body text
|
||||||
final Color bodyText;
|
final Color bodyText;
|
||||||
|
|
||||||
/// Inner card background overlay — derived from `primary_dark` / `primary_light`
|
/// Inner card background overlay — derived from `primary_dark` / `primary_light`
|
||||||
final Color cardSurface;
|
final Color cardSurface;
|
||||||
|
|
||||||
/// Inner card border — derived from `primary_dark` / `primary_light`
|
/// Inner card border — derived from `primary_dark` / `primary_light`
|
||||||
final Color cardBorder;
|
final Color cardBorder;
|
||||||
|
|
||||||
/// Website: `success` → live indicator, success states
|
/// Website: `success` → live indicator, success states
|
||||||
final Color successColor;
|
final Color successColor;
|
||||||
|
|
||||||
/// Website: `danger` → error states
|
/// Website: `danger` → error states
|
||||||
final Color dangerColor;
|
final Color dangerColor;
|
||||||
}
|
}
|
||||||
|
|||||||
+24
-20
@@ -28,10 +28,7 @@ class KryzAudioHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
title: AppConfig.defaultTitle,
|
title: AppConfig.defaultTitle,
|
||||||
artist: AppConfig.defaultArtist,
|
artist: AppConfig.defaultArtist,
|
||||||
album: 'Live',
|
album: 'Live',
|
||||||
extras: <String, dynamic>{
|
extras: <String, dynamic>{'isLive': true, 'seekable': false},
|
||||||
'isLive': true,
|
|
||||||
'seekable': false,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final AudioPlayer _player = AudioPlayer();
|
final AudioPlayer _player = AudioPlayer();
|
||||||
@@ -83,10 +80,7 @@ class KryzAudioHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
try {
|
try {
|
||||||
if (!_isSourceLoaded) {
|
if (!_isSourceLoaded) {
|
||||||
await _player.setAudioSource(
|
await _player.setAudioSource(
|
||||||
AudioSource.uri(
|
AudioSource.uri(Uri.parse(streamUrl), tag: mediaItem.value),
|
||||||
Uri.parse(streamUrl),
|
|
||||||
tag: mediaItem.value,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
_isSourceLoaded = true;
|
_isSourceLoaded = true;
|
||||||
}
|
}
|
||||||
@@ -159,25 +153,35 @@ class KryzAudioHandler extends BaseAudioHandler with SeekHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onPlayerStateChanged(PlayerState state) {
|
void _onPlayerStateChanged(PlayerState state) {
|
||||||
final AudioProcessingState processingState = switch (state.processingState) {
|
final AudioProcessingState processingState =
|
||||||
ProcessingState.idle => AudioProcessingState.idle,
|
switch (state.processingState) {
|
||||||
ProcessingState.loading => AudioProcessingState.loading,
|
ProcessingState.idle => AudioProcessingState.idle,
|
||||||
ProcessingState.buffering => AudioProcessingState.buffering,
|
ProcessingState.loading => AudioProcessingState.loading,
|
||||||
ProcessingState.ready => AudioProcessingState.ready,
|
ProcessingState.buffering => AudioProcessingState.buffering,
|
||||||
ProcessingState.completed => AudioProcessingState.completed,
|
ProcessingState.ready => AudioProcessingState.ready,
|
||||||
};
|
ProcessingState.completed => AudioProcessingState.completed,
|
||||||
|
};
|
||||||
|
|
||||||
final bool isPlaying = state.playing && state.processingState == ProcessingState.ready;
|
final bool isPlaying =
|
||||||
final bool isBuffering = (state.playing && state.processingState != ProcessingState.ready) ||
|
state.playing && state.processingState == ProcessingState.ready;
|
||||||
(_playRequested && !state.playing && state.processingState != ProcessingState.completed);
|
final bool isBuffering =
|
||||||
|
(state.playing && state.processingState != ProcessingState.ready) ||
|
||||||
|
(_playRequested &&
|
||||||
|
!state.playing &&
|
||||||
|
state.processingState != ProcessingState.completed);
|
||||||
|
|
||||||
playbackState.add(
|
playbackState.add(
|
||||||
playbackState.value.copyWith(
|
playbackState.value.copyWith(
|
||||||
controls: <MediaControl>[
|
controls: <MediaControl>[
|
||||||
if (isPlaying || isBuffering) MediaControl.stop else MediaControl.play,
|
if (isPlaying || isBuffering)
|
||||||
|
MediaControl.stop
|
||||||
|
else
|
||||||
|
MediaControl.play,
|
||||||
],
|
],
|
||||||
systemActions: const <MediaAction>{},
|
systemActions: const <MediaAction>{},
|
||||||
processingState: isBuffering ? AudioProcessingState.buffering : processingState,
|
processingState: isBuffering
|
||||||
|
? AudioProcessingState.buffering
|
||||||
|
: processingState,
|
||||||
playing: isPlaying,
|
playing: isPlaying,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ class LiveInfoBusinessObject extends ChangeNotifier {
|
|||||||
String? endpoint,
|
String? endpoint,
|
||||||
int refreshIntervalSeconds = 20,
|
int refreshIntervalSeconds = 20,
|
||||||
this.requestTimeout = const Duration(seconds: 8),
|
this.requestTimeout = const Duration(seconds: 8),
|
||||||
}) : _endpointOverride = endpoint,
|
}) : _endpointOverride = endpoint,
|
||||||
_refreshIntervalSeconds = refreshIntervalSeconds;
|
_refreshIntervalSeconds = refreshIntervalSeconds;
|
||||||
|
|
||||||
/// Explicit endpoint passed at construction, if any.
|
/// Explicit endpoint passed at construction, if any.
|
||||||
final String? _endpointOverride;
|
final String? _endpointOverride;
|
||||||
@@ -23,12 +23,16 @@ class LiveInfoBusinessObject extends ChangeNotifier {
|
|||||||
if (override != null && override.isNotEmpty) {
|
if (override != null && override.isNotEmpty) {
|
||||||
return override;
|
return override;
|
||||||
}
|
}
|
||||||
const envUrl = String.fromEnvironment('KRYZ_LIVE_INFO_URL', defaultValue: '');
|
const envUrl = String.fromEnvironment(
|
||||||
|
'KRYZ_LIVE_INFO_URL',
|
||||||
|
defaultValue: '',
|
||||||
|
);
|
||||||
if (envUrl.isNotEmpty) {
|
if (envUrl.isNotEmpty) {
|
||||||
return envUrl;
|
return envUrl;
|
||||||
}
|
}
|
||||||
return AppConfig.metadataUrl ?? '';
|
return AppConfig.metadataUrl ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
final Duration requestTimeout;
|
final Duration requestTimeout;
|
||||||
|
|
||||||
Timer? _pollTimer;
|
Timer? _pollTimer;
|
||||||
|
|||||||
+1
-2
@@ -458,8 +458,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver {
|
|||||||
label: const Text('Stop'),
|
label: const Text('Stop'),
|
||||||
),
|
),
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
onPressed:
|
onPressed: _casting.status == CastingStatus.connecting
|
||||||
_casting.status == CastingStatus.connecting
|
|
||||||
? null
|
? null
|
||||||
: _toggleCasting,
|
: _toggleCasting,
|
||||||
icon: Icon(_castingIcon()),
|
icon: Icon(_castingIcon()),
|
||||||
|
|||||||
+2
-7
@@ -39,9 +39,7 @@ class ShowCard extends StatelessWidget {
|
|||||||
'$label: ${show?.name ?? 'No scheduled show'}',
|
'$label: ${show?.name ?? 'No scheduled show'}',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: Theme.of(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
context,
|
|
||||||
).textTheme.bodyMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: titleColor,
|
color: titleColor,
|
||||||
),
|
),
|
||||||
@@ -49,10 +47,7 @@ class ShowCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
formatStartingTime(
|
formatStartingTime(show?.starts, sourceTimezone: sourceTimezone),
|
||||||
show?.starts,
|
|
||||||
sourceTimezone: sourceTimezone,
|
|
||||||
),
|
|
||||||
style: Theme.of(
|
style: Theme.of(
|
||||||
context,
|
context,
|
||||||
).textTheme.labelSmall?.copyWith(color: titleColor),
|
).textTheme.labelSmall?.copyWith(color: titleColor),
|
||||||
|
|||||||
@@ -35,21 +35,25 @@ class StreamingAudioBusinessObject extends ChangeNotifier {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_audioHandlerInitFuture ??= AudioService.init(
|
_audioHandlerInitFuture ??=
|
||||||
builder: () => KryzAudioHandler(),
|
AudioService.init(
|
||||||
config: const AudioServiceConfig(
|
builder: () => KryzAudioHandler(),
|
||||||
androidNotificationChannelId: 'com.kryzgoflutter.audio.channel',
|
config: const AudioServiceConfig(
|
||||||
androidNotificationChannelName: '${AppConfig.appName} Audio Playback',
|
androidNotificationChannelId: 'com.kryzgoflutter.audio.channel',
|
||||||
androidNotificationOngoing: true,
|
androidNotificationChannelName:
|
||||||
androidStopForegroundOnPause: true,
|
'${AppConfig.appName} Audio Playback',
|
||||||
),
|
androidNotificationOngoing: true,
|
||||||
).then((handler) {
|
androidStopForegroundOnPause: true,
|
||||||
_audioHandler = handler;
|
),
|
||||||
return handler;
|
)
|
||||||
}).catchError((error) {
|
.then((handler) {
|
||||||
_audioHandlerInitFuture = null;
|
_audioHandler = handler;
|
||||||
throw error;
|
return handler;
|
||||||
});
|
})
|
||||||
|
.catchError((error) {
|
||||||
|
_audioHandlerInitFuture = null;
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
|
||||||
await _audioHandlerInitFuture;
|
await _audioHandlerInitFuture;
|
||||||
}
|
}
|
||||||
@@ -146,9 +150,12 @@ class StreamingAudioBusinessObject extends ChangeNotifier {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final title = item.title.trim().isEmpty ? AppConfig.defaultTitle : item.title;
|
final title = item.title.trim().isEmpty
|
||||||
final subtitle =
|
? AppConfig.defaultTitle
|
||||||
(item.artist ?? '').trim().isEmpty ? AppConfig.defaultArtist : item.artist!.trim();
|
: item.title;
|
||||||
|
final subtitle = (item.artist ?? '').trim().isEmpty
|
||||||
|
? AppConfig.defaultArtist
|
||||||
|
: item.artist!.trim();
|
||||||
|
|
||||||
if (title == _currentTitle && subtitle == _currentSubtitle) {
|
if (title == _currentTitle && subtitle == _currentSubtitle) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -120,8 +120,9 @@ DateTime? _tryParseServerDateTime(String value) {
|
|||||||
final int second = parsePart(6);
|
final int second = parsePart(6);
|
||||||
|
|
||||||
final String fraction = (match.group(7) ?? '').padRight(6, '0');
|
final String fraction = (match.group(7) ?? '').padRight(6, '0');
|
||||||
final int microseconds =
|
final int microseconds = fraction.isEmpty
|
||||||
fraction.isEmpty ? 0 : int.parse(fraction.substring(0, 6));
|
? 0
|
||||||
|
: int.parse(fraction.substring(0, 6));
|
||||||
|
|
||||||
return DateTime(
|
return DateTime(
|
||||||
year,
|
year,
|
||||||
|
|||||||
+2
-6
@@ -47,9 +47,7 @@ class TrackCard extends StatelessWidget {
|
|||||||
title,
|
title,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: Theme.of(
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||||
context,
|
|
||||||
).textTheme.titleMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
color: titleColor,
|
color: titleColor,
|
||||||
),
|
),
|
||||||
@@ -66,9 +64,7 @@ class TrackCard extends StatelessWidget {
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
Text(
|
Text(
|
||||||
window,
|
window,
|
||||||
style: Theme.of(
|
style: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||||
context,
|
|
||||||
).textTheme.labelMedium?.copyWith(
|
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: titleColor,
|
color: titleColor,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -54,46 +54,51 @@ void main() {
|
|||||||
|
|
||||||
test('does not double-convert timestamps with explicit UTC designator', () {
|
test('does not double-convert timestamps with explicit UTC designator', () {
|
||||||
const String utcStamp = '2026-05-15T03:00:00Z';
|
const String utcStamp = '2026-05-15T03:00:00Z';
|
||||||
final String expected = DateFormat('jm').format(DateTime.parse(utcStamp).toLocal());
|
final String expected = DateFormat(
|
||||||
|
'jm',
|
||||||
|
).format(DateTime.parse(utcStamp).toLocal());
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
formatStartingTime(
|
formatStartingTime(utcStamp, sourceTimezone: 'America/Los_Angeles'),
|
||||||
utcStamp,
|
|
||||||
sourceTimezone: 'America/Los_Angeles',
|
|
||||||
),
|
|
||||||
expected,
|
expected,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('keeps wall-clock time when local matches source zone for naive input', () {
|
test(
|
||||||
const String sourceTime = '2026-05-14 20:00:00';
|
'keeps wall-clock time when local matches source zone for naive input',
|
||||||
const String sourceZone = 'America/Los_Angeles';
|
() {
|
||||||
|
const String sourceTime = '2026-05-14 20:00:00';
|
||||||
|
const String sourceZone = 'America/Los_Angeles';
|
||||||
|
|
||||||
final tz.TZDateTime source = tz.TZDateTime(
|
final tz.TZDateTime source = tz.TZDateTime(
|
||||||
tz.getLocation(sourceZone),
|
tz.getLocation(sourceZone),
|
||||||
2026,
|
2026,
|
||||||
5,
|
5,
|
||||||
14,
|
14,
|
||||||
20,
|
20,
|
||||||
);
|
);
|
||||||
final String expected = DateFormat('jm').format(
|
final String expected = DateFormat('jm').format(
|
||||||
DateTime.fromMillisecondsSinceEpoch(
|
DateTime.fromMillisecondsSinceEpoch(
|
||||||
source.millisecondsSinceEpoch,
|
source.millisecondsSinceEpoch,
|
||||||
isUtc: true,
|
isUtc: true,
|
||||||
).toLocal(),
|
).toLocal(),
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
formatStartingTime(sourceTime, sourceTimezone: sourceZone),
|
formatStartingTime(sourceTime, sourceTimezone: sourceZone),
|
||||||
expected,
|
expected,
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
group('formatTimeWindow', () {
|
group('formatTimeWindow', () {
|
||||||
test('returns mm:ss style duration from server times', () {
|
test('returns mm:ss style duration from server times', () {
|
||||||
expect(
|
expect(
|
||||||
formatTimeWindow('2026-05-15 05:18:46.000000', '2026-05-15 05:23:21.000000'),
|
formatTimeWindow(
|
||||||
|
'2026-05-15 05:18:46.000000',
|
||||||
|
'2026-05-15 05:23:21.000000',
|
||||||
|
),
|
||||||
'04:35',
|
'04:35',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,13 @@ void main() {
|
|||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
|
||||||
expect(find.text('KRYZ Go!'), findsWidgets);
|
expect(find.text('KRYZ Go!'), findsWidgets);
|
||||||
expect(find.widgetWithIcon(ElevatedButton, Icons.play_arrow_rounded), findsOneWidget);
|
expect(
|
||||||
expect(find.widgetWithIcon(ElevatedButton, Icons.stop_rounded), findsOneWidget);
|
find.widgetWithIcon(ElevatedButton, Icons.play_arrow_rounded),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
find.widgetWithIcon(ElevatedButton, Icons.stop_rounded),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user