settings: improved slideshow/screensaver interval selection
This commit is contained in:
parent
71ff42997b
commit
1b1e7fd1e4
27 changed files with 366 additions and 180 deletions
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Auszug aus dem Titel",
|
||||
"editEntryDateDialogShift": "Verschieben",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Änderungsdatum der Datei",
|
||||
"editEntryDateDialogHours": "Stunden",
|
||||
"editEntryDateDialogMinutes": "Minuten",
|
||||
|
||||
"durationDialogHours": "Stunden",
|
||||
"durationDialogMinutes": "Minuten",
|
||||
|
||||
"editEntryLocationDialogTitle": "Standort",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Auf Karte wählen",
|
||||
|
|
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Εξαγωγή από το όνομα του κάθε αρχείου",
|
||||
"editEntryDateDialogShift": "Μετατόπιση",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Ημερομηνία τροποποίησης αρχείου",
|
||||
"editEntryDateDialogHours": "Ώρες",
|
||||
"editEntryDateDialogMinutes": "Λεπτά",
|
||||
|
||||
"durationDialogHours": "Ώρες",
|
||||
"durationDialogMinutes": "Λεπτά",
|
||||
|
||||
"editEntryLocationDialogTitle": "Τοποθεσια",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Επιλογή στο χάρτη",
|
||||
|
|
|
@ -383,8 +383,10 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Extract from title",
|
||||
"editEntryDateDialogShift": "Shift",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "File modified date",
|
||||
"editEntryDateDialogHours": "Hours",
|
||||
"editEntryDateDialogMinutes": "Minutes",
|
||||
|
||||
"durationDialogHours": "Hours",
|
||||
"durationDialogMinutes": "Minutes",
|
||||
"durationDialogSeconds": "Seconds",
|
||||
|
||||
"editEntryLocationDialogTitle": "Location",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Choose on map",
|
||||
|
|
|
@ -242,8 +242,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Extraer del título",
|
||||
"editEntryDateDialogShift": "Cambiar",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Fecha de modificación del archivo",
|
||||
"editEntryDateDialogHours": "Horas",
|
||||
"editEntryDateDialogMinutes": "Minutos",
|
||||
|
||||
"durationDialogHours": "Horas",
|
||||
"durationDialogMinutes": "Minutos",
|
||||
|
||||
"editEntryLocationDialogTitle": "Ubicación",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Elegir en el mapa",
|
||||
|
|
|
@ -253,8 +253,10 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Extraire du titre",
|
||||
"editEntryDateDialogShift": "Décaler",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Date de modification du fichier",
|
||||
"editEntryDateDialogHours": "Heures",
|
||||
"editEntryDateDialogMinutes": "Minutes",
|
||||
|
||||
"durationDialogHours": "Heures",
|
||||
"durationDialogMinutes": "Minutes",
|
||||
"durationDialogSeconds": "Secondes",
|
||||
|
||||
"editEntryLocationDialogTitle": "Lieu",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Sélectionner sur la carte",
|
||||
|
|
|
@ -246,8 +246,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Ekstrak dari judul",
|
||||
"editEntryDateDialogShift": "Geser",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Tanggal modifikasi file",
|
||||
"editEntryDateDialogHours": "Jam",
|
||||
"editEntryDateDialogMinutes": "Menit",
|
||||
|
||||
"durationDialogHours": "Jam",
|
||||
"durationDialogMinutes": "Menit",
|
||||
|
||||
"editEntryLocationDialogTitle": "Lokasi",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Pilih di peta",
|
||||
|
|
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Estrai dal titolo",
|
||||
"editEntryDateDialogShift": "Turno",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Data di modifica del file",
|
||||
"editEntryDateDialogHours": "Ore",
|
||||
"editEntryDateDialogMinutes": "Minuti",
|
||||
|
||||
"durationDialogHours": "Ore",
|
||||
"durationDialogMinutes": "Minuti",
|
||||
|
||||
"editEntryLocationDialogTitle": "Posizione",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Scegli sulla mappa",
|
||||
|
|
|
@ -242,8 +242,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "タイトルから抽出する",
|
||||
"editEntryDateDialogShift": "シフト",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "ファイル更新日",
|
||||
"editEntryDateDialogHours": "時",
|
||||
"editEntryDateDialogMinutes": "分",
|
||||
|
||||
"durationDialogHours": "時",
|
||||
"durationDialogMinutes": "分",
|
||||
|
||||
"editEntryLocationDialogTitle": "位置情報",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "地図上で選択",
|
||||
|
|
|
@ -253,8 +253,10 @@
|
|||
"editEntryDateDialogExtractFromTitle": "제목에서 추출",
|
||||
"editEntryDateDialogShift": "시간 이동",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "파일 수정한 날짜",
|
||||
"editEntryDateDialogHours": "시간",
|
||||
"editEntryDateDialogMinutes": "분",
|
||||
|
||||
"durationDialogHours": "시간",
|
||||
"durationDialogMinutes": "분",
|
||||
"durationDialogSeconds": "초",
|
||||
|
||||
"editEntryLocationDialogTitle": "위치",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "지도에서 선택",
|
||||
|
|
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Uit titel halen",
|
||||
"editEntryDateDialogShift": "Verschuiven",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Wijzigingsdatum bestand",
|
||||
"editEntryDateDialogHours": "Uren",
|
||||
"editEntryDateDialogMinutes": "Minuten",
|
||||
|
||||
"durationDialogHours": "Uren",
|
||||
"durationDialogMinutes": "Minuten",
|
||||
|
||||
"editEntryLocationDialogTitle": "Locatie",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Kies op kaart",
|
||||
|
|
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Extrair do título",
|
||||
"editEntryDateDialogShift": "Mudança",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Data de modificação do arquivo",
|
||||
"editEntryDateDialogHours": "Horas",
|
||||
"editEntryDateDialogMinutes": "Minutos",
|
||||
|
||||
"durationDialogHours": "Horas",
|
||||
"durationDialogMinutes": "Minutos",
|
||||
|
||||
"editEntryLocationDialogTitle": "Localização",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Escolha no mapa",
|
||||
|
|
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Извлечь из названия",
|
||||
"editEntryDateDialogShift": "Сдвиг",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Дата изменения файла",
|
||||
"editEntryDateDialogHours": "Часов",
|
||||
"editEntryDateDialogMinutes": "Минут",
|
||||
|
||||
"durationDialogHours": "Часов",
|
||||
"durationDialogMinutes": "Минут",
|
||||
|
||||
"editEntryLocationDialogTitle": "Местоположение",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Выбрать на карте",
|
||||
|
|
|
@ -230,8 +230,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "Başlıktan ayıkla",
|
||||
"editEntryDateDialogShift": "Değişim",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "Dosya değiştirilme tarihi",
|
||||
"editEntryDateDialogHours": "Saat",
|
||||
"editEntryDateDialogMinutes": "Dakika",
|
||||
|
||||
"durationDialogHours": "Saat",
|
||||
"durationDialogMinutes": "Dakika",
|
||||
|
||||
"editEntryLocationDialogTitle": "Konum",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "Harita üzerinde seç",
|
||||
|
|
|
@ -252,8 +252,9 @@
|
|||
"editEntryDateDialogExtractFromTitle": "从标题提取",
|
||||
"editEntryDateDialogShift": "转移",
|
||||
"editEntryDateDialogSourceFileModifiedDate": "文件修改日期",
|
||||
"editEntryDateDialogHours": "时",
|
||||
"editEntryDateDialogMinutes": "分",
|
||||
|
||||
"durationDialogHours": "时",
|
||||
"durationDialogMinutes": "分",
|
||||
|
||||
"editEntryLocationDialogTitle": "位置",
|
||||
"editEntryLocationDialogChooseOnMapTooltip": "从地图上选择",
|
||||
|
|
|
@ -132,7 +132,7 @@ class SettingsDefaults {
|
|||
static const slideshowAnimatedZoomEffect = true;
|
||||
static const slideshowTransition = ViewerTransition.fade;
|
||||
static const slideshowVideoPlayback = SlideshowVideoPlayback.playMuted;
|
||||
static const slideshowInterval = SlideshowInterval.s5;
|
||||
static const slideshowInterval = 5;
|
||||
|
||||
// widget
|
||||
static const widgetOutline = false;
|
||||
|
|
|
@ -18,8 +18,6 @@ enum HomePageSetting { collection, albums }
|
|||
|
||||
enum KeepScreenOn { never, viewerOnly, always }
|
||||
|
||||
enum SlideshowInterval { s3, s5, s10, s30, s60 }
|
||||
|
||||
enum SlideshowVideoPlayback { skip, playMuted, playWithSound }
|
||||
|
||||
enum UnitSystem { metric, imperial }
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'enums.dart';
|
||||
|
||||
extension ExtraSlideshowInterval on SlideshowInterval {
|
||||
String getName(BuildContext context) {
|
||||
switch (this) {
|
||||
case SlideshowInterval.s3:
|
||||
return context.l10n.timeSeconds(3);
|
||||
case SlideshowInterval.s5:
|
||||
return context.l10n.timeSeconds(5);
|
||||
case SlideshowInterval.s10:
|
||||
return context.l10n.timeSeconds(10);
|
||||
case SlideshowInterval.s30:
|
||||
return context.l10n.timeSeconds(30);
|
||||
case SlideshowInterval.s60:
|
||||
return context.l10n.timeMinutes(1);
|
||||
}
|
||||
}
|
||||
|
||||
Duration getDuration() {
|
||||
switch (this) {
|
||||
case SlideshowInterval.s3:
|
||||
return const Duration(seconds: 3);
|
||||
case SlideshowInterval.s5:
|
||||
return const Duration(seconds: 5);
|
||||
case SlideshowInterval.s10:
|
||||
return const Duration(seconds: 10);
|
||||
case SlideshowInterval.s30:
|
||||
return const Duration(seconds: 30);
|
||||
case SlideshowInterval.s60:
|
||||
return const Duration(minutes: 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -219,19 +219,19 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// app
|
||||
|
||||
bool get hasAcceptedTerms => getBoolOrDefault(hasAcceptedTermsKey, SettingsDefaults.hasAcceptedTerms);
|
||||
bool get hasAcceptedTerms => getBool(hasAcceptedTermsKey) ?? SettingsDefaults.hasAcceptedTerms;
|
||||
|
||||
set hasAcceptedTerms(bool newValue) => setAndNotify(hasAcceptedTermsKey, newValue);
|
||||
|
||||
bool get canUseAnalysisService => getBoolOrDefault(canUseAnalysisServiceKey, SettingsDefaults.canUseAnalysisService);
|
||||
bool get canUseAnalysisService => getBool(canUseAnalysisServiceKey) ?? SettingsDefaults.canUseAnalysisService;
|
||||
|
||||
set canUseAnalysisService(bool newValue) => setAndNotify(canUseAnalysisServiceKey, newValue);
|
||||
|
||||
bool get isInstalledAppAccessAllowed => getBoolOrDefault(isInstalledAppAccessAllowedKey, SettingsDefaults.isInstalledAppAccessAllowed);
|
||||
bool get isInstalledAppAccessAllowed => getBool(isInstalledAppAccessAllowedKey) ?? SettingsDefaults.isInstalledAppAccessAllowed;
|
||||
|
||||
set isInstalledAppAccessAllowed(bool newValue) => setAndNotify(isInstalledAppAccessAllowedKey, newValue);
|
||||
|
||||
bool get isErrorReportingAllowed => getBoolOrDefault(isErrorReportingAllowedKey, SettingsDefaults.isErrorReportingAllowed);
|
||||
bool get isErrorReportingAllowed => getBool(isErrorReportingAllowedKey) ?? SettingsDefaults.isErrorReportingAllowed;
|
||||
|
||||
set isErrorReportingAllowed(bool newValue) => setAndNotify(isErrorReportingAllowedKey, newValue);
|
||||
|
||||
|
@ -322,17 +322,17 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set themeColorMode(AvesThemeColorMode newValue) => setAndNotify(themeColorModeKey, newValue.toString());
|
||||
|
||||
bool get enableDynamicColor => getBoolOrDefault(enableDynamicColorKey, SettingsDefaults.enableDynamicColor);
|
||||
bool get enableDynamicColor => getBool(enableDynamicColorKey) ?? SettingsDefaults.enableDynamicColor;
|
||||
|
||||
set enableDynamicColor(bool newValue) => setAndNotify(enableDynamicColorKey, newValue);
|
||||
|
||||
bool get enableBlurEffect => getBoolOrDefault(enableBlurEffectKey, SettingsDefaults.enableBlurEffect);
|
||||
bool get enableBlurEffect => getBool(enableBlurEffectKey) ?? SettingsDefaults.enableBlurEffect;
|
||||
|
||||
set enableBlurEffect(bool newValue) => setAndNotify(enableBlurEffectKey, newValue);
|
||||
|
||||
// navigation
|
||||
|
||||
bool get mustBackTwiceToExit => getBoolOrDefault(mustBackTwiceToExitKey, SettingsDefaults.mustBackTwiceToExit);
|
||||
bool get mustBackTwiceToExit => getBool(mustBackTwiceToExitKey) ?? SettingsDefaults.mustBackTwiceToExit;
|
||||
|
||||
set mustBackTwiceToExit(bool newValue) => setAndNotify(mustBackTwiceToExitKey, newValue);
|
||||
|
||||
|
@ -344,27 +344,27 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set homePage(HomePageSetting newValue) => setAndNotify(homePageKey, newValue.toString());
|
||||
|
||||
bool get enableBottomNavigationBar => getBoolOrDefault(enableBottomNavigationBarKey, SettingsDefaults.enableBottomNavigationBar);
|
||||
bool get enableBottomNavigationBar => getBool(enableBottomNavigationBarKey) ?? SettingsDefaults.enableBottomNavigationBar;
|
||||
|
||||
set enableBottomNavigationBar(bool newValue) => setAndNotify(enableBottomNavigationBarKey, newValue);
|
||||
|
||||
bool get confirmDeleteForever => getBoolOrDefault(confirmDeleteForeverKey, SettingsDefaults.confirmDeleteForever);
|
||||
bool get confirmDeleteForever => getBool(confirmDeleteForeverKey) ?? SettingsDefaults.confirmDeleteForever;
|
||||
|
||||
set confirmDeleteForever(bool newValue) => setAndNotify(confirmDeleteForeverKey, newValue);
|
||||
|
||||
bool get confirmMoveToBin => getBoolOrDefault(confirmMoveToBinKey, SettingsDefaults.confirmMoveToBin);
|
||||
bool get confirmMoveToBin => getBool(confirmMoveToBinKey) ?? SettingsDefaults.confirmMoveToBin;
|
||||
|
||||
set confirmMoveToBin(bool newValue) => setAndNotify(confirmMoveToBinKey, newValue);
|
||||
|
||||
bool get confirmMoveUndatedItems => getBoolOrDefault(confirmMoveUndatedItemsKey, SettingsDefaults.confirmMoveUndatedItems);
|
||||
bool get confirmMoveUndatedItems => getBool(confirmMoveUndatedItemsKey) ?? SettingsDefaults.confirmMoveUndatedItems;
|
||||
|
||||
set confirmMoveUndatedItems(bool newValue) => setAndNotify(confirmMoveUndatedItemsKey, newValue);
|
||||
|
||||
bool get confirmAfterMoveToBin => getBoolOrDefault(confirmAfterMoveToBinKey, SettingsDefaults.confirmAfterMoveToBin);
|
||||
bool get confirmAfterMoveToBin => getBool(confirmAfterMoveToBinKey) ?? SettingsDefaults.confirmAfterMoveToBin;
|
||||
|
||||
set confirmAfterMoveToBin(bool newValue) => setAndNotify(confirmAfterMoveToBinKey, newValue);
|
||||
|
||||
bool get setMetadataDateBeforeFileOp => getBoolOrDefault(setMetadataDateBeforeFileOpKey, SettingsDefaults.setMetadataDateBeforeFileOp);
|
||||
bool get setMetadataDateBeforeFileOp => getBool(setMetadataDateBeforeFileOpKey) ?? SettingsDefaults.setMetadataDateBeforeFileOp;
|
||||
|
||||
set setMetadataDateBeforeFileOp(bool newValue) => setAndNotify(setMetadataDateBeforeFileOpKey, newValue);
|
||||
|
||||
|
@ -395,7 +395,7 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set collectionSortFactor(EntrySortFactor newValue) => setAndNotify(collectionSortFactorKey, newValue.toString());
|
||||
|
||||
bool get collectionSortReverse => getBoolOrDefault(collectionSortReverseKey, false);
|
||||
bool get collectionSortReverse => getBool(collectionSortReverseKey) ?? false;
|
||||
|
||||
set collectionSortReverse(bool newValue) => setAndNotify(collectionSortReverseKey, newValue);
|
||||
|
||||
|
@ -407,31 +407,31 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set collectionSelectionQuickActions(List<EntrySetAction> newValue) => setAndNotify(collectionSelectionQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
bool get showThumbnailFavourite => getBoolOrDefault(showThumbnailFavouriteKey, SettingsDefaults.showThumbnailFavourite);
|
||||
bool get showThumbnailFavourite => getBool(showThumbnailFavouriteKey) ?? SettingsDefaults.showThumbnailFavourite;
|
||||
|
||||
set showThumbnailFavourite(bool newValue) => setAndNotify(showThumbnailFavouriteKey, newValue);
|
||||
|
||||
bool get showThumbnailTag => getBoolOrDefault(showThumbnailTagKey, SettingsDefaults.showThumbnailTag);
|
||||
bool get showThumbnailTag => getBool(showThumbnailTagKey) ?? SettingsDefaults.showThumbnailTag;
|
||||
|
||||
set showThumbnailTag(bool newValue) => setAndNotify(showThumbnailTagKey, newValue);
|
||||
|
||||
bool get showThumbnailLocation => getBoolOrDefault(showThumbnailLocationKey, SettingsDefaults.showThumbnailLocation);
|
||||
bool get showThumbnailLocation => getBool(showThumbnailLocationKey) ?? SettingsDefaults.showThumbnailLocation;
|
||||
|
||||
set showThumbnailLocation(bool newValue) => setAndNotify(showThumbnailLocationKey, newValue);
|
||||
|
||||
bool get showThumbnailMotionPhoto => getBoolOrDefault(showThumbnailMotionPhotoKey, SettingsDefaults.showThumbnailMotionPhoto);
|
||||
bool get showThumbnailMotionPhoto => getBool(showThumbnailMotionPhotoKey) ?? SettingsDefaults.showThumbnailMotionPhoto;
|
||||
|
||||
set showThumbnailMotionPhoto(bool newValue) => setAndNotify(showThumbnailMotionPhotoKey, newValue);
|
||||
|
||||
bool get showThumbnailRating => getBoolOrDefault(showThumbnailRatingKey, SettingsDefaults.showThumbnailRating);
|
||||
bool get showThumbnailRating => getBool(showThumbnailRatingKey) ?? SettingsDefaults.showThumbnailRating;
|
||||
|
||||
set showThumbnailRating(bool newValue) => setAndNotify(showThumbnailRatingKey, newValue);
|
||||
|
||||
bool get showThumbnailRaw => getBoolOrDefault(showThumbnailRawKey, SettingsDefaults.showThumbnailRaw);
|
||||
bool get showThumbnailRaw => getBool(showThumbnailRawKey) ?? SettingsDefaults.showThumbnailRaw;
|
||||
|
||||
set showThumbnailRaw(bool newValue) => setAndNotify(showThumbnailRawKey, newValue);
|
||||
|
||||
bool get showThumbnailVideoDuration => getBoolOrDefault(showThumbnailVideoDurationKey, SettingsDefaults.showThumbnailVideoDuration);
|
||||
bool get showThumbnailVideoDuration => getBool(showThumbnailVideoDurationKey) ?? SettingsDefaults.showThumbnailVideoDuration;
|
||||
|
||||
set showThumbnailVideoDuration(bool newValue) => setAndNotify(showThumbnailVideoDurationKey, newValue);
|
||||
|
||||
|
@ -453,15 +453,15 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set tagSortFactor(ChipSortFactor newValue) => setAndNotify(tagSortFactorKey, newValue.toString());
|
||||
|
||||
bool get albumSortReverse => getBoolOrDefault(albumSortReverseKey, false);
|
||||
bool get albumSortReverse => getBool(albumSortReverseKey) ?? false;
|
||||
|
||||
set albumSortReverse(bool newValue) => setAndNotify(albumSortReverseKey, newValue);
|
||||
|
||||
bool get countrySortReverse => getBoolOrDefault(countrySortReverseKey, false);
|
||||
bool get countrySortReverse => getBool(countrySortReverseKey) ?? false;
|
||||
|
||||
set countrySortReverse(bool newValue) => setAndNotify(countrySortReverseKey, newValue);
|
||||
|
||||
bool get tagSortReverse => getBoolOrDefault(tagSortReverseKey, false);
|
||||
bool get tagSortReverse => getBool(tagSortReverseKey) ?? false;
|
||||
|
||||
set tagSortReverse(bool newValue) => setAndNotify(tagSortReverseKey, newValue);
|
||||
|
||||
|
@ -490,39 +490,39 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set viewerQuickActions(List<EntryAction> newValue) => setAndNotify(viewerQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
bool get showOverlayOnOpening => getBoolOrDefault(showOverlayOnOpeningKey, SettingsDefaults.showOverlayOnOpening);
|
||||
bool get showOverlayOnOpening => getBool(showOverlayOnOpeningKey) ?? SettingsDefaults.showOverlayOnOpening;
|
||||
|
||||
set showOverlayOnOpening(bool newValue) => setAndNotify(showOverlayOnOpeningKey, newValue);
|
||||
|
||||
bool get showOverlayMinimap => getBoolOrDefault(showOverlayMinimapKey, SettingsDefaults.showOverlayMinimap);
|
||||
bool get showOverlayMinimap => getBool(showOverlayMinimapKey) ?? SettingsDefaults.showOverlayMinimap;
|
||||
|
||||
set showOverlayMinimap(bool newValue) => setAndNotify(showOverlayMinimapKey, newValue);
|
||||
|
||||
bool get showOverlayInfo => getBoolOrDefault(showOverlayInfoKey, SettingsDefaults.showOverlayInfo);
|
||||
bool get showOverlayInfo => getBool(showOverlayInfoKey) ?? SettingsDefaults.showOverlayInfo;
|
||||
|
||||
set showOverlayInfo(bool newValue) => setAndNotify(showOverlayInfoKey, newValue);
|
||||
|
||||
bool get showOverlayShootingDetails => getBoolOrDefault(showOverlayShootingDetailsKey, SettingsDefaults.showOverlayShootingDetails);
|
||||
bool get showOverlayShootingDetails => getBool(showOverlayShootingDetailsKey) ?? SettingsDefaults.showOverlayShootingDetails;
|
||||
|
||||
set showOverlayShootingDetails(bool newValue) => setAndNotify(showOverlayShootingDetailsKey, newValue);
|
||||
|
||||
bool get showOverlayThumbnailPreview => getBoolOrDefault(showOverlayThumbnailPreviewKey, SettingsDefaults.showOverlayThumbnailPreview);
|
||||
bool get showOverlayThumbnailPreview => getBool(showOverlayThumbnailPreviewKey) ?? SettingsDefaults.showOverlayThumbnailPreview;
|
||||
|
||||
set showOverlayThumbnailPreview(bool newValue) => setAndNotify(showOverlayThumbnailPreviewKey, newValue);
|
||||
|
||||
bool get viewerGestureSideTapNext => getBoolOrDefault(viewerGestureSideTapNextKey, SettingsDefaults.viewerGestureSideTapNext);
|
||||
bool get viewerGestureSideTapNext => getBool(viewerGestureSideTapNextKey) ?? SettingsDefaults.viewerGestureSideTapNext;
|
||||
|
||||
set viewerGestureSideTapNext(bool newValue) => setAndNotify(viewerGestureSideTapNextKey, newValue);
|
||||
|
||||
bool get viewerUseCutout => getBoolOrDefault(viewerUseCutoutKey, SettingsDefaults.viewerUseCutout);
|
||||
bool get viewerUseCutout => getBool(viewerUseCutoutKey) ?? SettingsDefaults.viewerUseCutout;
|
||||
|
||||
set viewerUseCutout(bool newValue) => setAndNotify(viewerUseCutoutKey, newValue);
|
||||
|
||||
bool get viewerMaxBrightness => getBoolOrDefault(viewerMaxBrightnessKey, SettingsDefaults.viewerMaxBrightness);
|
||||
bool get viewerMaxBrightness => getBool(viewerMaxBrightnessKey) ?? SettingsDefaults.viewerMaxBrightness;
|
||||
|
||||
set viewerMaxBrightness(bool newValue) => setAndNotify(viewerMaxBrightnessKey, newValue);
|
||||
|
||||
bool get enableMotionPhotoAutoPlay => getBoolOrDefault(enableMotionPhotoAutoPlayKey, SettingsDefaults.enableMotionPhotoAutoPlay);
|
||||
bool get enableMotionPhotoAutoPlay => getBool(enableMotionPhotoAutoPlayKey) ?? SettingsDefaults.enableMotionPhotoAutoPlay;
|
||||
|
||||
set enableMotionPhotoAutoPlay(bool newValue) => setAndNotify(enableMotionPhotoAutoPlayKey, newValue);
|
||||
|
||||
|
@ -532,7 +532,7 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// video
|
||||
|
||||
bool get enableVideoHardwareAcceleration => getBoolOrDefault(enableVideoHardwareAccelerationKey, SettingsDefaults.enableVideoHardwareAcceleration);
|
||||
bool get enableVideoHardwareAcceleration => getBool(enableVideoHardwareAccelerationKey) ?? SettingsDefaults.enableVideoHardwareAcceleration;
|
||||
|
||||
set enableVideoHardwareAcceleration(bool newValue) => setAndNotify(enableVideoHardwareAccelerationKey, newValue);
|
||||
|
||||
|
@ -544,7 +544,7 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set videoLoopMode(VideoLoopMode newValue) => setAndNotify(videoLoopModeKey, newValue.toString());
|
||||
|
||||
bool get videoShowRawTimedText => getBoolOrDefault(videoShowRawTimedTextKey, SettingsDefaults.videoShowRawTimedText);
|
||||
bool get videoShowRawTimedText => getBool(videoShowRawTimedTextKey) ?? SettingsDefaults.videoShowRawTimedText;
|
||||
|
||||
set videoShowRawTimedText(bool newValue) => setAndNotify(videoShowRawTimedTextKey, newValue);
|
||||
|
||||
|
@ -552,11 +552,11 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set videoControls(VideoControls newValue) => setAndNotify(videoControlsKey, newValue.toString());
|
||||
|
||||
bool get videoGestureDoubleTapTogglePlay => getBoolOrDefault(videoGestureDoubleTapTogglePlayKey, SettingsDefaults.videoGestureDoubleTapTogglePlay);
|
||||
bool get videoGestureDoubleTapTogglePlay => getBool(videoGestureDoubleTapTogglePlayKey) ?? SettingsDefaults.videoGestureDoubleTapTogglePlay;
|
||||
|
||||
set videoGestureDoubleTapTogglePlay(bool newValue) => setAndNotify(videoGestureDoubleTapTogglePlayKey, newValue);
|
||||
|
||||
bool get videoGestureSideDoubleTapSeek => getBoolOrDefault(videoGestureSideDoubleTapSeekKey, SettingsDefaults.videoGestureSideDoubleTapSeek);
|
||||
bool get videoGestureSideDoubleTapSeek => getBool(videoGestureSideDoubleTapSeekKey) ?? SettingsDefaults.videoGestureSideDoubleTapSeek;
|
||||
|
||||
set videoGestureSideDoubleTapSeek(bool newValue) => setAndNotify(videoGestureSideDoubleTapSeekKey, newValue);
|
||||
|
||||
|
@ -570,7 +570,7 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set subtitleTextAlignment(TextAlign newValue) => setAndNotify(subtitleTextAlignmentKey, newValue.toString());
|
||||
|
||||
bool get subtitleShowOutline => getBoolOrDefault(subtitleShowOutlineKey, SettingsDefaults.subtitleShowOutline);
|
||||
bool get subtitleShowOutline => getBool(subtitleShowOutlineKey) ?? SettingsDefaults.subtitleShowOutline;
|
||||
|
||||
set subtitleShowOutline(bool newValue) => setAndNotify(subtitleShowOutlineKey, newValue);
|
||||
|
||||
|
@ -615,7 +615,7 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// search
|
||||
|
||||
bool get saveSearchHistory => getBoolOrDefault(saveSearchHistoryKey, SettingsDefaults.saveSearchHistory);
|
||||
bool get saveSearchHistory => getBool(saveSearchHistoryKey) ?? SettingsDefaults.saveSearchHistory;
|
||||
|
||||
set saveSearchHistory(bool newValue) => setAndNotify(saveSearchHistoryKey, newValue);
|
||||
|
||||
|
@ -625,7 +625,7 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// bin
|
||||
|
||||
bool get enableBin => getBoolOrDefault(enableBinKey, SettingsDefaults.enableBin);
|
||||
bool get enableBin => getBool(enableBinKey) ?? SettingsDefaults.enableBin;
|
||||
|
||||
set enableBin(bool newValue) => setAndNotify(enableBinKey, newValue);
|
||||
|
||||
|
@ -641,17 +641,17 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// file picker
|
||||
|
||||
bool get filePickerShowHiddenFiles => getBoolOrDefault(filePickerShowHiddenFilesKey, SettingsDefaults.filePickerShowHiddenFiles);
|
||||
bool get filePickerShowHiddenFiles => getBool(filePickerShowHiddenFilesKey) ?? SettingsDefaults.filePickerShowHiddenFiles;
|
||||
|
||||
set filePickerShowHiddenFiles(bool newValue) => setAndNotify(filePickerShowHiddenFilesKey, newValue);
|
||||
|
||||
// screen saver
|
||||
|
||||
bool get screenSaverFillScreen => getBoolOrDefault(screenSaverFillScreenKey, SettingsDefaults.slideshowFillScreen);
|
||||
bool get screenSaverFillScreen => getBool(screenSaverFillScreenKey) ?? SettingsDefaults.slideshowFillScreen;
|
||||
|
||||
set screenSaverFillScreen(bool newValue) => setAndNotify(screenSaverFillScreenKey, newValue);
|
||||
|
||||
bool get screenSaverAnimatedZoomEffect => getBoolOrDefault(screenSaverAnimatedZoomEffectKey, SettingsDefaults.slideshowAnimatedZoomEffect);
|
||||
bool get screenSaverAnimatedZoomEffect => getBool(screenSaverAnimatedZoomEffectKey) ?? SettingsDefaults.slideshowAnimatedZoomEffect;
|
||||
|
||||
set screenSaverAnimatedZoomEffect(bool newValue) => setAndNotify(screenSaverAnimatedZoomEffectKey, newValue);
|
||||
|
||||
|
@ -663,9 +663,9 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set screenSaverVideoPlayback(SlideshowVideoPlayback newValue) => setAndNotify(screenSaverVideoPlaybackKey, newValue.toString());
|
||||
|
||||
SlideshowInterval get screenSaverInterval => getEnumOrDefault(screenSaverIntervalKey, SettingsDefaults.slideshowInterval, SlideshowInterval.values);
|
||||
int get screenSaverInterval => getInt(screenSaverIntervalKey) ?? SettingsDefaults.slideshowInterval;
|
||||
|
||||
set screenSaverInterval(SlideshowInterval newValue) => setAndNotify(screenSaverIntervalKey, newValue.toString());
|
||||
set screenSaverInterval(int newValue) => setAndNotify(screenSaverIntervalKey, newValue);
|
||||
|
||||
Set<CollectionFilter> get screenSaverCollectionFilters => (getStringList(screenSaverCollectionFiltersKey) ?? []).map(CollectionFilter.fromJson).whereNotNull().toSet();
|
||||
|
||||
|
@ -673,19 +673,19 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// slideshow
|
||||
|
||||
bool get slideshowRepeat => getBoolOrDefault(slideshowRepeatKey, SettingsDefaults.slideshowRepeat);
|
||||
bool get slideshowRepeat => getBool(slideshowRepeatKey) ?? SettingsDefaults.slideshowRepeat;
|
||||
|
||||
set slideshowRepeat(bool newValue) => setAndNotify(slideshowRepeatKey, newValue);
|
||||
|
||||
bool get slideshowShuffle => getBoolOrDefault(slideshowShuffleKey, SettingsDefaults.slideshowShuffle);
|
||||
bool get slideshowShuffle => getBool(slideshowShuffleKey) ?? SettingsDefaults.slideshowShuffle;
|
||||
|
||||
set slideshowShuffle(bool newValue) => setAndNotify(slideshowShuffleKey, newValue);
|
||||
|
||||
bool get slideshowFillScreen => getBoolOrDefault(slideshowFillScreenKey, SettingsDefaults.slideshowFillScreen);
|
||||
bool get slideshowFillScreen => getBool(slideshowFillScreenKey) ?? SettingsDefaults.slideshowFillScreen;
|
||||
|
||||
set slideshowFillScreen(bool newValue) => setAndNotify(slideshowFillScreenKey, newValue);
|
||||
|
||||
bool get slideshowAnimatedZoomEffect => getBoolOrDefault(slideshowAnimatedZoomEffectKey, SettingsDefaults.slideshowAnimatedZoomEffect);
|
||||
bool get slideshowAnimatedZoomEffect => getBool(slideshowAnimatedZoomEffectKey) ?? SettingsDefaults.slideshowAnimatedZoomEffect;
|
||||
|
||||
set slideshowAnimatedZoomEffect(bool newValue) => setAndNotify(slideshowAnimatedZoomEffectKey, newValue);
|
||||
|
||||
|
@ -697,9 +697,9 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
set slideshowVideoPlayback(SlideshowVideoPlayback newValue) => setAndNotify(slideshowVideoPlaybackKey, newValue.toString());
|
||||
|
||||
SlideshowInterval get slideshowInterval => getEnumOrDefault(slideshowIntervalKey, SettingsDefaults.slideshowInterval, SlideshowInterval.values);
|
||||
int get slideshowInterval => getInt(slideshowIntervalKey) ?? SettingsDefaults.slideshowInterval;
|
||||
|
||||
set slideshowInterval(SlideshowInterval newValue) => setAndNotify(slideshowIntervalKey, newValue.toString());
|
||||
set slideshowInterval(int newValue) => setAndNotify(slideshowIntervalKey, newValue);
|
||||
|
||||
// widget
|
||||
|
||||
|
@ -728,23 +728,61 @@ class Settings extends ChangeNotifier {
|
|||
|
||||
// convenience methods
|
||||
|
||||
int? getInt(String key) => settingsStore.getInt(key);
|
||||
bool? getBool(String key) {
|
||||
try {
|
||||
return settingsStore.getBool(key);
|
||||
} catch (e) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
double? getDouble(String key) => settingsStore.getDouble(key);
|
||||
int? getInt(String key) {
|
||||
try {
|
||||
return settingsStore.getInt(key);
|
||||
} catch (e) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String? getString(String key) => settingsStore.getString(key);
|
||||
double? getDouble(String key) {
|
||||
try {
|
||||
return settingsStore.getDouble(key);
|
||||
} catch (e) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<String>? getStringList(String key) => settingsStore.getStringList(key);
|
||||
String? getString(String key) {
|
||||
try {
|
||||
return settingsStore.getString(key);
|
||||
} catch (e) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: avoid_positional_boolean_parameters
|
||||
bool getBoolOrDefault(String key, bool defaultValue) => settingsStore.getBool(key) ?? defaultValue;
|
||||
List<String>? getStringList(String key) {
|
||||
try {
|
||||
return settingsStore.getStringList(key);
|
||||
} catch (e) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
T getEnumOrDefault<T>(String key, T defaultValue, Iterable<T> values) {
|
||||
final valueString = settingsStore.getString(key);
|
||||
for (final v in values) {
|
||||
if (v.toString() == valueString) {
|
||||
return v;
|
||||
try {
|
||||
final valueString = settingsStore.getString(key);
|
||||
for (final v in values) {
|
||||
if (v.toString() == valueString) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore, could be obsolete value of different type
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -758,19 +796,19 @@ class Settings extends ChangeNotifier {
|
|||
if (newValue == null) {
|
||||
settingsStore.remove(key);
|
||||
} else if (newValue is String) {
|
||||
oldValue = settingsStore.getString(key);
|
||||
oldValue = getString(key);
|
||||
settingsStore.setString(key, newValue);
|
||||
} else if (newValue is List<String>) {
|
||||
oldValue = settingsStore.getStringList(key);
|
||||
oldValue = getStringList(key);
|
||||
settingsStore.setStringList(key, newValue);
|
||||
} else if (newValue is int) {
|
||||
oldValue = settingsStore.getInt(key);
|
||||
oldValue = getInt(key);
|
||||
settingsStore.setInt(key, newValue);
|
||||
} else if (newValue is double) {
|
||||
oldValue = settingsStore.getDouble(key);
|
||||
oldValue = getDouble(key);
|
||||
settingsStore.setDouble(key, newValue);
|
||||
} else if (newValue is bool) {
|
||||
oldValue = settingsStore.getBool(key);
|
||||
oldValue = getBool(key);
|
||||
settingsStore.setBool(key, newValue);
|
||||
}
|
||||
if (oldValue != newValue) {
|
||||
|
@ -797,11 +835,11 @@ class Settings extends ChangeNotifier {
|
|||
});
|
||||
}
|
||||
|
||||
bool get isRotationLocked => getBoolOrDefault(platformAccelerometerRotationKey, SettingsDefaults.isRotationLocked);
|
||||
bool get isRotationLocked => getBool(platformAccelerometerRotationKey) ?? SettingsDefaults.isRotationLocked;
|
||||
|
||||
set isRotationLocked(bool newValue) => setAndNotify(platformAccelerometerRotationKey, newValue);
|
||||
|
||||
bool get areAnimationsRemoved => getBoolOrDefault(platformTransitionAnimationScaleKey, SettingsDefaults.areAnimationsRemoved);
|
||||
bool get areAnimationsRemoved => getBool(platformTransitionAnimationScaleKey) ?? SettingsDefaults.areAnimationsRemoved;
|
||||
|
||||
set areAnimationsRemoved(bool newValue) => setAndNotify(platformTransitionAnimationScaleKey, newValue);
|
||||
|
||||
|
@ -838,6 +876,8 @@ class Settings extends ChangeNotifier {
|
|||
switch (key) {
|
||||
case subtitleTextColorKey:
|
||||
case subtitleBackgroundColorKey:
|
||||
case screenSaverIntervalKey:
|
||||
case slideshowIntervalKey:
|
||||
if (newValue is int) {
|
||||
settingsStore.setInt(key, newValue);
|
||||
} else {
|
||||
|
@ -926,10 +966,8 @@ class Settings extends ChangeNotifier {
|
|||
case timeToTakeActionKey:
|
||||
case screenSaverTransitionKey:
|
||||
case screenSaverVideoPlaybackKey:
|
||||
case screenSaverIntervalKey:
|
||||
case slideshowTransitionKey:
|
||||
case slideshowVideoPlaybackKey:
|
||||
case slideshowIntervalKey:
|
||||
if (newValue is String) {
|
||||
settingsStore.setString(key, newValue);
|
||||
} else {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
|
||||
const hoursInDay = 24;
|
||||
const minutesInHour = 60;
|
||||
const secondsInMinute = 60;
|
||||
|
||||
extension ExtraDateTime on DateTime {
|
||||
bool isAtSameYearAs(DateTime? other) => year == other?.year;
|
||||
|
||||
|
@ -47,7 +51,7 @@ DateTime? dateTimeFromMillis(int? millis, {bool isUtc = false}) {
|
|||
|
||||
final _unixStampMillisPattern = RegExp(r'\d{13}');
|
||||
final _unixStampSecPattern = RegExp(r'\d{10}');
|
||||
final _dateYMD8Hms6Sub3Pattern = RegExp(r'(\d{8})([_-\s](\d{6})([_-\s](\d{3}))?)?');
|
||||
final _dateYMD8Hms6Sub3Pattern = RegExp(r'(\d{8})([_\s-](\d{6})([_\s-](\d{3}))?)?');
|
||||
final _dateY4M2D2H2m2s2Sub3Pattern = RegExp(r'(\d{4})-(\d{1,2})-(\d{1,2})[ -](\d{1,2})[.-](\d{1,2})[.-](\d{1,2})([.-](\d{1,3})?)?');
|
||||
final _dateY4M2D2Hms6Pattern = RegExp(r'(\d{4})-(\d{1,2})-(\d{1,2}) (\d{6})');
|
||||
|
||||
|
|
113
lib/widgets/dialogs/duration_dialog.dart
Normal file
113
lib/widgets/dialogs/duration_dialog.dart
Normal file
|
@ -0,0 +1,113 @@
|
|||
import 'package:aves/utils/time_utils.dart';
|
||||
import 'package:aves/widgets/common/basic/wheel.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||
import 'package:aves/widgets/dialogs/aves_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DurationDialog extends StatefulWidget {
|
||||
final int initialSeconds;
|
||||
|
||||
const DurationDialog({
|
||||
super.key,
|
||||
required this.initialSeconds,
|
||||
});
|
||||
|
||||
@override
|
||||
State<DurationDialog> createState() => _DurationDialogState();
|
||||
}
|
||||
|
||||
class _DurationDialogState extends State<DurationDialog> {
|
||||
late ValueNotifier<int> _minutes, _seconds;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final seconds = widget.initialSeconds;
|
||||
_minutes = ValueNotifier(seconds ~/ secondsInMinute);
|
||||
_seconds = ValueNotifier(seconds % secondsInMinute);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MediaQueryDataProvider(
|
||||
child: Builder(builder: (context) {
|
||||
final l10n = context.l10n;
|
||||
const textStyle = TextStyle(fontSize: 34);
|
||||
|
||||
return AvesDialog(
|
||||
scrollableContent: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Center(
|
||||
child: Table(
|
||||
// even when ambient direction is RTL, time is displayed in LTR
|
||||
textDirection: TextDirection.ltr,
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
Center(child: Text(context.l10n.durationDialogMinutes)),
|
||||
const SizedBox(width: 16),
|
||||
Center(child: Text(context.l10n.durationDialogSeconds)),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: WheelSelector(
|
||||
valueNotifier: _minutes,
|
||||
values: List.generate(minutesInHour, (i) => i),
|
||||
textStyle: textStyle,
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 2),
|
||||
child: Text(
|
||||
':',
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: WheelSelector(
|
||||
valueNotifier: _seconds,
|
||||
values: List.generate(secondsInMinute, (i) => i),
|
||||
textStyle: textStyle,
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
defaultColumnWidth: const IntrinsicColumnWidth(),
|
||||
defaultVerticalAlignment: TableCellVerticalAlignment.middle,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(MaterialLocalizations.of(context).cancelButtonLabel),
|
||||
),
|
||||
AnimatedBuilder(
|
||||
animation: Listenable.merge([_minutes, _seconds]),
|
||||
builder: (context, child) {
|
||||
final isValid = _minutes.value > 0 || _seconds.value > 0;
|
||||
return TextButton(
|
||||
onPressed: isValid ? () => _submit(context) : null,
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
child: Text(l10n.applyButtonLabel),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
void _submit(BuildContext context) => Navigator.pop(context, _minutes.value * secondsInMinute + _seconds.value);
|
||||
}
|
|
@ -7,6 +7,7 @@ import 'package:aves/theme/durations.dart';
|
|||
import 'package:aves/theme/format.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
import 'package:aves/theme/themes.dart';
|
||||
import 'package:aves/utils/time_utils.dart';
|
||||
import 'package:aves/widgets/common/basic/text_dropdown_button.dart';
|
||||
import 'package:aves/widgets/common/basic/wheel.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
|
@ -48,7 +49,7 @@ class _EditEntryDateDialogState extends State<EditEntryDateDialog> {
|
|||
super.initState();
|
||||
_initSet();
|
||||
_initCopyItem();
|
||||
_initShift(60);
|
||||
_initShift(minutesInHour);
|
||||
}
|
||||
|
||||
void _initSet() {
|
||||
|
@ -61,8 +62,8 @@ class _EditEntryDateDialogState extends State<EditEntryDateDialog> {
|
|||
|
||||
void _initShift(int initialMinutes) {
|
||||
final abs = initialMinutes.abs();
|
||||
_shiftHour = ValueNotifier(abs ~/ 60);
|
||||
_shiftMinute = ValueNotifier(abs % 60);
|
||||
_shiftHour = ValueNotifier(abs ~/ minutesInHour);
|
||||
_shiftMinute = ValueNotifier(abs % minutesInHour);
|
||||
_shiftSign = ValueNotifier(initialMinutes.isNegative ? '-' : '+');
|
||||
}
|
||||
|
||||
|
@ -198,9 +199,9 @@ class _EditEntryDateDialogState extends State<EditEntryDateDialog> {
|
|||
TableRow(
|
||||
children: [
|
||||
const SizedBox(),
|
||||
Center(child: Text(context.l10n.editEntryDateDialogHours)),
|
||||
const SizedBox(),
|
||||
Center(child: Text(context.l10n.editEntryDateDialogMinutes)),
|
||||
Center(child: Text(context.l10n.durationDialogHours)),
|
||||
const SizedBox(width: 16),
|
||||
Center(child: Text(context.l10n.durationDialogMinutes)),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
|
@ -215,7 +216,7 @@ class _EditEntryDateDialogState extends State<EditEntryDateDialog> {
|
|||
alignment: Alignment.centerRight,
|
||||
child: WheelSelector(
|
||||
valueNotifier: _shiftHour,
|
||||
values: List.generate(24, (i) => i),
|
||||
values: List.generate(hoursInDay, (i) => i),
|
||||
textStyle: textStyle,
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
|
@ -231,7 +232,7 @@ class _EditEntryDateDialogState extends State<EditEntryDateDialog> {
|
|||
alignment: Alignment.centerLeft,
|
||||
child: WheelSelector(
|
||||
valueNotifier: _shiftMinute,
|
||||
values: List.generate(60, (i) => i),
|
||||
values: List.generate(minutesInHour, (i) => i),
|
||||
textStyle: textStyle,
|
||||
textAlign: TextAlign.end,
|
||||
),
|
||||
|
@ -373,7 +374,7 @@ class _EditEntryDateDialogState extends State<EditEntryDateDialog> {
|
|||
case DateEditAction.extractFromTitle:
|
||||
return DateModifier.extractFromTitle();
|
||||
case DateEditAction.shift:
|
||||
final shiftTotalMinutes = (_shiftHour.value * 60 + _shiftMinute.value) * (_shiftSign.value == '+' ? 1 : -1);
|
||||
final shiftTotalMinutes = (_shiftHour.value * minutesInHour + _shiftMinute.value) * (_shiftSign.value == '+' ? 1 : -1);
|
||||
return DateModifier.shift(_fields, shiftTotalMinutes);
|
||||
case DateEditAction.remove:
|
||||
return DateModifier.remove(_fields);
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/utils/time_utils.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/identity/aves_caption.dart';
|
||||
import 'package:aves/widgets/dialogs/aves_selection_dialog.dart';
|
||||
import 'package:aves/widgets/dialogs/duration_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
|
@ -119,3 +122,47 @@ class SettingsSelectionListTile<T extends Enum> extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsDurationListTile extends StatelessWidget {
|
||||
final int Function(BuildContext, Settings) selector;
|
||||
final ValueChanged<int> onChanged;
|
||||
final String title;
|
||||
|
||||
const SettingsDurationListTile({
|
||||
super.key,
|
||||
required this.selector,
|
||||
required this.onChanged,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Selector<Settings, int>(
|
||||
selector: selector,
|
||||
builder: (context, current, child) {
|
||||
final currentMinutes = current ~/ secondsInMinute;
|
||||
final currentSeconds = current % secondsInMinute;
|
||||
|
||||
final l10n = context.l10n;
|
||||
final subtitle = [
|
||||
if (currentMinutes > 0) l10n.timeMinutes(currentMinutes),
|
||||
if (currentSeconds > 0) l10n.timeSeconds(currentSeconds),
|
||||
].join(' ');
|
||||
|
||||
return ListTile(
|
||||
title: Text(title),
|
||||
subtitle: AvesCaption(subtitle),
|
||||
onTap: () async {
|
||||
final v = await showDialog<int>(
|
||||
context: context,
|
||||
builder: (context) => DurationDialog(initialSeconds: current),
|
||||
);
|
||||
if (v != null) {
|
||||
onChanged(v);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/settings/enums/enums.dart';
|
||||
import 'package:aves/model/settings/enums/slideshow_interval.dart';
|
||||
import 'package:aves/model/settings/enums/slideshow_video_playback.dart';
|
||||
import 'package:aves/model/settings/enums/viewer_transition.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
|
@ -30,12 +29,12 @@ class ScreenSaverSettingsPage extends StatelessWidget {
|
|||
SettingsSwitchListTile(
|
||||
selector: (context, s) => s.screenSaverFillScreen,
|
||||
onChanged: (v) => settings.screenSaverFillScreen = v,
|
||||
title: context.l10n.settingsSlideshowFillScreen,
|
||||
title: l10n.settingsSlideshowFillScreen,
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
selector: (context, s) => s.screenSaverAnimatedZoomEffect,
|
||||
onChanged: (v) => settings.screenSaverAnimatedZoomEffect = v,
|
||||
title: context.l10n.settingsSlideshowAnimatedZoomEffect,
|
||||
title: l10n.settingsSlideshowAnimatedZoomEffect,
|
||||
),
|
||||
SettingsSelectionListTile<ViewerTransition>(
|
||||
values: ViewerTransition.values,
|
||||
|
@ -44,12 +43,10 @@ class ScreenSaverSettingsPage extends StatelessWidget {
|
|||
onSelection: (v) => settings.screenSaverTransition = v,
|
||||
tileTitle: l10n.settingsSlideshowTransitionTile,
|
||||
),
|
||||
SettingsSelectionListTile<SlideshowInterval>(
|
||||
values: SlideshowInterval.values,
|
||||
getName: (context, v) => v.getName(context),
|
||||
SettingsDurationListTile(
|
||||
selector: (context, s) => s.screenSaverInterval,
|
||||
onSelection: (v) => settings.screenSaverInterval = v,
|
||||
tileTitle: l10n.settingsSlideshowIntervalTile,
|
||||
onChanged: (v) => settings.screenSaverInterval = v,
|
||||
title: l10n.settingsSlideshowIntervalTile,
|
||||
),
|
||||
SettingsSelectionListTile<SlideshowVideoPlayback>(
|
||||
values: SlideshowVideoPlayback.values,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import 'package:aves/model/settings/enums/enums.dart';
|
||||
import 'package:aves/model/settings/enums/slideshow_interval.dart';
|
||||
import 'package:aves/model/settings/enums/slideshow_video_playback.dart';
|
||||
import 'package:aves/model/settings/enums/viewer_transition.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
|
@ -14,9 +13,10 @@ class ViewerSlideshowPage extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(context.l10n.settingsViewerSlideshowPageTitle),
|
||||
title: Text(l10n.settingsViewerSlideshowPageTitle),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: ListView(
|
||||
|
@ -24,44 +24,42 @@ class ViewerSlideshowPage extends StatelessWidget {
|
|||
SettingsSwitchListTile(
|
||||
selector: (context, s) => s.slideshowRepeat,
|
||||
onChanged: (v) => settings.slideshowRepeat = v,
|
||||
title: context.l10n.settingsSlideshowRepeat,
|
||||
title: l10n.settingsSlideshowRepeat,
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
selector: (context, s) => s.slideshowShuffle,
|
||||
onChanged: (v) => settings.slideshowShuffle = v,
|
||||
title: context.l10n.settingsSlideshowShuffle,
|
||||
title: l10n.settingsSlideshowShuffle,
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
selector: (context, s) => s.slideshowFillScreen,
|
||||
onChanged: (v) => settings.slideshowFillScreen = v,
|
||||
title: context.l10n.settingsSlideshowFillScreen,
|
||||
title: l10n.settingsSlideshowFillScreen,
|
||||
),
|
||||
SettingsSwitchListTile(
|
||||
selector: (context, s) => s.slideshowAnimatedZoomEffect,
|
||||
onChanged: (v) => settings.slideshowAnimatedZoomEffect = v,
|
||||
title: context.l10n.settingsSlideshowAnimatedZoomEffect,
|
||||
title: l10n.settingsSlideshowAnimatedZoomEffect,
|
||||
),
|
||||
SettingsSelectionListTile<ViewerTransition>(
|
||||
values: ViewerTransition.values,
|
||||
getName: (context, v) => v.getName(context),
|
||||
selector: (context, s) => s.slideshowTransition,
|
||||
onSelection: (v) => settings.slideshowTransition = v,
|
||||
tileTitle: context.l10n.settingsSlideshowTransitionTile,
|
||||
tileTitle: l10n.settingsSlideshowTransitionTile,
|
||||
),
|
||||
SettingsSelectionListTile<SlideshowInterval>(
|
||||
values: SlideshowInterval.values,
|
||||
getName: (context, v) => v.getName(context),
|
||||
SettingsDurationListTile(
|
||||
selector: (context, s) => s.slideshowInterval,
|
||||
onSelection: (v) => settings.slideshowInterval = v,
|
||||
tileTitle: context.l10n.settingsSlideshowIntervalTile,
|
||||
onChanged: (v) => settings.slideshowInterval = v,
|
||||
title: l10n.settingsSlideshowIntervalTile,
|
||||
),
|
||||
SettingsSelectionListTile<SlideshowVideoPlayback>(
|
||||
values: SlideshowVideoPlayback.values,
|
||||
getName: (context, v) => v.getName(context),
|
||||
selector: (context, s) => s.slideshowVideoPlayback,
|
||||
onSelection: (v) => settings.slideshowVideoPlayback = v,
|
||||
tileTitle: context.l10n.settingsSlideshowVideoPlaybackTile,
|
||||
dialogTitle: context.l10n.settingsSlideshowVideoPlaybackDialogTitle,
|
||||
tileTitle: l10n.settingsSlideshowVideoPlaybackTile,
|
||||
dialogTitle: l10n.settingsSlideshowVideoPlaybackDialogTitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:aves/model/filters/mime.dart';
|
||||
import 'package:aves/model/settings/enums/enums.dart';
|
||||
import 'package:aves/model/settings/enums/slideshow_interval.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/model/source/collection_lens.dart';
|
||||
import 'package:aves/model/source/collection_source.dart';
|
||||
|
@ -42,7 +41,7 @@ class _ScreenSaverPageState extends State<ScreenSaverPage> with WidgetsBindingOb
|
|||
transition: settings.screenSaverTransition,
|
||||
repeat: true,
|
||||
autopilot: true,
|
||||
autopilotInterval: settings.screenSaverInterval.getDuration(),
|
||||
autopilotInterval: Duration(seconds: settings.screenSaverInterval),
|
||||
autopilotAnimatedZoom: settings.screenSaverAnimatedZoomEffect,
|
||||
);
|
||||
source.stateNotifier.addListener(_onSourceStateChanged);
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:aves/model/actions/slideshow_actions.dart';
|
|||
import 'package:aves/model/filters/album.dart';
|
||||
import 'package:aves/model/filters/mime.dart';
|
||||
import 'package:aves/model/settings/enums/enums.dart';
|
||||
import 'package:aves/model/settings/enums/slideshow_interval.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves/model/source/collection_lens.dart';
|
||||
import 'package:aves/theme/icons.dart';
|
||||
|
@ -44,7 +43,7 @@ class _SlideshowPageState extends State<SlideshowPage> {
|
|||
transition: settings.slideshowTransition,
|
||||
repeat: settings.slideshowRepeat,
|
||||
autopilot: true,
|
||||
autopilotInterval: settings.slideshowInterval.getDuration(),
|
||||
autopilotInterval: Duration(seconds: settings.slideshowInterval),
|
||||
autopilotAnimatedZoom: settings.slideshowAnimatedZoomEffect,
|
||||
);
|
||||
_initSlideshowCollection();
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
"de": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
],
|
||||
|
||||
"el": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
],
|
||||
|
||||
"es": [
|
||||
|
@ -18,6 +20,7 @@
|
|||
"widgetOpenPageHome",
|
||||
"widgetOpenPageCollection",
|
||||
"widgetOpenPageViewer",
|
||||
"durationDialogSeconds",
|
||||
"viewDialogReverseSortOrder",
|
||||
"tileLayoutMosaic",
|
||||
"sortOrderNewestFirst",
|
||||
|
@ -47,6 +50,7 @@
|
|||
"widgetOpenPageHome",
|
||||
"widgetOpenPageCollection",
|
||||
"widgetOpenPageViewer",
|
||||
"durationDialogSeconds",
|
||||
"tileLayoutMosaic",
|
||||
"albumGroupType",
|
||||
"albumMimeTypeMixed",
|
||||
|
@ -58,7 +62,8 @@
|
|||
],
|
||||
|
||||
"it": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
],
|
||||
|
||||
"ja": [
|
||||
|
@ -72,6 +77,7 @@
|
|||
"widgetOpenPageHome",
|
||||
"widgetOpenPageCollection",
|
||||
"widgetOpenPageViewer",
|
||||
"durationDialogSeconds",
|
||||
"viewDialogReverseSortOrder",
|
||||
"tileLayoutMosaic",
|
||||
"sortOrderNewestFirst",
|
||||
|
@ -96,15 +102,18 @@
|
|||
],
|
||||
|
||||
"nl": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
],
|
||||
|
||||
"pt": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
],
|
||||
|
||||
"ru": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
],
|
||||
|
||||
"tr": [
|
||||
|
@ -131,6 +140,7 @@
|
|||
"widgetOpenPageHome",
|
||||
"widgetOpenPageCollection",
|
||||
"widgetOpenPageViewer",
|
||||
"durationDialogSeconds",
|
||||
"menuActionSlideshow",
|
||||
"viewDialogReverseSortOrder",
|
||||
"tileLayoutMosaic",
|
||||
|
@ -168,6 +178,7 @@
|
|||
],
|
||||
|
||||
"zh": [
|
||||
"widgetOpenPageCollection"
|
||||
"widgetOpenPageCollection",
|
||||
"durationDialogSeconds"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue