diff --git a/lib/settings/pages/video_player_settings.dart b/lib/settings/pages/video_player_settings.dart index c8a5b0115..1240c0b86 100644 --- a/lib/settings/pages/video_player_settings.dart +++ b/lib/settings/pages/video_player_settings.dart @@ -21,8 +21,7 @@ class VideoPlayerSettingsPage extends StatefulWidget { final LocalSettings? settingToHighlight; @override - State createState() => - _VideoPlayerSettingsPageState(); + State createState() => _VideoPlayerSettingsPageState(); } class _VideoPlayerSettingsPageState extends State { @@ -97,20 +96,18 @@ class _VideoPlayerSettingsPageState extends State { break; case LocalSettings.videoAutoPlay: await prefs.setString(LocalSettings.videoAutoPlay.name, value); - setState(() => videoAutoPlay = - VideoAutoPlay.values.byName(value ?? VideoAutoPlay.never)); + setState(() => videoAutoPlay = VideoAutoPlay.values.byName(value ?? VideoAutoPlay.never)); break; case LocalSettings.videoDefaultPlaybackSpeed: - await prefs.setString( - LocalSettings.videoDefaultPlaybackSpeed.name, value); - setState(() => videoDefaultPlaybackSpeed = VideoPlayBackSpeed.values - .byName(value ?? VideoPlayBackSpeed.normal)); + await prefs.setString(LocalSettings.videoDefaultPlaybackSpeed.name, value); + setState(() => videoDefaultPlaybackSpeed = VideoPlayBackSpeed.values.byName( + value ?? VideoPlayBackSpeed.normal, + )); break; case LocalSettings.videoPlayerMode: await prefs.setString(LocalSettings.videoPlayerMode.name, value); - setState(() => videoPlayerMode = - VideoPlayerMode.values.byName(value ?? VideoPlayerMode.inApp)); + setState(() => videoPlayerMode = VideoPlayerMode.values.byName(value ?? VideoPlayerMode.inApp)); break; default: } @@ -124,18 +121,13 @@ class _VideoPlayerSettingsPageState extends State { final prefs = (await UserPreferences.instance).sharedPreferences; setState(() { videoAutoMute = prefs.getBool(LocalSettings.videoAutoMute.name) ?? true; - videoAutoFullscreen = - prefs.getBool(LocalSettings.videoAutoFullscreen.name) ?? false; + videoAutoFullscreen = prefs.getBool(LocalSettings.videoAutoFullscreen.name) ?? false; videoAutoLoop = prefs.getBool(LocalSettings.videoAutoLoop.name) ?? false; - videoAutoPlay = VideoAutoPlay.values.byName( - prefs.getString(LocalSettings.videoAutoPlay.name) ?? - VideoAutoPlay.never.name); + videoAutoPlay = VideoAutoPlay.values.byName(prefs.getString(LocalSettings.videoAutoPlay.name) ?? VideoAutoPlay.never.name); videoDefaultPlaybackSpeed = VideoPlayBackSpeed.values.byName( - prefs.getString(LocalSettings.videoDefaultPlaybackSpeed.name) ?? - VideoPlayBackSpeed.normal.name); - videoPlayerMode = VideoPlayerMode.values.byName( - prefs.getString(LocalSettings.videoPlayerMode.name) ?? - VideoPlayerMode.inApp.name); + prefs.getString(LocalSettings.videoDefaultPlaybackSpeed.name) ?? VideoPlayBackSpeed.normal.name, + ); + videoPlayerMode = VideoPlayerMode.values.byName(prefs.getString(LocalSettings.videoPlayerMode.name) ?? VideoPlayerMode.inApp.name); isLoading = false; }); } @@ -158,8 +150,7 @@ class _VideoPlayerSettingsPageState extends State { value: videoAutoFullscreen, iconEnabled: Icons.fullscreen, iconDisabled: Icons.fullscreen_exit, - onToggle: (bool value) => setPreferences( - LocalSettings.videoAutoFullscreen, value), + onToggle: (bool value) => setPreferences(LocalSettings.videoAutoFullscreen, value), highlightKey: settingToHighlightKey, setting: LocalSettings.videoAutoFullscreen, highlightedSetting: settingToHighlight, @@ -169,8 +160,7 @@ class _VideoPlayerSettingsPageState extends State { value: videoAutoMute, iconEnabled: Icons.volume_off, iconDisabled: Icons.volume_up, - onToggle: (bool value) => - setPreferences(LocalSettings.videoAutoMute, value), + onToggle: (bool value) => setPreferences(LocalSettings.videoAutoMute, value), highlightKey: settingToHighlightKey, setting: LocalSettings.videoAutoMute, highlightedSetting: settingToHighlight, @@ -180,8 +170,7 @@ class _VideoPlayerSettingsPageState extends State { value: videoAutoLoop, iconEnabled: Icons.loop, iconDisabled: Icons.loop_outlined, - onToggle: (bool value) => - setPreferences(LocalSettings.videoAutoLoop, value), + onToggle: (bool value) => setPreferences(LocalSettings.videoAutoLoop, value), highlightKey: settingToHighlightKey, setting: LocalSettings.videoAutoLoop, highlightedSetting: settingToHighlight, @@ -197,70 +186,31 @@ class _VideoPlayerSettingsPageState extends State { icon: Icons.video_settings_outlined, payload: videoAutoPlay), options: [ - ListPickerItem( - icon: Icons.not_interested, - label: l10n.never, - payload: VideoAutoPlay.never), - ListPickerItem( - icon: Icons.play_arrow, - label: l10n.always, - payload: VideoAutoPlay.always), - ListPickerItem( - icon: Icons.wifi, - label: l10n.onWifi, - payload: VideoAutoPlay.onWifi), + ListPickerItem(icon: Icons.not_interested, label: l10n.never, payload: VideoAutoPlay.never), + ListPickerItem(icon: Icons.play_arrow, label: l10n.always, payload: VideoAutoPlay.always), + ListPickerItem(icon: Icons.wifi, label: l10n.onWifi, payload: VideoAutoPlay.onWifi), ], icon: Icons.play_circle, - onChanged: (value) async => setPreferences( - LocalSettings.videoAutoPlay, value.payload.name), + onChanged: (value) async => setPreferences(LocalSettings.videoAutoPlay, value.payload.name), highlightKey: settingToHighlightKey, setting: LocalSettings.videoAutoPlay, highlightedSetting: settingToHighlight, ), ListOption( description: l10n.videoDefaultPlaybackSpeed, - value: ListPickerItem( - label: videoDefaultPlaybackSpeed.label, - icon: Icons.speed, - payload: videoDefaultPlaybackSpeed), + value: ListPickerItem(label: videoDefaultPlaybackSpeed.label, icon: Icons.speed, payload: videoDefaultPlaybackSpeed), options: [ - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.pointTow5x.label, - payload: VideoPlayBackSpeed.pointTow5x), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.point5x.label, - payload: VideoPlayBackSpeed.point5x), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.pointSeven5x.label, - payload: VideoPlayBackSpeed.pointSeven5x), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.normal.label, - payload: VideoPlayBackSpeed.normal), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.onePointTwo5x.label, - payload: VideoPlayBackSpeed.onePointTwo5x), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.onePoint5x.label, - payload: VideoPlayBackSpeed.onePoint5x), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.onePointSeven5x.label, - payload: VideoPlayBackSpeed.onePointSeven5x), - ListPickerItem( - icon: Icons.speed, - label: VideoPlayBackSpeed.twoX.label, - payload: VideoPlayBackSpeed.twoX), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.pointTow5x.label, payload: VideoPlayBackSpeed.pointTow5x), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.point5x.label, payload: VideoPlayBackSpeed.point5x), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.pointSeven5x.label, payload: VideoPlayBackSpeed.pointSeven5x), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.normal.label, payload: VideoPlayBackSpeed.normal), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.onePointTwo5x.label, payload: VideoPlayBackSpeed.onePointTwo5x), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.onePoint5x.label, payload: VideoPlayBackSpeed.onePoint5x), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.onePointSeven5x.label, payload: VideoPlayBackSpeed.onePointSeven5x), + ListPickerItem(icon: Icons.speed, label: VideoPlayBackSpeed.twoX.label, payload: VideoPlayBackSpeed.twoX), ], icon: Icons.speed, - onChanged: (value) async => setPreferences( - LocalSettings.videoDefaultPlaybackSpeed, - value.payload.name), + onChanged: (value) async => setPreferences(LocalSettings.videoDefaultPlaybackSpeed, value.payload.name), highlightKey: settingToHighlightKey, setting: LocalSettings.videoDefaultPlaybackSpeed, highlightedSetting: settingToHighlight, @@ -270,31 +220,19 @@ class _VideoPlayerSettingsPageState extends State { value: ListPickerItem( label: switch (videoPlayerMode) { VideoPlayerMode.inApp => l10n.videoPlayerInApp, - VideoPlayerMode.customTabs => - l10n.linkHandlingCustomTabsShort, - VideoPlayerMode.externalPlayer => - l10n.linkHandlingExternalShort, + VideoPlayerMode.customTabs => l10n.linkHandlingCustomTabsShort, + VideoPlayerMode.externalPlayer => l10n.linkHandlingExternalShort, }, payload: videoPlayerMode, capitalizeLabel: false, ), options: [ - ListPickerItem( - label: l10n.videoPlayerInApp, - icon: Icons.play_circle_fill, - payload: VideoPlayerMode.inApp), - ListPickerItem( - label: l10n.linkHandlingCustomTabs, - icon: Icons.language_rounded, - payload: VideoPlayerMode.customTabs), - ListPickerItem( - label: l10n.videoLinkHandlingExternal, - icon: Icons.open_in_browser_rounded, - payload: VideoPlayerMode.externalPlayer), + ListPickerItem(label: l10n.videoPlayerInApp, icon: Icons.play_circle_fill, payload: VideoPlayerMode.inApp), + ListPickerItem(label: l10n.linkHandlingCustomTabs, icon: Icons.language_rounded, payload: VideoPlayerMode.customTabs), + ListPickerItem(label: l10n.videoLinkHandlingExternal, icon: Icons.open_in_browser_rounded, payload: VideoPlayerMode.externalPlayer), ], icon: Icons.video_label_outlined, - onChanged: (value) => setPreferences( - LocalSettings.videoPlayerMode, value.payload.name), + onChanged: (value) => setPreferences(LocalSettings.videoPlayerMode, value.payload.name), highlightKey: settingToHighlightKey, setting: LocalSettings.videoPlayerMode, highlightedSetting: settingToHighlight,