feature: Auto next-up preview, skip to next in queue. (#96)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2024-11-01 15:52:54 +01:00 committed by GitHub
parent f72ae9e3ca
commit 66f2b6cd4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 971 additions and 137 deletions

View file

@ -13,7 +13,7 @@ final videoPlayerSettingsProvider =
});
class VideoPlayerSettingsProviderNotifier extends StateNotifier<VideoPlayerSettingsModel> {
VideoPlayerSettingsProviderNotifier(this.ref) : super(const VideoPlayerSettingsModel());
VideoPlayerSettingsProviderNotifier(this.ref) : super(VideoPlayerSettingsModel());
final Ref ref;
@ -29,7 +29,7 @@ class VideoPlayerSettingsProviderNotifier extends StateNotifier<VideoPlayerSetti
void setScreenBrightness(double? value) async {
state = state.copyWith(
screenBrightness: () => value,
screenBrightness: value,
);
if (state.screenBrightness != null) {
ScreenBrightness().setScreenBrightness(state.screenBrightness!);
@ -45,13 +45,13 @@ class VideoPlayerSettingsProviderNotifier extends StateNotifier<VideoPlayerSetti
}
void setFillScreen(bool? value, {BuildContext? context}) {
state = state.copyWith(fillScreen: value);
state = state.copyWith(fillScreen: value ?? false);
}
void setHardwareAccel(bool? value) => state = state.copyWith(hardwareAccel: value);
void setUseLibass(bool? value) => state = state.copyWith(useLibass: value);
void setHardwareAccel(bool? value) => state = state.copyWith(hardwareAccel: value ?? true);
void setUseLibass(bool? value) => state = state.copyWith(useLibass: value ?? false);
void setFitType(BoxFit? value) => state = state.copyWith(videoFit: value);
void setFitType(BoxFit? value) => state = state.copyWith(videoFit: value ?? BoxFit.contain);
void setVolume(double value) {
state = state.copyWith(internalVolume: value);

View file

@ -170,15 +170,15 @@ class SharedUtility {
VideoPlayerSettingsModel get videoPlayerSettings {
try {
return VideoPlayerSettingsModel.fromJson(sharedPreferences.getString(_videoPlayerSettingsKey) ?? "");
return VideoPlayerSettingsModel.fromJson(jsonDecode(sharedPreferences.getString(_videoPlayerSettingsKey) ?? ""));
} catch (e) {
log(e.toString());
return const VideoPlayerSettingsModel();
return VideoPlayerSettingsModel();
}
}
set videoPlayerSettings(VideoPlayerSettingsModel settings) {
sharedPreferences.setString(_videoPlayerSettingsKey, settings.toJson());
sharedPreferences.setString(_videoPlayerSettingsKey, jsonEncode(settings.toJson()));
}
PhotoViewSettingsModel get photoViewSettings {