Enable PiP by default

This commit is contained in:
Tommy Chow
2022-09-12 22:37:25 -04:00
parent b2f932d4c0
commit b0ed3f28bc
4 changed files with 7 additions and 40 deletions

View File

@ -327,15 +327,14 @@ class VideoOverlay extends StatelessWidget {
),
),
),
if (videoStore.settingsStore.pictureInPicture)
IconButton(
tooltip: 'Picture-in-picture',
icon: const Icon(
Icons.picture_in_picture_alt_rounded,
color: Colors.white,
),
onPressed: videoStore.requestPictureInPicture,
IconButton(
tooltip: 'Picture-in-picture',
icon: const Icon(
Icons.picture_in_picture_alt_rounded,
color: Colors.white,
),
onPressed: videoStore.requestPictureInPicture,
),
refreshButton,
if (!videoStore.isIPad) rotateButton,
if (orientation == Orientation.landscape) fullScreenButton,

View File

@ -52,7 +52,6 @@ abstract class _SettingsStoreBase with Store {
static const defaultShowVideo = true;
static const defaultShowOverlay = true;
static const defaultToggleableOverlay = false;
static const defaultPictureInPicture = false;
static const defaultOverlayOpacity = 0.5;
@JsonKey(defaultValue: defaultShowVideo)
@ -67,10 +66,6 @@ abstract class _SettingsStoreBase with Store {
@observable
var toggleableOverlay = defaultToggleableOverlay;
@JsonKey(defaultValue: defaultPictureInPicture)
@observable
var pictureInPicture = defaultPictureInPicture;
@JsonKey(defaultValue: defaultOverlayOpacity)
@observable
var overlayOpacity = defaultOverlayOpacity;
@ -80,7 +75,6 @@ abstract class _SettingsStoreBase with Store {
showVideo = defaultShowVideo;
showOverlay = defaultShowOverlay;
toggleableOverlay = defaultToggleableOverlay;
pictureInPicture = defaultPictureInPicture;
overlayOpacity = defaultOverlayOpacity;
}

View File

@ -18,7 +18,6 @@ SettingsStore _$SettingsStoreFromJson(Map<String, dynamic> json) =>
..showVideo = json['showVideo'] as bool? ?? true
..showOverlay = json['showOverlay'] as bool? ?? true
..toggleableOverlay = json['toggleableOverlay'] as bool? ?? false
..pictureInPicture = json['pictureInPicture'] as bool? ?? false
..overlayOpacity = (json['overlayOpacity'] as num?)?.toDouble() ?? 0.5
..chatDelay = (json['chatDelay'] as num?)?.toDouble() ?? 0.0
..chatOnlyPreventSleep = json['chatOnlyPreventSleep'] as bool? ?? true
@ -67,7 +66,6 @@ Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) =>
'showVideo': instance.showVideo,
'showOverlay': instance.showOverlay,
'toggleableOverlay': instance.toggleableOverlay,
'pictureInPicture': instance.pictureInPicture,
'overlayOpacity': instance.overlayOpacity,
'chatDelay': instance.chatDelay,
'chatOnlyPreventSleep': instance.chatOnlyPreventSleep,
@ -253,22 +251,6 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
});
}
late final _$pictureInPictureAtom =
Atom(name: '_SettingsStoreBase.pictureInPicture', context: context);
@override
bool get pictureInPicture {
_$pictureInPictureAtom.reportRead();
return super.pictureInPicture;
}
@override
set pictureInPicture(bool value) {
_$pictureInPictureAtom.reportWrite(value, super.pictureInPicture, () {
super.pictureInPicture = value;
});
}
late final _$overlayOpacityAtom =
Atom(name: '_SettingsStoreBase.overlayOpacity', context: context);
@ -791,7 +773,6 @@ launchUrlExternal: ${launchUrlExternal},
showVideo: ${showVideo},
showOverlay: ${showOverlay},
toggleableOverlay: ${toggleableOverlay},
pictureInPicture: ${pictureInPicture},
overlayOpacity: ${overlayOpacity},
chatDelay: ${chatDelay},
chatOnlyPreventSleep: ${chatOnlyPreventSleep},

View File

@ -32,13 +32,6 @@ class VideoSettings extends StatelessWidget {
value: settingsStore.showOverlay,
onChanged: settingsStore.showVideo ? (newValue) => settingsStore.showOverlay = newValue : null,
),
SwitchListTile.adaptive(
isThreeLine: true,
title: const Text('Picture-in-picture button (experimental)'),
subtitle: const Text('Adds a button to enter PiP mode on the bottom right of the overlay (may cause freezes/crashes).'),
value: settingsStore.pictureInPicture,
onChanged: settingsStore.showVideo && settingsStore.showOverlay ? (newValue) => settingsStore.pictureInPicture = newValue : null,
),
SwitchListTile.adaptive(
isThreeLine: true,
title: const Text('Long-press player to toggle overlay'),