diff options
Diffstat (limited to 'lib/view/src/settings')
| -rw-r--r-- | lib/view/src/settings/enums.dart | 235 | ||||
| -rw-r--r-- | lib/view/src/settings/thumbnail_overlay_location_icon.dart | 22 | ||||
| -rw-r--r-- | lib/view/src/settings/thumbnail_overlay_tag_icon.dart | 23 |
3 files changed, 280 insertions, 0 deletions
diff --git a/lib/view/src/settings/enums.dart b/lib/view/src/settings/enums.dart new file mode 100644 index 0000000..a512c08 --- /dev/null +++ b/lib/view/src/settings/enums.dart @@ -0,0 +1,235 @@ +import 'package:aves/widgets/common/extensions/build_context.dart'; +import 'package:aves_map/aves_map.dart'; +import 'package:aves_model/aves_model.dart'; +import 'package:flutter/widgets.dart'; + +extension ExtraAccessibilityAnimationsView on AccessibilityAnimations { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + AccessibilityAnimations.system => l10n.settingsSystemDefault, + AccessibilityAnimations.disabled => l10n.accessibilityAnimationsRemove, + AccessibilityAnimations.enabled => l10n.accessibilityAnimationsKeep, + }; + } +} + +extension ExtraAccessibilityTimeoutView on AccessibilityTimeout { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + AccessibilityTimeout.system => l10n.settingsSystemDefault, + AccessibilityTimeout.s1 => l10n.timeSeconds(1), + AccessibilityTimeout.s3 => l10n.timeSeconds(3), + AccessibilityTimeout.s5 => l10n.timeSeconds(5), + AccessibilityTimeout.s10 => l10n.timeSeconds(10), + AccessibilityTimeout.s30 => l10n.timeSeconds(30), + }; + } +} + +extension ExtraAvesThemeBrightnessView on AvesThemeBrightness { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + AvesThemeBrightness.system => l10n.settingsSystemDefault, + AvesThemeBrightness.light => l10n.themeBrightnessLight, + AvesThemeBrightness.dark => l10n.themeBrightnessDark, + AvesThemeBrightness.black => l10n.themeBrightnessBlack, + }; + } +} + +extension ExtraCoordinateFormatView on CoordinateFormat { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + CoordinateFormat.dms => l10n.coordinateFormatDms, + CoordinateFormat.ddm => l10n.coordinateFormatDdm, + CoordinateFormat.decimal => l10n.coordinateFormatDecimal, + }; + } +} + +extension ExtraDisplayRefreshRateModeView on DisplayRefreshRateMode { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + DisplayRefreshRateMode.auto => l10n.settingsSystemDefault, + DisplayRefreshRateMode.highest => l10n.displayRefreshRatePreferHighest, + DisplayRefreshRateMode.lowest => l10n.displayRefreshRatePreferLowest, + }; + } +} + +extension ExtraEntryMapStyleView on EntryMapStyle { + String getName(BuildContext context) { + final l10n = context.l10n; + if (this == EntryMapStyles.googleNormal) return l10n.mapStyleGoogleNormal; + if (this == EntryMapStyles.googleHybrid) return l10n.mapStyleGoogleHybrid; + if (this == EntryMapStyles.googleTerrain) return l10n.mapStyleGoogleTerrain; + if (this == EntryMapStyles.osmLiberty) return l10n.mapStyleOsmLiberty; + if (this == EntryMapStyles.openTopoMap) return l10n.mapStyleOpenTopoMap; + if (this == EntryMapStyles.osmHot) return l10n.mapStyleOsmHot; + if (this == EntryMapStyles.stamenWatercolor) return l10n.mapStyleStamenWatercolor; + final _name = name; + if (_name != null) return _name; + throw Exception('Name is undefined for map style=$this'); + } +} + +extension ExtraHomePageSettingView on HomePageSetting { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + HomePageSetting.collection => l10n.drawerCollectionAll, + HomePageSetting.albums => l10n.drawerAlbumPage, + HomePageSetting.tags => l10n.drawerTagPage, + HomePageSetting.explorer => l10n.explorerPageTitle, + }; + } +} + +extension ExtraKeepScreenOnView on KeepScreenOn { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + KeepScreenOn.never => l10n.keepScreenOnNever, + KeepScreenOn.videoPlayback => l10n.keepScreenOnVideoPlayback, + KeepScreenOn.viewerOnly => l10n.keepScreenOnViewerOnly, + KeepScreenOn.always => l10n.keepScreenOnAlways, + }; + } +} + +extension ExtraMaxBrightnessView on MaxBrightness { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + MaxBrightness.never => l10n.maxBrightnessNever, + MaxBrightness.viewerOnly => l10n.keepScreenOnViewerOnly, + MaxBrightness.always => l10n.maxBrightnessAlways, + }; + } +} + +extension ExtraSlideshowVideoPlaybackView on SlideshowVideoPlayback { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + SlideshowVideoPlayback.skip => l10n.videoPlaybackSkip, + SlideshowVideoPlayback.playMuted => l10n.videoPlaybackMuted, + SlideshowVideoPlayback.playWithSound => l10n.videoPlaybackWithSound, + }; + } +} + +extension ExtraOverlayHistogramStyleView on OverlayHistogramStyle { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + OverlayHistogramStyle.none => l10n.overlayHistogramNone, + OverlayHistogramStyle.rgb => l10n.overlayHistogramRGB, + OverlayHistogramStyle.luminance => l10n.overlayHistogramLuminance, + }; + } +} + +extension ExtraSubtitlePositionView on SubtitlePosition { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + SubtitlePosition.top => l10n.subtitlePositionTop, + SubtitlePosition.bottom => l10n.subtitlePositionBottom, + }; + } +} + +extension ExtraUnitSystemView on UnitSystem { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + UnitSystem.metric => l10n.unitSystemMetric, + UnitSystem.imperial => l10n.unitSystemImperial, + }; + } +} + +extension ExtraVideoAutoPlayModeView on VideoAutoPlayMode { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + VideoAutoPlayMode.disabled => l10n.settingsDisabled, + VideoAutoPlayMode.playMuted => l10n.videoPlaybackMuted, + VideoAutoPlayMode.playWithSound => l10n.videoPlaybackWithSound, + }; + } +} + +extension ExtraVideoBackgroundModeView on VideoBackgroundMode { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + VideoBackgroundMode.disabled => l10n.settingsDisabled, + VideoBackgroundMode.pip => l10n.settingsVideoEnablePip, + }; + } +} + +extension ExtraVideoLoopModeView on VideoLoopMode { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + VideoLoopMode.never => l10n.videoLoopModeNever, + VideoLoopMode.shortOnly => l10n.videoLoopModeShortOnly, + VideoLoopMode.always => l10n.videoLoopModeAlways, + }; + } +} + +extension ExtraVideoResumptionModeView on VideoResumptionMode { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + VideoResumptionMode.never => l10n.videoResumptionModeNever, + VideoResumptionMode.ask => l10n.settingsAskEverytime, + VideoResumptionMode.always => l10n.videoResumptionModeAlways, + }; + } +} + +extension ExtraViewerTransitionView on ViewerTransition { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + ViewerTransition.slide => l10n.viewerTransitionSlide, + ViewerTransition.parallax => l10n.viewerTransitionParallax, + ViewerTransition.fade => l10n.viewerTransitionFade, + ViewerTransition.zoomIn => l10n.viewerTransitionZoomIn, + ViewerTransition.none => l10n.viewerTransitionNone, + ViewerTransition.random => l10n.widgetDisplayedItemRandom, + }; + } +} + +extension ExtraWidgetDisplayedItemView on WidgetDisplayedItem { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + WidgetDisplayedItem.random => l10n.widgetDisplayedItemRandom, + WidgetDisplayedItem.mostRecent => l10n.widgetDisplayedItemMostRecent, + }; + } +} + +extension ExtraWidgetOpenPageView on WidgetOpenPage { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + WidgetOpenPage.home => l10n.widgetOpenPageHome, + WidgetOpenPage.collection => l10n.widgetOpenPageCollection, + WidgetOpenPage.viewer => l10n.widgetOpenPageViewer, + WidgetOpenPage.updateWidget => l10n.widgetTapUpdateWidget, + }; + } +} diff --git a/lib/view/src/settings/thumbnail_overlay_location_icon.dart b/lib/view/src/settings/thumbnail_overlay_location_icon.dart new file mode 100644 index 0000000..3ff80ed --- /dev/null +++ b/lib/view/src/settings/thumbnail_overlay_location_icon.dart @@ -0,0 +1,22 @@ +import 'package:aves/theme/icons.dart'; +import 'package:aves/widgets/common/extensions/build_context.dart'; +import 'package:aves_model/aves_model.dart'; +import 'package:flutter/widgets.dart'; + +extension ExtraThumbnailOverlayLocationIconView on ThumbnailOverlayLocationIcon { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + ThumbnailOverlayLocationIcon.located => l10n.filterLocatedLabel, + ThumbnailOverlayLocationIcon.unlocated => l10n.filterNoLocationLabel, + ThumbnailOverlayLocationIcon.none => l10n.settingsDisabled, + }; + } + + IconData getIcon(BuildContext context) { + return switch (this) { + ThumbnailOverlayLocationIcon.unlocated => AIcons.locationUnlocated, + ThumbnailOverlayLocationIcon.located || ThumbnailOverlayLocationIcon.none => AIcons.location, + }; + } +} diff --git a/lib/view/src/settings/thumbnail_overlay_tag_icon.dart b/lib/view/src/settings/thumbnail_overlay_tag_icon.dart new file mode 100644 index 0000000..deae99e --- /dev/null +++ b/lib/view/src/settings/thumbnail_overlay_tag_icon.dart @@ -0,0 +1,23 @@ +import 'package:aves/theme/icons.dart'; +import 'package:aves/widgets/common/extensions/build_context.dart'; +import 'package:aves_model/aves_model.dart'; +import 'package:flutter/widgets.dart'; + +extension ExtraThumbnailOverlayTagIconView on ThumbnailOverlayTagIcon { + String getName(BuildContext context) { + final l10n = context.l10n; + return switch (this) { + ThumbnailOverlayTagIcon.tagged => l10n.filterTaggedLabel, + ThumbnailOverlayTagIcon.untagged => l10n.filterNoTagLabel, + ThumbnailOverlayTagIcon.none => l10n.settingsDisabled, + }; + } + + IconData getIcon(BuildContext context) { + return switch (this) { + ThumbnailOverlayTagIcon.tagged => AIcons.tag, + ThumbnailOverlayTagIcon.untagged => AIcons.tagUntagged, + ThumbnailOverlayTagIcon.none => AIcons.tag, + }; + } +} |
