Run dart format lib

This commit is contained in:
Oystein Kristoffer Tveit 2024-12-19 12:26:28 +01:00
parent 50ae080841
commit 013f318df7
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
6 changed files with 40 additions and 29 deletions

View File

@ -60,7 +60,8 @@ class LoopPlaylistChange extends PropertyChangedEvent {
class PercentPositionChange extends PropertyChangedEvent { class PercentPositionChange extends PropertyChangedEvent {
final double currentPercentPosition; final double currentPercentPosition;
const PercentPositionChange(this.currentPercentPosition, { super.local }) : super(); const PercentPositionChange(this.currentPercentPosition, {super.local})
: super();
factory PercentPositionChange.fromJson(dynamic json) { factory PercentPositionChange.fromJson(dynamic json) {
return PercentPositionChange(json ?? 0.0); return PercentPositionChange(json ?? 0.0);
@ -85,7 +86,8 @@ class DurationChange extends PropertyChangedEvent {
const DurationChange(this.duration, {super.local}) : super(); const DurationChange(this.duration, {super.local}) : super();
factory DurationChange.fromJson(dynamic json) { factory DurationChange.fromJson(dynamic json) {
return DurationChange(Duration(milliseconds: ((json ?? 0.0) * 1000).round())); return DurationChange(
Duration(milliseconds: ((json ?? 0.0) * 1000).round()));
} }
} }

View File

@ -70,7 +70,9 @@ class PlayerUIAppBar{
connectionStateBloc.add(Connect(value)); connectionStateBloc.add(Connect(value));
}, },
), ),
playerBlocBuilder(buildProps: (p) => [p.isPausedForCache], builder: (context, state) { playerBlocBuilder(
buildProps: (p) => [p.isPausedForCache],
builder: (context, state) {
// TODO: why is the server not sending paused-for-cache events? // TODO: why is the server not sending paused-for-cache events?
if (state.isPausedForCache) { if (state.isPausedForCache) {
return const CircularProgressIndicator(); return const CircularProgressIndicator();

View File

@ -40,7 +40,8 @@ class ConnectionError extends PlayerConnectionState {
ConnectionError(this.message, this.uri); ConnectionError(this.message, this.uri);
} }
class ConnectionStateBloc extends Bloc<PlayerConnectionEvent, PlayerConnectionState> { class ConnectionStateBloc
extends Bloc<PlayerConnectionEvent, PlayerConnectionState> {
final PlayerStateBloc playerStateBloc; final PlayerStateBloc playerStateBloc;
ConnectionStateBloc(this.playerStateBloc) : super(Disconnected()) { ConnectionStateBloc(this.playerStateBloc) : super(Disconnected()) {

View File

@ -33,7 +33,8 @@ class PlayerState {
factory PlayerState.fromJson(Map<String, dynamic> json) { factory PlayerState.fromJson(Map<String, dynamic> json) {
return PlayerState( return PlayerState(
cachedTimestamp: json['cached_timestamp'], cachedTimestamp: json['cached_timestamp'],
chapters: (json['chapters'] as List).map((e) => Chapter.fromJson(e)).toList(), chapters:
(json['chapters'] as List).map((e) => Chapter.fromJson(e)).toList(),
currentPercentPosition: json['current_percent_pos'], currentPercentPosition: json['current_percent_pos'],
currentTrack: json['current_track'], currentTrack: json['current_track'],
duration: Duration(milliseconds: (json['duration'] * 1000).round()), duration: Duration(milliseconds: (json['duration'] * 1000).round()),
@ -41,8 +42,12 @@ class PlayerState {
isMuted: json['is_muted'], isMuted: json['is_muted'],
isPlaying: json['is_playing'], isPlaying: json['is_playing'],
isPausedForCache: json['is_paused_for_cache'], isPausedForCache: json['is_paused_for_cache'],
playlist: (json['playlist'] as List).map((e) => PlaylistItem.fromJson(e)).toList(), playlist: (json['playlist'] as List)
subtitleTracks: (json['tracks'] as List).map((e) => SubtitleTrack.fromJson(e)).toList(), .map((e) => PlaylistItem.fromJson(e))
.toList(),
subtitleTracks: (json['tracks'] as List)
.map((e) => SubtitleTrack.fromJson(e))
.toList(),
volume: json['volume'], volume: json['volume'],
); );
} }
@ -64,7 +69,8 @@ class PlayerState {
return PlayerState( return PlayerState(
cachedTimestamp: cachedTimestamp ?? this.cachedTimestamp, cachedTimestamp: cachedTimestamp ?? this.cachedTimestamp,
chapters: chapters ?? this.chapters, chapters: chapters ?? this.chapters,
currentPercentPosition: currentPercentPosition ?? this.currentPercentPosition, currentPercentPosition:
currentPercentPosition ?? this.currentPercentPosition,
currentTrack: currentTrack ?? this.currentTrack, currentTrack: currentTrack ?? this.currentTrack,
duration: duration ?? this.duration, duration: duration ?? this.duration,
isLooping: isLooping ?? this.isLooping, isLooping: isLooping ?? this.isLooping,