viewer: apply modified video quick actions without leaving
This commit is contained in:
parent
24fcb20616
commit
67efa82fe2
2 changed files with 62 additions and 50 deletions
|
@ -26,37 +26,43 @@ class VideoSection extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final currentShowVideos = context.select<Settings, bool>((s) => !s.hiddenFilters.contains(MimeFilter.video));
|
|
||||||
final currentEnableVideoHardwareAcceleration = context.select<Settings, bool>((s) => s.enableVideoHardwareAcceleration);
|
|
||||||
final currentEnableVideoAutoPlay = context.select<Settings, bool>((s) => s.enableVideoAutoPlay);
|
|
||||||
final currentVideoLoopMode = context.select<Settings, VideoLoopMode>((s) => s.videoLoopMode);
|
|
||||||
|
|
||||||
final children = [
|
final children = [
|
||||||
if (!standalonePage)
|
if (!standalonePage)
|
||||||
SwitchListTile(
|
Selector<Settings, bool>(
|
||||||
value: currentShowVideos,
|
selector: (context, s) => !s.hiddenFilters.contains(MimeFilter.video),
|
||||||
|
builder: (context, current, child) => SwitchListTile(
|
||||||
|
value: current,
|
||||||
onChanged: (v) => settings.changeFilterVisibility({MimeFilter.video}, v),
|
onChanged: (v) => settings.changeFilterVisibility({MimeFilter.video}, v),
|
||||||
title: Text(context.l10n.settingsVideoShowVideos),
|
title: Text(context.l10n.settingsVideoShowVideos),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const VideoActionsTile(),
|
const VideoActionsTile(),
|
||||||
SwitchListTile(
|
Selector<Settings, bool>(
|
||||||
value: currentEnableVideoHardwareAcceleration,
|
selector: (context, s) => s.enableVideoHardwareAcceleration,
|
||||||
|
builder: (context, current, child) => SwitchListTile(
|
||||||
|
value: current,
|
||||||
onChanged: (v) => settings.enableVideoHardwareAcceleration = v,
|
onChanged: (v) => settings.enableVideoHardwareAcceleration = v,
|
||||||
title: Text(context.l10n.settingsVideoEnableHardwareAcceleration),
|
title: Text(context.l10n.settingsVideoEnableHardwareAcceleration),
|
||||||
),
|
),
|
||||||
SwitchListTile(
|
),
|
||||||
value: currentEnableVideoAutoPlay,
|
Selector<Settings, bool>(
|
||||||
|
selector: (context, s) => s.enableVideoAutoPlay,
|
||||||
|
builder: (context, current, child) => SwitchListTile(
|
||||||
|
value: current,
|
||||||
onChanged: (v) => settings.enableVideoAutoPlay = v,
|
onChanged: (v) => settings.enableVideoAutoPlay = v,
|
||||||
title: Text(context.l10n.settingsVideoEnableAutoPlay),
|
title: Text(context.l10n.settingsVideoEnableAutoPlay),
|
||||||
),
|
),
|
||||||
ListTile(
|
),
|
||||||
|
Selector<Settings, VideoLoopMode>(
|
||||||
|
selector: (context, s) => s.videoLoopMode,
|
||||||
|
builder: (context, current, child) => ListTile(
|
||||||
title: Text(context.l10n.settingsVideoLoopModeTile),
|
title: Text(context.l10n.settingsVideoLoopModeTile),
|
||||||
subtitle: Text(currentVideoLoopMode.getName(context)),
|
subtitle: Text(current.getName(context)),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final value = await showDialog<VideoLoopMode>(
|
final value = await showDialog<VideoLoopMode>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AvesSelectionDialog<VideoLoopMode>(
|
builder: (context) => AvesSelectionDialog<VideoLoopMode>(
|
||||||
initialValue: currentVideoLoopMode,
|
initialValue: current,
|
||||||
options: Map.fromEntries(VideoLoopMode.values.map((v) => MapEntry(v, v.getName(context)))),
|
options: Map.fromEntries(VideoLoopMode.values.map((v) => MapEntry(v, v.getName(context)))),
|
||||||
title: context.l10n.settingsVideoLoopModeTitle,
|
title: context.l10n.settingsVideoLoopModeTitle,
|
||||||
),
|
),
|
||||||
|
@ -66,6 +72,7 @@ class VideoSection extends StatelessWidget {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
const SubtitleThemeTile(),
|
const SubtitleThemeTile(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,10 @@ class _VideoControlOverlayState extends State<VideoControlOverlay> with SingleTi
|
||||||
builder: (context, mqWidth, child) {
|
builder: (context, mqWidth, child) {
|
||||||
final buttonWidth = OverlayButton.getSize(context);
|
final buttonWidth = OverlayButton.getSize(context);
|
||||||
final availableCount = ((mqWidth - outerPadding * 2) / (buttonWidth + innerPadding)).floor();
|
final availableCount = ((mqWidth - outerPadding * 2) / (buttonWidth + innerPadding)).floor();
|
||||||
final quickActions = settings.videoQuickActions.take(availableCount - 1).toList();
|
return Selector<Settings, List<VideoAction>>(
|
||||||
|
selector: (context, s) => s.videoQuickActions,
|
||||||
|
builder: (context, videoQuickActions, child) {
|
||||||
|
final quickActions = videoQuickActions.take(availableCount - 1).toList();
|
||||||
final menuActions = VideoActions.all.where((action) => !quickActions.contains(action)).toList();
|
final menuActions = VideoActions.all.where((action) => !quickActions.contains(action)).toList();
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
@ -105,6 +108,8 @@ class _VideoControlOverlayState extends State<VideoControlOverlay> with SingleTi
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TooltipTheme(
|
return TooltipTheme(
|
||||||
|
|
Loading…
Reference in a new issue