settings: option to disable viewer overlay blur effect
This commit is contained in:
parent
cb8f90a5d6
commit
fabb2904f9
9 changed files with 85 additions and 43 deletions
|
@ -587,6 +587,8 @@
|
|||
"@settingsViewerShowInformationSubtitle": {},
|
||||
"settingsViewerShowShootingDetails": "Show shooting details",
|
||||
"@settingsViewerShowShootingDetails": {},
|
||||
"settingsViewerEnableOverlayBlurEffect": "Overlay blur effect",
|
||||
"@settingsViewerEnableOverlayBlurEffect": {},
|
||||
|
||||
"settingsViewerQuickActionsTile": "Quick actions",
|
||||
"@settingsViewerQuickActionsTile": {},
|
||||
|
|
|
@ -274,6 +274,7 @@
|
|||
"settingsViewerShowInformation": "상세 정보 표시",
|
||||
"settingsViewerShowInformationSubtitle": "제목, 날짜, 장소 등 표시",
|
||||
"settingsViewerShowShootingDetails": "촬영 정보 표시",
|
||||
"settingsViewerEnableOverlayBlurEffect": "오버레이 흐림 효과",
|
||||
|
||||
"settingsViewerQuickActionsTile": "빠른 작업",
|
||||
"settingsViewerQuickActionEditorTitle": "빠른 작업",
|
||||
|
|
|
@ -61,13 +61,14 @@ class Settings extends ChangeNotifier {
|
|||
static const hiddenFiltersKey = 'hidden_filters';
|
||||
|
||||
// viewer
|
||||
static const viewerQuickActionsKey = 'viewer_quick_actions';
|
||||
static const showOverlayMinimapKey = 'show_overlay_minimap';
|
||||
static const showOverlayInfoKey = 'show_overlay_info';
|
||||
static const showOverlayShootingDetailsKey = 'show_overlay_shooting_details';
|
||||
static const viewerQuickActionsKey = 'viewer_quick_actions';
|
||||
static const videoQuickActionsKey = 'video_quick_actions';
|
||||
static const enableOverlayBlurEffectKey = 'enable_overlay_blur_effect';
|
||||
|
||||
// video
|
||||
static const videoQuickActionsKey = 'video_quick_actions';
|
||||
static const enableVideoHardwareAccelerationKey = 'video_hwaccel_mediacodec';
|
||||
static const enableVideoAutoPlayKey = 'video_auto_play';
|
||||
static const videoLoopModeKey = 'video_loop';
|
||||
|
@ -240,6 +241,10 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// viewer
|
||||
|
||||
List<EntryAction> get viewerQuickActions => getEnumListOrDefault(viewerQuickActionsKey, viewerQuickActionsDefault, EntryAction.values);
|
||||
|
||||
set viewerQuickActions(List<EntryAction> newValue) => setAndNotify(viewerQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
bool get showOverlayMinimap => getBoolOrDefault(showOverlayMinimapKey, false);
|
||||
|
||||
set showOverlayMinimap(bool newValue) => setAndNotify(showOverlayMinimapKey, newValue);
|
||||
|
@ -252,16 +257,16 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set showOverlayShootingDetails(bool newValue) => setAndNotify(showOverlayShootingDetailsKey, newValue);
|
||||
|
||||
List<EntryAction> get viewerQuickActions => getEnumListOrDefault(viewerQuickActionsKey, viewerQuickActionsDefault, EntryAction.values);
|
||||
bool get enableOverlayBlurEffect => getBoolOrDefault(enableOverlayBlurEffectKey, true);
|
||||
|
||||
set viewerQuickActions(List<EntryAction> newValue) => setAndNotify(viewerQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
set enableOverlayBlurEffect(bool newValue) => setAndNotify(enableOverlayBlurEffectKey, newValue);
|
||||
|
||||
// video
|
||||
|
||||
List<VideoAction> get videoQuickActions => getEnumListOrDefault(videoQuickActionsKey, videoQuickActionsDefault, VideoAction.values);
|
||||
|
||||
set videoQuickActions(List<VideoAction> newValue) => setAndNotify(videoQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
// video
|
||||
|
||||
bool get enableVideoHardwareAcceleration => getBoolOrDefault(enableVideoHardwareAccelerationKey, true);
|
||||
|
||||
set enableVideoHardwareAcceleration(bool newValue) => setAndNotify(enableVideoHardwareAccelerationKey, newValue);
|
||||
|
@ -452,6 +457,7 @@ class Settings extends ChangeNotifier {
|
|||
case showOverlayMinimapKey:
|
||||
case showOverlayInfoKey:
|
||||
case showOverlayShootingDetailsKey:
|
||||
case enableOverlayBlurEffectKey:
|
||||
case enableVideoHardwareAccelerationKey:
|
||||
case enableVideoAutoPlayKey:
|
||||
case subtitleShowOutlineKey:
|
||||
|
|
|
@ -28,42 +28,50 @@ class BlurredRect extends StatelessWidget {
|
|||
}
|
||||
|
||||
class BlurredRRect extends StatelessWidget {
|
||||
final bool enabled;
|
||||
final double borderRadius;
|
||||
final Widget child;
|
||||
|
||||
const BlurredRRect({
|
||||
Key? key,
|
||||
this.enabled = true,
|
||||
required this.borderRadius,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
|
||||
child: BackdropFilter(
|
||||
filter: _filter,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
return enabled
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
|
||||
child: BackdropFilter(
|
||||
filter: _filter,
|
||||
child: child,
|
||||
),
|
||||
)
|
||||
: child;
|
||||
}
|
||||
}
|
||||
|
||||
class BlurredOval extends StatelessWidget {
|
||||
final bool enabled;
|
||||
final Widget child;
|
||||
|
||||
const BlurredOval({
|
||||
Key? key,
|
||||
this.enabled = true,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ClipOval(
|
||||
child: BackdropFilter(
|
||||
filter: _filter,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
return enabled
|
||||
? ClipOval(
|
||||
child: BackdropFilter(
|
||||
filter: _filter,
|
||||
child: child,
|
||||
),
|
||||
)
|
||||
: child;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import 'package:aves/widgets/settings/viewer/entry_background.dart';
|
|||
import 'package:aves/widgets/settings/viewer/viewer_actions_editor.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class ViewerSection extends StatelessWidget {
|
||||
final ValueNotifier<String?> expandedNotifier;
|
||||
|
@ -20,11 +21,6 @@ class ViewerSection extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final currentShowOverlayMinimap = context.select<Settings, bool>((s) => s.showOverlayMinimap);
|
||||
final currentShowOverlayInfo = context.select<Settings, bool>((s) => s.showOverlayInfo);
|
||||
final currentShowOverlayShootingDetails = context.select<Settings, bool>((s) => s.showOverlayShootingDetails);
|
||||
final currentImageBackground = context.select<Settings, EntryBackground>((s) => s.imageBackground);
|
||||
|
||||
return AvesExpansionTile(
|
||||
leading: SettingsTileLeading(
|
||||
icon: AIcons.image,
|
||||
|
@ -35,27 +31,51 @@ class ViewerSection extends StatelessWidget {
|
|||
showHighlight: false,
|
||||
children: [
|
||||
const ViewerActionsTile(),
|
||||
SwitchListTile(
|
||||
value: currentShowOverlayMinimap,
|
||||
onChanged: (v) => settings.showOverlayMinimap = v,
|
||||
title: Text(context.l10n.settingsViewerShowMinimap),
|
||||
Selector<Settings, bool>(
|
||||
selector: (context, s) => s.showOverlayMinimap,
|
||||
builder: (context, current, child) => SwitchListTile(
|
||||
value: current,
|
||||
onChanged: (v) => settings.showOverlayMinimap = v,
|
||||
title: Text(context.l10n.settingsViewerShowMinimap),
|
||||
),
|
||||
),
|
||||
SwitchListTile(
|
||||
value: currentShowOverlayInfo,
|
||||
onChanged: (v) => settings.showOverlayInfo = v,
|
||||
title: Text(context.l10n.settingsViewerShowInformation),
|
||||
subtitle: Text(context.l10n.settingsViewerShowInformationSubtitle),
|
||||
Selector<Settings, bool>(
|
||||
selector: (context, s) => s.showOverlayInfo,
|
||||
builder: (context, current, child) => SwitchListTile(
|
||||
value: current,
|
||||
onChanged: (v) => settings.showOverlayInfo = v,
|
||||
title: Text(context.l10n.settingsViewerShowInformation),
|
||||
subtitle: Text(context.l10n.settingsViewerShowInformationSubtitle),
|
||||
),
|
||||
),
|
||||
SwitchListTile(
|
||||
value: currentShowOverlayShootingDetails,
|
||||
onChanged: currentShowOverlayInfo ? (v) => settings.showOverlayShootingDetails = v : null,
|
||||
title: Text(context.l10n.settingsViewerShowShootingDetails),
|
||||
Selector<Settings, Tuple2<bool, bool>>(
|
||||
selector: (context, s) => Tuple2(s.showOverlayInfo, s.showOverlayShootingDetails),
|
||||
builder: (context, s, child) {
|
||||
final showInfo = s.item1;
|
||||
final current = s.item2;
|
||||
return SwitchListTile(
|
||||
value: current,
|
||||
onChanged: showInfo ? (v) => settings.showOverlayShootingDetails = v : null,
|
||||
title: Text(context.l10n.settingsViewerShowShootingDetails),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(context.l10n.settingsImageBackground),
|
||||
trailing: EntryBackgroundSelector(
|
||||
getter: () => currentImageBackground,
|
||||
setter: (value) => settings.imageBackground = value,
|
||||
Selector<Settings, bool>(
|
||||
selector: (context, s) => s.enableOverlayBlurEffect,
|
||||
builder: (context, current, child) => SwitchListTile(
|
||||
value: current,
|
||||
onChanged: (v) => settings.enableOverlayBlurEffect = v,
|
||||
title: Text(context.l10n.settingsViewerEnableOverlayBlurEffect),
|
||||
),
|
||||
),
|
||||
Selector<Settings, EntryBackground>(
|
||||
selector: (context, s) => s.imageBackground,
|
||||
builder: (context, current, child) => ListTile(
|
||||
title: Text(context.l10n.settingsImageBackground),
|
||||
trailing: EntryBackgroundSelector(
|
||||
getter: () => current,
|
||||
setter: (value) => settings.imageBackground = value,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -153,6 +153,7 @@ class MapOverlayButton extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlurredOval(
|
||||
enabled: settings.enableOverlayBlurEffect,
|
||||
child: Material(
|
||||
type: MaterialType.circle,
|
||||
color: kOverlayBackgroundColor,
|
||||
|
|
|
@ -78,7 +78,7 @@ class _ViewerBottomOverlayState extends State<ViewerBottomOverlay> {
|
|||
Widget build(BuildContext context) {
|
||||
final hasEdgeContent = settings.showOverlayInfo || multiPageController != null;
|
||||
return BlurredRect(
|
||||
enabled: hasEdgeContent,
|
||||
enabled: hasEdgeContent && settings.enableOverlayBlurEffect,
|
||||
child: Selector<MediaQueryData, Tuple3<double, EdgeInsets, EdgeInsets>>(
|
||||
selector: (c, mq) => Tuple3(mq.size.width, mq.viewInsets, mq.viewPadding),
|
||||
builder: (c, mq, child) {
|
||||
|
|
|
@ -117,6 +117,7 @@ class _VideoControlOverlayState extends State<VideoControlOverlay> with SingleTi
|
|||
return SizeTransition(
|
||||
sizeFactor: scale,
|
||||
child: BlurredRRect(
|
||||
enabled: settings.enableOverlayBlurEffect,
|
||||
borderRadius: progressBarBorderRadius,
|
||||
child: GestureDetector(
|
||||
onTapDown: (details) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/widgets/common/fx/blurred.dart';
|
||||
import 'package:aves/widgets/common/fx/borders.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -19,6 +20,7 @@ class OverlayButton extends StatelessWidget {
|
|||
return ScaleTransition(
|
||||
scale: scale,
|
||||
child: BlurredOval(
|
||||
enabled: settings.enableOverlayBlurEffect,
|
||||
child: Material(
|
||||
type: MaterialType.circle,
|
||||
color: kOverlayBackgroundColor,
|
||||
|
@ -58,6 +60,7 @@ class OverlayTextButton extends StatelessWidget {
|
|||
return SizeTransition(
|
||||
sizeFactor: scale,
|
||||
child: BlurredRRect(
|
||||
enabled: settings.enableOverlayBlurEffect,
|
||||
borderRadius: _borderRadius,
|
||||
child: OutlinedButton(
|
||||
onPressed: onPressed,
|
||||
|
|
Loading…
Reference in a new issue