settings split, ijk player package
This commit is contained in:
parent
d79c92a9a0
commit
04745d6973
50 changed files with 1319 additions and 1004 deletions
|
@ -1,9 +1,6 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:aves/model/filters/recent.dart';
|
||||
import 'package:aves/model/naming_pattern.dart';
|
||||
import 'package:aves/ref/mime_types.dart';
|
||||
import 'package:aves/utils/colors.dart';
|
||||
import 'package:aves/widgets/filter_grids/albums_page.dart';
|
||||
import 'package:aves/widgets/filter_grids/countries_page.dart';
|
||||
import 'package:aves/widgets/filter_grids/tags_page.dart';
|
||||
|
@ -84,26 +81,6 @@ class SettingsDefaults {
|
|||
static const viewerUseCutout = true;
|
||||
static const enableMotionPhotoAutoPlay = false;
|
||||
|
||||
// video
|
||||
static const enableVideoHardwareAcceleration = true;
|
||||
static const videoAutoPlayMode = VideoAutoPlayMode.disabled;
|
||||
static const videoBackgroundMode = VideoBackgroundMode.disabled;
|
||||
static const videoLoopMode = VideoLoopMode.shortOnly;
|
||||
static const videoResumptionMode = VideoResumptionMode.ask;
|
||||
static const videoShowRawTimedText = false;
|
||||
static const videoControls = VideoControls.play;
|
||||
static const videoGestureDoubleTapTogglePlay = false;
|
||||
static const videoGestureSideDoubleTapSeek = true;
|
||||
static const videoGestureVerticalDragBrightnessVolume = false;
|
||||
|
||||
// subtitles
|
||||
static const subtitleFontSize = 20.0;
|
||||
static const subtitleTextAlignment = TextAlign.center;
|
||||
static const subtitleTextPosition = SubtitlePosition.bottom;
|
||||
static const subtitleShowOutline = true;
|
||||
static const subtitleTextColor = Color(0xFFFFFFFF);
|
||||
static const subtitleBackgroundColor = ColorUtils.transparentBlack;
|
||||
|
||||
// info
|
||||
static const infoMapZoom = 12.0;
|
||||
static const coordinateFormat = CoordinateFormat.dms;
|
||||
|
|
109
lib/model/settings/modules/app.dart
Normal file
109
lib/model/settings/modules/app.dart
Normal file
|
@ -0,0 +1,109 @@
|
|||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves/widgets/aves_app.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
mixin AppSettings on SettingsAccess {
|
||||
static const int _recentFilterHistoryMax = 10;
|
||||
|
||||
bool get hasAcceptedTerms => getBool(SettingKeys.hasAcceptedTermsKey) ?? SettingsDefaults.hasAcceptedTerms;
|
||||
|
||||
set hasAcceptedTerms(bool newValue) => set(SettingKeys.hasAcceptedTermsKey, newValue);
|
||||
|
||||
bool get canUseAnalysisService => getBool(SettingKeys.canUseAnalysisServiceKey) ?? SettingsDefaults.canUseAnalysisService;
|
||||
|
||||
set canUseAnalysisService(bool newValue) => set(SettingKeys.canUseAnalysisServiceKey, newValue);
|
||||
|
||||
bool get isInstalledAppAccessAllowed => getBool(SettingKeys.isInstalledAppAccessAllowedKey) ?? SettingsDefaults.isInstalledAppAccessAllowed;
|
||||
|
||||
set isInstalledAppAccessAllowed(bool newValue) => set(SettingKeys.isInstalledAppAccessAllowedKey, newValue);
|
||||
|
||||
bool get isErrorReportingAllowed => getBool(SettingKeys.isErrorReportingAllowedKey) ?? SettingsDefaults.isErrorReportingAllowed;
|
||||
|
||||
set isErrorReportingAllowed(bool newValue) => set(SettingKeys.isErrorReportingAllowedKey, newValue);
|
||||
|
||||
static const localeSeparator = '-';
|
||||
|
||||
Locale? get locale {
|
||||
// exceptionally allow getting locale before settings are initialized
|
||||
final tag = initialized ? getString(SettingKeys.localeKey) : null;
|
||||
if (tag != null) {
|
||||
final codes = tag.split(localeSeparator);
|
||||
return Locale.fromSubtags(
|
||||
languageCode: codes[0],
|
||||
scriptCode: codes[1] == '' ? null : codes[1],
|
||||
countryCode: codes[2] == '' ? null : codes[2],
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
set locale(Locale? newValue) {
|
||||
String? tag;
|
||||
if (newValue != null) {
|
||||
tag = [
|
||||
newValue.languageCode,
|
||||
newValue.scriptCode ?? '',
|
||||
newValue.countryCode ?? '',
|
||||
].join(localeSeparator);
|
||||
}
|
||||
set(SettingKeys.localeKey, tag);
|
||||
_appliedLocale = null;
|
||||
}
|
||||
|
||||
List<Locale> _systemLocalesFallback = [];
|
||||
|
||||
set systemLocalesFallback(List<Locale> locales) => _systemLocalesFallback = locales;
|
||||
|
||||
Locale? _appliedLocale;
|
||||
|
||||
void resetAppliedLocale() => _appliedLocale = null;
|
||||
|
||||
Locale get appliedLocale {
|
||||
if (_appliedLocale == null) {
|
||||
final _locale = locale;
|
||||
final preferredLocales = <Locale>[];
|
||||
if (_locale != null) {
|
||||
preferredLocales.add(_locale);
|
||||
} else {
|
||||
preferredLocales.addAll(WidgetsBinding.instance.platformDispatcher.locales);
|
||||
if (preferredLocales.isEmpty) {
|
||||
// the `window` locales may be empty in a window-less service context
|
||||
preferredLocales.addAll(_systemLocalesFallback);
|
||||
}
|
||||
}
|
||||
_appliedLocale = basicLocaleListResolution(preferredLocales, AvesApp.supportedLocales);
|
||||
}
|
||||
return _appliedLocale!;
|
||||
}
|
||||
|
||||
int get catalogTimeZoneRawOffsetMillis => getInt(SettingKeys.catalogTimeZoneRawOffsetMillisKey) ?? 0;
|
||||
|
||||
set catalogTimeZoneRawOffsetMillis(int newValue) => set(SettingKeys.catalogTimeZoneRawOffsetMillisKey, newValue);
|
||||
|
||||
double getTileExtent(String routeName) => getDouble(SettingKeys.tileExtentPrefixKey + routeName) ?? 0;
|
||||
|
||||
void setTileExtent(String routeName, double newValue) => set(SettingKeys.tileExtentPrefixKey + routeName, newValue);
|
||||
|
||||
TileLayout getTileLayout(String routeName) => getEnumOrDefault(SettingKeys.tileLayoutPrefixKey + routeName, SettingsDefaults.tileLayout, TileLayout.values);
|
||||
|
||||
void setTileLayout(String routeName, TileLayout newValue) => set(SettingKeys.tileLayoutPrefixKey + routeName, newValue.toString());
|
||||
|
||||
String get entryRenamingPattern => getString(SettingKeys.entryRenamingPatternKey) ?? SettingsDefaults.entryRenamingPattern;
|
||||
|
||||
set entryRenamingPattern(String newValue) => set(SettingKeys.entryRenamingPatternKey, newValue);
|
||||
|
||||
List<int>? get topEntryIds => getStringList(SettingKeys.topEntryIdsKey)?.map(int.tryParse).whereNotNull().toList();
|
||||
|
||||
set topEntryIds(List<int>? newValue) => set(SettingKeys.topEntryIdsKey, newValue?.map((id) => id.toString()).whereNotNull().toList());
|
||||
|
||||
List<String> get recentDestinationAlbums => getStringList(SettingKeys.recentDestinationAlbumsKey) ?? [];
|
||||
|
||||
set recentDestinationAlbums(List<String> newValue) => set(SettingKeys.recentDestinationAlbumsKey, newValue.take(_recentFilterHistoryMax).toList());
|
||||
|
||||
List<CollectionFilter> get recentTags => (getStringList(SettingKeys.recentTagsKey) ?? []).map(CollectionFilter.fromJson).whereNotNull().toList();
|
||||
|
||||
set recentTags(List<CollectionFilter> newValue) => set(SettingKeys.recentTagsKey, newValue.take(_recentFilterHistoryMax).map((filter) => filter.toJson()).toList());
|
||||
}
|
56
lib/model/settings/modules/collection.dart
Normal file
56
lib/model/settings/modules/collection.dart
Normal file
|
@ -0,0 +1,56 @@
|
|||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
|
||||
mixin CollectionSettings on SettingsAccess {
|
||||
List<String> get collectionBurstPatterns => getStringList(SettingKeys.collectionBurstPatternsKey) ?? [];
|
||||
|
||||
set collectionBurstPatterns(List<String> newValue) => set(SettingKeys.collectionBurstPatternsKey, newValue);
|
||||
|
||||
EntryGroupFactor get collectionSectionFactor => getEnumOrDefault(SettingKeys.collectionGroupFactorKey, SettingsDefaults.collectionSectionFactor, EntryGroupFactor.values);
|
||||
|
||||
set collectionSectionFactor(EntryGroupFactor newValue) => set(SettingKeys.collectionGroupFactorKey, newValue.toString());
|
||||
|
||||
EntrySortFactor get collectionSortFactor => getEnumOrDefault(SettingKeys.collectionSortFactorKey, SettingsDefaults.collectionSortFactor, EntrySortFactor.values);
|
||||
|
||||
set collectionSortFactor(EntrySortFactor newValue) => set(SettingKeys.collectionSortFactorKey, newValue.toString());
|
||||
|
||||
bool get collectionSortReverse => getBool(SettingKeys.collectionSortReverseKey) ?? false;
|
||||
|
||||
set collectionSortReverse(bool newValue) => set(SettingKeys.collectionSortReverseKey, newValue);
|
||||
|
||||
List<EntrySetAction> get collectionBrowsingQuickActions => getEnumListOrDefault(SettingKeys.collectionBrowsingQuickActionsKey, SettingsDefaults.collectionBrowsingQuickActions, EntrySetAction.values);
|
||||
|
||||
set collectionBrowsingQuickActions(List<EntrySetAction> newValue) => set(SettingKeys.collectionBrowsingQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
List<EntrySetAction> get collectionSelectionQuickActions => getEnumListOrDefault(SettingKeys.collectionSelectionQuickActionsKey, SettingsDefaults.collectionSelectionQuickActions, EntrySetAction.values);
|
||||
|
||||
set collectionSelectionQuickActions(List<EntrySetAction> newValue) => set(SettingKeys.collectionSelectionQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
bool get showThumbnailFavourite => getBool(SettingKeys.showThumbnailFavouriteKey) ?? SettingsDefaults.showThumbnailFavourite;
|
||||
|
||||
set showThumbnailFavourite(bool newValue) => set(SettingKeys.showThumbnailFavouriteKey, newValue);
|
||||
|
||||
ThumbnailOverlayLocationIcon get thumbnailLocationIcon => getEnumOrDefault(SettingKeys.thumbnailLocationIconKey, SettingsDefaults.thumbnailLocationIcon, ThumbnailOverlayLocationIcon.values);
|
||||
|
||||
set thumbnailLocationIcon(ThumbnailOverlayLocationIcon newValue) => set(SettingKeys.thumbnailLocationIconKey, newValue.toString());
|
||||
|
||||
ThumbnailOverlayTagIcon get thumbnailTagIcon => getEnumOrDefault(SettingKeys.thumbnailTagIconKey, SettingsDefaults.thumbnailTagIcon, ThumbnailOverlayTagIcon.values);
|
||||
|
||||
set thumbnailTagIcon(ThumbnailOverlayTagIcon newValue) => set(SettingKeys.thumbnailTagIconKey, newValue.toString());
|
||||
|
||||
bool get showThumbnailMotionPhoto => getBool(SettingKeys.showThumbnailMotionPhotoKey) ?? SettingsDefaults.showThumbnailMotionPhoto;
|
||||
|
||||
set showThumbnailMotionPhoto(bool newValue) => set(SettingKeys.showThumbnailMotionPhotoKey, newValue);
|
||||
|
||||
bool get showThumbnailRating => getBool(SettingKeys.showThumbnailRatingKey) ?? SettingsDefaults.showThumbnailRating;
|
||||
|
||||
set showThumbnailRating(bool newValue) => set(SettingKeys.showThumbnailRatingKey, newValue);
|
||||
|
||||
bool get showThumbnailRaw => getBool(SettingKeys.showThumbnailRawKey) ?? SettingsDefaults.showThumbnailRaw;
|
||||
|
||||
set showThumbnailRaw(bool newValue) => set(SettingKeys.showThumbnailRawKey, newValue);
|
||||
|
||||
bool get showThumbnailVideoDuration => getBool(SettingKeys.showThumbnailVideoDurationKey) ?? SettingsDefaults.showThumbnailVideoDuration;
|
||||
|
||||
set showThumbnailVideoDuration(bool newValue) => set(SettingKeys.showThumbnailVideoDurationKey, newValue);
|
||||
}
|
37
lib/model/settings/modules/display.dart
Normal file
37
lib/model/settings/modules/display.dart
Normal file
|
@ -0,0 +1,37 @@
|
|||
import 'package:aves/model/device.dart';
|
||||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
|
||||
mixin DisplaySettings on SettingsAccess {
|
||||
DisplayRefreshRateMode get displayRefreshRateMode => getEnumOrDefault(SettingKeys.displayRefreshRateModeKey, SettingsDefaults.displayRefreshRateMode, DisplayRefreshRateMode.values);
|
||||
|
||||
set displayRefreshRateMode(DisplayRefreshRateMode newValue) => set(SettingKeys.displayRefreshRateModeKey, newValue.toString());
|
||||
|
||||
AvesThemeBrightness get themeBrightness => getEnumOrDefault(SettingKeys.themeBrightnessKey, SettingsDefaults.themeBrightness, AvesThemeBrightness.values);
|
||||
|
||||
set themeBrightness(AvesThemeBrightness newValue) => set(SettingKeys.themeBrightnessKey, newValue.toString());
|
||||
|
||||
AvesThemeColorMode get themeColorMode => getEnumOrDefault(SettingKeys.themeColorModeKey, SettingsDefaults.themeColorMode, AvesThemeColorMode.values);
|
||||
|
||||
set themeColorMode(AvesThemeColorMode newValue) => set(SettingKeys.themeColorModeKey, newValue.toString());
|
||||
|
||||
bool get enableDynamicColor => getBool(SettingKeys.enableDynamicColorKey) ?? SettingsDefaults.enableDynamicColor;
|
||||
|
||||
set enableDynamicColor(bool newValue) => set(SettingKeys.enableDynamicColorKey, newValue);
|
||||
|
||||
bool get enableBlurEffect => getBool(SettingKeys.enableBlurEffectKey) ?? SettingsDefaults.enableBlurEffect;
|
||||
|
||||
set enableBlurEffect(bool newValue) => set(SettingKeys.enableBlurEffectKey, newValue);
|
||||
|
||||
MaxBrightness get maxBrightness => getEnumOrDefault(SettingKeys.maxBrightnessKey, SettingsDefaults.maxBrightness, MaxBrightness.values);
|
||||
|
||||
set maxBrightness(MaxBrightness newValue) => set(SettingKeys.maxBrightnessKey, newValue.toString());
|
||||
|
||||
bool get forceTvLayout => getBool(SettingKeys.forceTvLayoutKey) ?? SettingsDefaults.forceTvLayout;
|
||||
|
||||
set forceTvLayout(bool newValue) => set(SettingKeys.forceTvLayoutKey, newValue);
|
||||
|
||||
bool get useTvLayout => device.isTelevision || forceTvLayout;
|
||||
|
||||
bool get isReadOnly => useTvLayout;
|
||||
}
|
74
lib/model/settings/modules/filter_grids.dart
Normal file
74
lib/model/settings/modules/filter_grids.dart
Normal file
|
@ -0,0 +1,74 @@
|
|||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves/model/settings/modules/search.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
mixin FilterGridsSettings on SettingsAccess, SearchSettings {
|
||||
AlbumChipGroupFactor get albumGroupFactor => getEnumOrDefault(SettingKeys.albumGroupFactorKey, SettingsDefaults.albumGroupFactor, AlbumChipGroupFactor.values);
|
||||
|
||||
set albumGroupFactor(AlbumChipGroupFactor newValue) => set(SettingKeys.albumGroupFactorKey, newValue.toString());
|
||||
|
||||
ChipSortFactor get albumSortFactor => getEnumOrDefault(SettingKeys.albumSortFactorKey, SettingsDefaults.chipListSortFactor, ChipSortFactor.values);
|
||||
|
||||
set albumSortFactor(ChipSortFactor newValue) => set(SettingKeys.albumSortFactorKey, newValue.toString());
|
||||
|
||||
ChipSortFactor get countrySortFactor => getEnumOrDefault(SettingKeys.countrySortFactorKey, SettingsDefaults.chipListSortFactor, ChipSortFactor.values);
|
||||
|
||||
set countrySortFactor(ChipSortFactor newValue) => set(SettingKeys.countrySortFactorKey, newValue.toString());
|
||||
|
||||
ChipSortFactor get stateSortFactor => getEnumOrDefault(SettingKeys.stateSortFactorKey, SettingsDefaults.chipListSortFactor, ChipSortFactor.values);
|
||||
|
||||
set stateSortFactor(ChipSortFactor newValue) => set(SettingKeys.stateSortFactorKey, newValue.toString());
|
||||
|
||||
ChipSortFactor get placeSortFactor => getEnumOrDefault(SettingKeys.placeSortFactorKey, SettingsDefaults.chipListSortFactor, ChipSortFactor.values);
|
||||
|
||||
set placeSortFactor(ChipSortFactor newValue) => set(SettingKeys.placeSortFactorKey, newValue.toString());
|
||||
|
||||
ChipSortFactor get tagSortFactor => getEnumOrDefault(SettingKeys.tagSortFactorKey, SettingsDefaults.chipListSortFactor, ChipSortFactor.values);
|
||||
|
||||
set tagSortFactor(ChipSortFactor newValue) => set(SettingKeys.tagSortFactorKey, newValue.toString());
|
||||
|
||||
bool get albumSortReverse => getBool(SettingKeys.albumSortReverseKey) ?? false;
|
||||
|
||||
set albumSortReverse(bool newValue) => set(SettingKeys.albumSortReverseKey, newValue);
|
||||
|
||||
bool get countrySortReverse => getBool(SettingKeys.countrySortReverseKey) ?? false;
|
||||
|
||||
set countrySortReverse(bool newValue) => set(SettingKeys.countrySortReverseKey, newValue);
|
||||
|
||||
bool get stateSortReverse => getBool(SettingKeys.stateSortReverseKey) ?? false;
|
||||
|
||||
set stateSortReverse(bool newValue) => set(SettingKeys.stateSortReverseKey, newValue);
|
||||
|
||||
bool get placeSortReverse => getBool(SettingKeys.placeSortReverseKey) ?? false;
|
||||
|
||||
set placeSortReverse(bool newValue) => set(SettingKeys.placeSortReverseKey, newValue);
|
||||
|
||||
bool get tagSortReverse => getBool(SettingKeys.tagSortReverseKey) ?? false;
|
||||
|
||||
set tagSortReverse(bool newValue) => set(SettingKeys.tagSortReverseKey, newValue);
|
||||
|
||||
Set<CollectionFilter> get pinnedFilters => (getStringList(SettingKeys.pinnedFiltersKey) ?? []).map(CollectionFilter.fromJson).whereNotNull().toSet();
|
||||
|
||||
set pinnedFilters(Set<CollectionFilter> newValue) => set(SettingKeys.pinnedFiltersKey, newValue.map((filter) => filter.toJson()).toList());
|
||||
|
||||
Set<CollectionFilter> get hiddenFilters => (getStringList(SettingKeys.hiddenFiltersKey) ?? []).map(CollectionFilter.fromJson).whereNotNull().toSet();
|
||||
|
||||
set hiddenFilters(Set<CollectionFilter> newValue) => set(SettingKeys.hiddenFiltersKey, newValue.map((filter) => filter.toJson()).toList());
|
||||
|
||||
void changeFilterVisibility(Set<CollectionFilter> filters, bool visible) {
|
||||
final _hiddenFilters = hiddenFilters;
|
||||
if (visible) {
|
||||
_hiddenFilters.removeAll(filters);
|
||||
} else {
|
||||
_hiddenFilters.addAll(filters);
|
||||
searchHistory = searchHistory..removeWhere(filters.contains);
|
||||
}
|
||||
hiddenFilters = _hiddenFilters;
|
||||
}
|
||||
|
||||
bool get showAlbumPickQuery => getBool(SettingKeys.showAlbumPickQueryKey) ?? false;
|
||||
|
||||
set showAlbumPickQuery(bool newValue) => set(SettingKeys.showAlbumPickQueryKey, newValue);
|
||||
}
|
16
lib/model/settings/modules/info.dart
Normal file
16
lib/model/settings/modules/info.dart
Normal file
|
@ -0,0 +1,16 @@
|
|||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
|
||||
mixin InfoSettings on SettingsAccess {
|
||||
double get infoMapZoom => getDouble(SettingKeys.infoMapZoomKey) ?? SettingsDefaults.infoMapZoom;
|
||||
|
||||
set infoMapZoom(double newValue) => set(SettingKeys.infoMapZoomKey, newValue);
|
||||
|
||||
CoordinateFormat get coordinateFormat => getEnumOrDefault(SettingKeys.coordinateFormatKey, SettingsDefaults.coordinateFormat, CoordinateFormat.values);
|
||||
|
||||
set coordinateFormat(CoordinateFormat newValue) => set(SettingKeys.coordinateFormatKey, newValue.toString());
|
||||
|
||||
UnitSystem get unitSystem => getEnumOrDefault(SettingKeys.unitSystemKey, SettingsDefaults.unitSystem, UnitSystem.values);
|
||||
|
||||
set unitSystem(UnitSystem newValue) => set(SettingKeys.unitSystemKey, newValue.toString());
|
||||
}
|
62
lib/model/settings/modules/navigation.dart
Normal file
62
lib/model/settings/modules/navigation.dart
Normal file
|
@ -0,0 +1,62 @@
|
|||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
|
||||
mixin NavigationSettings on SettingsAccess {
|
||||
bool get mustBackTwiceToExit => getBool(SettingKeys.mustBackTwiceToExitKey) ?? SettingsDefaults.mustBackTwiceToExit;
|
||||
|
||||
set mustBackTwiceToExit(bool newValue) => set(SettingKeys.mustBackTwiceToExitKey, newValue);
|
||||
|
||||
KeepScreenOn get keepScreenOn => getEnumOrDefault(SettingKeys.keepScreenOnKey, SettingsDefaults.keepScreenOn, KeepScreenOn.values);
|
||||
|
||||
set keepScreenOn(KeepScreenOn newValue) => set(SettingKeys.keepScreenOnKey, newValue.toString());
|
||||
|
||||
HomePageSetting get homePage => getEnumOrDefault(SettingKeys.homePageKey, SettingsDefaults.homePage, HomePageSetting.values);
|
||||
|
||||
set homePage(HomePageSetting newValue) => set(SettingKeys.homePageKey, newValue.toString());
|
||||
|
||||
bool get enableBottomNavigationBar => getBool(SettingKeys.enableBottomNavigationBarKey) ?? SettingsDefaults.enableBottomNavigationBar;
|
||||
|
||||
set enableBottomNavigationBar(bool newValue) => set(SettingKeys.enableBottomNavigationBarKey, newValue);
|
||||
|
||||
bool get confirmCreateVault => getBool(SettingKeys.confirmCreateVaultKey) ?? SettingsDefaults.confirm;
|
||||
|
||||
set confirmCreateVault(bool newValue) => set(SettingKeys.confirmCreateVaultKey, newValue);
|
||||
|
||||
bool get confirmDeleteForever => getBool(SettingKeys.confirmDeleteForeverKey) ?? SettingsDefaults.confirm;
|
||||
|
||||
set confirmDeleteForever(bool newValue) => set(SettingKeys.confirmDeleteForeverKey, newValue);
|
||||
|
||||
bool get confirmMoveToBin => getBool(SettingKeys.confirmMoveToBinKey) ?? SettingsDefaults.confirm;
|
||||
|
||||
set confirmMoveToBin(bool newValue) => set(SettingKeys.confirmMoveToBinKey, newValue);
|
||||
|
||||
bool get confirmMoveUndatedItems => getBool(SettingKeys.confirmMoveUndatedItemsKey) ?? SettingsDefaults.confirm;
|
||||
|
||||
set confirmMoveUndatedItems(bool newValue) => set(SettingKeys.confirmMoveUndatedItemsKey, newValue);
|
||||
|
||||
bool get confirmAfterMoveToBin => getBool(SettingKeys.confirmAfterMoveToBinKey) ?? SettingsDefaults.confirm;
|
||||
|
||||
set confirmAfterMoveToBin(bool newValue) => set(SettingKeys.confirmAfterMoveToBinKey, newValue);
|
||||
|
||||
bool get setMetadataDateBeforeFileOp => getBool(SettingKeys.setMetadataDateBeforeFileOpKey) ?? SettingsDefaults.setMetadataDateBeforeFileOp;
|
||||
|
||||
set setMetadataDateBeforeFileOp(bool newValue) => set(SettingKeys.setMetadataDateBeforeFileOpKey, newValue);
|
||||
|
||||
List<CollectionFilter?> get drawerTypeBookmarks =>
|
||||
(getStringList(SettingKeys.drawerTypeBookmarksKey))?.map((v) {
|
||||
if (v.isEmpty) return null;
|
||||
return CollectionFilter.fromJson(v);
|
||||
}).toList() ??
|
||||
SettingsDefaults.drawerTypeBookmarks;
|
||||
|
||||
set drawerTypeBookmarks(List<CollectionFilter?> newValue) => set(SettingKeys.drawerTypeBookmarksKey, newValue.map((filter) => filter?.toJson() ?? '').toList());
|
||||
|
||||
List<String>? get drawerAlbumBookmarks => getStringList(SettingKeys.drawerAlbumBookmarksKey);
|
||||
|
||||
set drawerAlbumBookmarks(List<String>? newValue) => set(SettingKeys.drawerAlbumBookmarksKey, newValue);
|
||||
|
||||
List<String> get drawerPageBookmarks => getStringList(SettingKeys.drawerPageBookmarksKey) ?? SettingsDefaults.drawerPageBookmarks;
|
||||
|
||||
set drawerPageBookmarks(List<String> newValue) => set(SettingKeys.drawerPageBookmarksKey, newValue);
|
||||
}
|
14
lib/model/settings/modules/search.dart
Normal file
14
lib/model/settings/modules/search.dart
Normal file
|
@ -0,0 +1,14 @@
|
|||
import 'package:aves/model/filters/filters.dart';
|
||||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
mixin SearchSettings on SettingsAccess {
|
||||
bool get saveSearchHistory => getBool(SettingKeys.saveSearchHistoryKey) ?? SettingsDefaults.saveSearchHistory;
|
||||
|
||||
set saveSearchHistory(bool newValue) => set(SettingKeys.saveSearchHistoryKey, newValue);
|
||||
|
||||
List<CollectionFilter> get searchHistory => (getStringList(SettingKeys.searchHistoryKey) ?? []).map(CollectionFilter.fromJson).whereNotNull().toList();
|
||||
|
||||
set searchHistory(List<CollectionFilter> newValue) => set(SettingKeys.searchHistoryKey, newValue.map((filter) => filter.toJson()).toList());
|
||||
}
|
52
lib/model/settings/modules/viewer.dart
Normal file
52
lib/model/settings/modules/viewer.dart
Normal file
|
@ -0,0 +1,52 @@
|
|||
import 'package:aves/model/settings/defaults.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
|
||||
mixin ViewerSettings on SettingsAccess {
|
||||
List<EntryAction> get viewerQuickActions => getEnumListOrDefault(SettingKeys.viewerQuickActionsKey, SettingsDefaults.viewerQuickActions, EntryAction.values);
|
||||
|
||||
set viewerQuickActions(List<EntryAction> newValue) => set(SettingKeys.viewerQuickActionsKey, newValue.map((v) => v.toString()).toList());
|
||||
|
||||
bool get showOverlayOnOpening => getBool(SettingKeys.showOverlayOnOpeningKey) ?? SettingsDefaults.showOverlayOnOpening;
|
||||
|
||||
set showOverlayOnOpening(bool newValue) => set(SettingKeys.showOverlayOnOpeningKey, newValue);
|
||||
|
||||
bool get showOverlayMinimap => getBool(SettingKeys.showOverlayMinimapKey) ?? SettingsDefaults.showOverlayMinimap;
|
||||
|
||||
set showOverlayMinimap(bool newValue) => set(SettingKeys.showOverlayMinimapKey, newValue);
|
||||
|
||||
bool get showOverlayInfo => getBool(SettingKeys.showOverlayInfoKey) ?? SettingsDefaults.showOverlayInfo;
|
||||
|
||||
set showOverlayInfo(bool newValue) => set(SettingKeys.showOverlayInfoKey, newValue);
|
||||
|
||||
bool get showOverlayDescription => getBool(SettingKeys.showOverlayDescriptionKey) ?? SettingsDefaults.showOverlayDescription;
|
||||
|
||||
set showOverlayDescription(bool newValue) => set(SettingKeys.showOverlayDescriptionKey, newValue);
|
||||
|
||||
bool get showOverlayRatingTags => getBool(SettingKeys.showOverlayRatingTagsKey) ?? SettingsDefaults.showOverlayRatingTags;
|
||||
|
||||
set showOverlayRatingTags(bool newValue) => set(SettingKeys.showOverlayRatingTagsKey, newValue);
|
||||
|
||||
bool get showOverlayShootingDetails => getBool(SettingKeys.showOverlayShootingDetailsKey) ?? SettingsDefaults.showOverlayShootingDetails;
|
||||
|
||||
set showOverlayShootingDetails(bool newValue) => set(SettingKeys.showOverlayShootingDetailsKey, newValue);
|
||||
|
||||
bool get showOverlayThumbnailPreview => getBool(SettingKeys.showOverlayThumbnailPreviewKey) ?? SettingsDefaults.showOverlayThumbnailPreview;
|
||||
|
||||
set showOverlayThumbnailPreview(bool newValue) => set(SettingKeys.showOverlayThumbnailPreviewKey, newValue);
|
||||
|
||||
bool get viewerGestureSideTapNext => getBool(SettingKeys.viewerGestureSideTapNextKey) ?? SettingsDefaults.viewerGestureSideTapNext;
|
||||
|
||||
set viewerGestureSideTapNext(bool newValue) => set(SettingKeys.viewerGestureSideTapNextKey, newValue);
|
||||
|
||||
bool get viewerUseCutout => getBool(SettingKeys.viewerUseCutoutKey) ?? SettingsDefaults.viewerUseCutout;
|
||||
|
||||
set viewerUseCutout(bool newValue) => set(SettingKeys.viewerUseCutoutKey, newValue);
|
||||
|
||||
bool get enableMotionPhotoAutoPlay => getBool(SettingKeys.enableMotionPhotoAutoPlayKey) ?? SettingsDefaults.enableMotionPhotoAutoPlay;
|
||||
|
||||
set enableMotionPhotoAutoPlay(bool newValue) => set(SettingKeys.enableMotionPhotoAutoPlayKey, newValue);
|
||||
|
||||
EntryBackground get imageBackground => getEnumOrDefault(SettingKeys.imageBackgroundKey, SettingsDefaults.imageBackground, EntryBackground.values);
|
||||
|
||||
set imageBackground(EntryBackground newValue) => set(SettingKeys.imageBackgroundKey, newValue.toString());
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
import 'package:aves/model/settings/store/store.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
|
@ -84,10 +84,10 @@ class CollectionLens with ChangeNotifier {
|
|||
}
|
||||
_subscriptions.add(settings.updateStream
|
||||
.where((event) => [
|
||||
Settings.collectionBurstPatternsKey,
|
||||
Settings.collectionSortFactorKey,
|
||||
Settings.collectionGroupFactorKey,
|
||||
Settings.collectionSortReverseKey,
|
||||
SettingKeys.collectionBurstPatternsKey,
|
||||
SettingKeys.collectionSortFactorKey,
|
||||
SettingKeys.collectionGroupFactorKey,
|
||||
SettingKeys.collectionSortReverseKey,
|
||||
].contains(event.key))
|
||||
.listen((_) => _onSettingsChanged()));
|
||||
refresh();
|
||||
|
|
|
@ -61,8 +61,8 @@ mixin SourceBase {
|
|||
|
||||
abstract class CollectionSource with SourceBase, AlbumMixin, CountryMixin, PlaceMixin, StateMixin, LocationMixin, TagMixin, TrashMixin {
|
||||
CollectionSource() {
|
||||
settings.updateStream.where((event) => event.key == Settings.localeKey).listen((_) => invalidateAlbumDisplayNames());
|
||||
settings.updateStream.where((event) => event.key == Settings.hiddenFiltersKey).listen((event) {
|
||||
settings.updateStream.where((event) => event.key == SettingKeys.localeKey).listen((_) => invalidateAlbumDisplayNames());
|
||||
settings.updateStream.where((event) => event.key == SettingKeys.hiddenFiltersKey).listen((event) {
|
||||
final oldValue = event.oldValue;
|
||||
if (oldValue is List<String>?) {
|
||||
final oldHiddenFilters = (oldValue ?? []).map(CollectionFilter.fromJson).whereNotNull().toSet();
|
||||
|
|
|
@ -15,13 +15,14 @@ import 'package:aves/utils/file_utils.dart';
|
|||
import 'package:aves/utils/math_utils.dart';
|
||||
import 'package:aves/utils/string_utils.dart';
|
||||
import 'package:aves/utils/time_utils.dart';
|
||||
import 'package:aves/widgets/viewer/video/fijkplayer.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_video_ijk/aves_video_ijk.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:fijkplayer/fijkplayer.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class VideoMetadataFormatter {
|
||||
static bool _initializedFijkLog = false;
|
||||
static final _dateY4M2D2H2m2s2Pattern = RegExp(r'(\d{4})[-./:](\d{1,2})[-./:](\d{1,2})([ T](\d{1,2}):(\d{1,2}):(\d{1,2})( ([ap]\.? ?m\.?))?)?');
|
||||
static final _ambiguousDatePatterns = {
|
||||
RegExp(r'^\d{2}[-/]\d{2}[-/]\d{4}$'),
|
||||
|
@ -45,6 +46,10 @@ class VideoMetadataFormatter {
|
|||
};
|
||||
|
||||
static Future<Map> getVideoMetadata(AvesEntry entry) async {
|
||||
if (!_initializedFijkLog) {
|
||||
_initializedFijkLog = true;
|
||||
FijkLog.setLevel(FijkLogLevel.Warn);
|
||||
}
|
||||
final player = FijkPlayer();
|
||||
final info = await player.setDataSourceUntilPrepared(entry.uri).then((v) {
|
||||
return player.getInfo();
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'package:aves/services/common/services.dart';
|
|||
import 'package:aves/utils/android_file_utils.dart';
|
||||
import 'package:aves/view/view.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:fijkplayer/fijkplayer.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
|
@ -52,7 +51,6 @@ Future<void> _init() async {
|
|||
await device.init();
|
||||
await mobileServices.init();
|
||||
await settings.init(monitorPlatformSettings: false);
|
||||
FijkLog.setLevel(FijkLogLevel.Warn);
|
||||
await reportService.init();
|
||||
|
||||
final analyzer = Analyzer();
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import 'package:aves/model/availability.dart';
|
||||
import 'package:aves/model/db/db_metadata.dart';
|
||||
import 'package:aves/model/db/db_metadata_sqflite.dart';
|
||||
import 'package:aves/model/settings/store/store.dart';
|
||||
import 'package:aves/model/settings/store/store_shared_pref.dart';
|
||||
import 'package:aves/model/settings/store_shared_pref.dart';
|
||||
import 'package:aves/services/app_service.dart';
|
||||
import 'package:aves/services/device_service.dart';
|
||||
import 'package:aves/services/media/embedded_data_service.dart';
|
||||
|
@ -15,6 +14,7 @@ import 'package:aves/services/metadata/metadata_fetch_service.dart';
|
|||
import 'package:aves/services/security_service.dart';
|
||||
import 'package:aves/services/storage_service.dart';
|
||||
import 'package:aves/services/window_service.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_report/aves_report.dart';
|
||||
import 'package:aves_report_platform/aves_report_platform.dart';
|
||||
import 'package:aves_services/aves_services.dart';
|
||||
|
|
|
@ -41,7 +41,6 @@ import 'package:aves_model/aves_model.dart';
|
|||
import 'package:aves_utils/aves_utils.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:fijkplayer/fijkplayer.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -456,7 +455,6 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
|||
await _onTvLayoutChanged();
|
||||
_monitorSettings();
|
||||
|
||||
FijkLog.setLevel(FijkLogLevel.Warn);
|
||||
unawaited(_setupErrorReporting());
|
||||
|
||||
debugPrint('App setup in ${stopwatch.elapsed.inMilliseconds}ms');
|
||||
|
@ -549,15 +547,15 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
|||
|
||||
final settingStream = settings.updateStream;
|
||||
// app
|
||||
settingStream.where((event) => event.key == Settings.isInstalledAppAccessAllowedKey).listen((_) => applyIsInstalledAppAccessAllowed());
|
||||
settingStream.where((event) => event.key == SettingKeys.isInstalledAppAccessAllowedKey).listen((_) => applyIsInstalledAppAccessAllowed());
|
||||
// display
|
||||
settingStream.where((event) => event.key == Settings.displayRefreshRateModeKey).listen((_) => applyDisplayRefreshRateMode());
|
||||
settingStream.where((event) => event.key == Settings.maxBrightnessKey).listen((_) => applyMaxBrightness());
|
||||
settingStream.where((event) => event.key == Settings.forceTvLayoutKey).listen((_) => applyForceTvLayout());
|
||||
settingStream.where((event) => event.key == SettingKeys.displayRefreshRateModeKey).listen((_) => applyDisplayRefreshRateMode());
|
||||
settingStream.where((event) => event.key == SettingKeys.maxBrightnessKey).listen((_) => applyMaxBrightness());
|
||||
settingStream.where((event) => event.key == SettingKeys.forceTvLayoutKey).listen((_) => applyForceTvLayout());
|
||||
// navigation
|
||||
settingStream.where((event) => event.key == Settings.keepScreenOnKey).listen((_) => applyKeepScreenOn());
|
||||
settingStream.where((event) => event.key == SettingKeys.keepScreenOnKey).listen((_) => applyKeepScreenOn());
|
||||
// platform settings
|
||||
settingStream.where((event) => event.key == Settings.platformAccelerometerRotationKey).listen((_) => applyIsRotationLocked());
|
||||
settingStream.where((event) => event.key == SettingKeys.platformAccelerometerRotationKey).listen((_) => applyIsRotationLocked());
|
||||
|
||||
applyDisplayRefreshRateMode();
|
||||
applyMaxBrightness();
|
||||
|
@ -567,7 +565,7 @@ class _AvesAppState extends State<AvesApp> with WidgetsBindingObserver {
|
|||
|
||||
Future<void> _setupErrorReporting() async {
|
||||
await reportService.init();
|
||||
settings.updateStream.where((event) => event.key == Settings.isErrorReportingAllowedKey).listen(
|
||||
settings.updateStream.where((event) => event.key == SettingKeys.isErrorReportingAllowedKey).listen(
|
||||
(_) => reportService.setCollectionEnabled(settings.isErrorReportingAllowed),
|
||||
);
|
||||
await reportService.setCollectionEnabled(settings.isErrorReportingAllowed);
|
||||
|
|
|
@ -27,6 +27,7 @@ import 'package:aves/widgets/common/providers/selection_provider.dart';
|
|||
import 'package:aves/widgets/navigation/drawer/app_drawer.dart';
|
||||
import 'package:aves/widgets/navigation/nav_bar/nav_bar.dart';
|
||||
import 'package:aves/widgets/navigation/tv_rail.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
@ -64,7 +65,7 @@ class _CollectionPageState extends State<CollectionPage> {
|
|||
filters: widget.filters,
|
||||
);
|
||||
super.initState();
|
||||
_subscriptions.add(settings.updateStream.where((event) => event.key == Settings.enableBinKey).listen((_) {
|
||||
_subscriptions.add(settings.updateStream.where((event) => event.key == SettingKeys.enableBinKey).listen((_) {
|
||||
if (!settings.enableBin) {
|
||||
_collection.removeFilter(TrashFilter.instance);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/utils/colors.dart';
|
||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class FixedExtentScaleOverlay extends StatelessWidget {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:aves/theme/durations.dart';
|
||||
import 'package:aves/utils/colors.dart';
|
||||
import 'package:aves/widgets/common/grid/sections/mosaic/scale_grid.dart';
|
||||
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
typedef MosaicItemBuilder = Widget Function(int index, double targetExtent);
|
||||
|
|
|
@ -165,7 +165,7 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
|
|||
_tapped = false;
|
||||
_subscriptions.add(covers.packageChangeStream.listen(_onCoverColorChanged));
|
||||
_subscriptions.add(covers.colorChangeStream.listen(_onCoverColorChanged));
|
||||
_subscriptions.add(settings.updateStream.where((event) => event.key == Settings.themeColorModeKey).listen((_) {
|
||||
_subscriptions.add(settings.updateStream.where((event) => event.key == SettingKeys.themeColorModeKey).listen((_) {
|
||||
// delay so that contextual colors reflect the new settings
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
|
@ -13,6 +14,7 @@ class TileExtentController {
|
|||
|
||||
late double userPreferredExtent;
|
||||
Size _viewportSize = Size.zero;
|
||||
final List<StreamSubscription> _subscriptions = [];
|
||||
|
||||
Size get viewportSize => _viewportSize;
|
||||
|
||||
|
@ -28,11 +30,13 @@ class TileExtentController {
|
|||
// initialize extent to 0, so that it will be dynamically sized on first launch
|
||||
extentNotifier = ValueNotifier(0);
|
||||
userPreferredExtent = settings.getTileExtent(settingsRouteKey);
|
||||
settings.addListener(_onSettingsChanged);
|
||||
_subscriptions.add(settings.updateTileExtentStream.listen((_) => _onSettingsChanged()));
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
settings.removeListener(_onSettingsChanged);
|
||||
_subscriptions
|
||||
..forEach((sub) => sub.cancel())
|
||||
..clear();
|
||||
}
|
||||
|
||||
void _onSettingsChanged() {
|
||||
|
|
|
@ -6,9 +6,9 @@ import 'package:aves/model/settings/settings.dart';
|
|||
import 'package:aves/model/source/collection_lens.dart';
|
||||
import 'package:aves/services/common/services.dart';
|
||||
import 'package:aves/widgets/viewer/video/db_playback_state_handler.dart';
|
||||
import 'package:aves/widgets/viewer/video/fijkplayer.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_video/aves_video.dart';
|
||||
import 'package:aves_video_ijk/aves_video_ijk.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
class VideoConductor {
|
||||
|
@ -37,7 +37,11 @@ class VideoConductor {
|
|||
if (controller != null) {
|
||||
_controllers.remove(controller);
|
||||
} else {
|
||||
controller = IjkPlayerAvesVideoController(entry, playbackStateHandler: playbackStateHandler);
|
||||
controller = IjkPlayerAvesVideoController(
|
||||
entry,
|
||||
playbackStateHandler: playbackStateHandler,
|
||||
settings: settings,
|
||||
);
|
||||
_subscriptions.add(controller.statusStream.listen((event) => _onControllerStatusChanged(entry, controller!, event)));
|
||||
}
|
||||
_controllers.insert(0, controller);
|
||||
|
|
|
@ -14,7 +14,11 @@ export 'src/editor/enums.dart';
|
|||
export 'src/entry/base.dart';
|
||||
export 'src/metadata/enums.dart';
|
||||
export 'src/metadata/fields.dart';
|
||||
export 'src/settings/access.dart';
|
||||
export 'src/settings/enums.dart';
|
||||
export 'src/settings/event.dart';
|
||||
export 'src/settings/keys.dart';
|
||||
export 'src/settings/store.dart';
|
||||
export 'src/source/album.dart';
|
||||
export 'src/source/enums.dart';
|
||||
export 'src/source/vault.dart';
|
||||
|
|
105
plugins/aves_model/lib/src/settings/access.dart
Normal file
105
plugins/aves_model/lib/src/settings/access.dart
Normal file
|
@ -0,0 +1,105 @@
|
|||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
mixin SettingsAccess {
|
||||
bool get initialized;
|
||||
|
||||
SettingsStore get store;
|
||||
|
||||
Stream<SettingsChangedEvent> get updateStream;
|
||||
|
||||
void notifyKeyChange(String key, dynamic oldValue, dynamic newValue);
|
||||
|
||||
void notifyListeners();
|
||||
|
||||
void set(String key, dynamic newValue) {
|
||||
var oldValue = store.get(key);
|
||||
if (newValue == null) {
|
||||
store.remove(key);
|
||||
} else if (newValue is String) {
|
||||
oldValue = getString(key);
|
||||
store.setString(key, newValue);
|
||||
} else if (newValue is List<String>) {
|
||||
oldValue = getStringList(key);
|
||||
store.setStringList(key, newValue);
|
||||
} else if (newValue is int) {
|
||||
oldValue = getInt(key);
|
||||
store.setInt(key, newValue);
|
||||
} else if (newValue is double) {
|
||||
oldValue = getDouble(key);
|
||||
store.setDouble(key, newValue);
|
||||
} else if (newValue is bool) {
|
||||
oldValue = getBool(key);
|
||||
store.setBool(key, newValue);
|
||||
}
|
||||
if (oldValue != newValue) {
|
||||
notifyKeyChange(key, oldValue, newValue);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
// getters
|
||||
|
||||
bool? getBool(String key) {
|
||||
try {
|
||||
return store.getBool(key);
|
||||
} catch (error) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
int? getInt(String key) {
|
||||
try {
|
||||
return store.getInt(key);
|
||||
} catch (error) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
double? getDouble(String key) {
|
||||
try {
|
||||
return store.getDouble(key);
|
||||
} catch (error) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String? getString(String key) {
|
||||
try {
|
||||
return store.getString(key);
|
||||
} catch (error) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<String>? getStringList(String key) {
|
||||
try {
|
||||
return store.getStringList(key);
|
||||
} catch (error) {
|
||||
// ignore, could be obsolete value of different type
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
T getEnumOrDefault<T>(String key, T defaultValue, Iterable<T> values) {
|
||||
try {
|
||||
final valueString = store.getString(key);
|
||||
for (final v in values) {
|
||||
if (v.toString() == valueString) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// ignore, could be obsolete value of different type
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
List<T> getEnumListOrDefault<T extends Object>(String key, List<T> defaultValue, Iterable<T> values) {
|
||||
return store.getStringList(key)?.map((s) => values.firstWhereOrNull((v) => v.toString() == s)).whereNotNull().toList() ?? defaultValue;
|
||||
}
|
||||
}
|
11
plugins/aves_model/lib/src/settings/event.dart
Normal file
11
plugins/aves_model/lib/src/settings/event.dart
Normal file
|
@ -0,0 +1,11 @@
|
|||
import 'package:meta/meta.dart';
|
||||
|
||||
@immutable
|
||||
class SettingsChangedEvent {
|
||||
final String key;
|
||||
final dynamic oldValue;
|
||||
final dynamic newValue;
|
||||
|
||||
// old and new values as stored, e.g. `List<String>` for collections
|
||||
const SettingsChangedEvent(this.key, this.oldValue, this.newValue);
|
||||
}
|
185
plugins/aves_model/lib/src/settings/keys.dart
Normal file
185
plugins/aves_model/lib/src/settings/keys.dart
Normal file
|
@ -0,0 +1,185 @@
|
|||
class SettingKeys {
|
||||
static bool isInternalKey(String key) => _internalKeys.contains(key) || key.startsWith(_widgetKeyPrefix);
|
||||
|
||||
static const Set<String> _internalKeys = {
|
||||
hasAcceptedTermsKey,
|
||||
catalogTimeZoneRawOffsetMillisKey,
|
||||
searchHistoryKey,
|
||||
platformAccelerometerRotationKey,
|
||||
platformTransitionAnimationScaleKey,
|
||||
topEntryIdsKey,
|
||||
recentDestinationAlbumsKey,
|
||||
recentTagsKey,
|
||||
};
|
||||
|
||||
static const _widgetKeyPrefix = 'widget_';
|
||||
|
||||
// app
|
||||
static const hasAcceptedTermsKey = 'has_accepted_terms';
|
||||
static const canUseAnalysisServiceKey = 'can_use_analysis_service';
|
||||
static const isInstalledAppAccessAllowedKey = 'is_installed_app_access_allowed';
|
||||
static const isErrorReportingAllowedKey = 'is_crashlytics_enabled';
|
||||
static const localeKey = 'locale';
|
||||
static const catalogTimeZoneRawOffsetMillisKey = 'catalog_time_zone_raw_offset_millis';
|
||||
static const tileExtentPrefixKey = 'tile_extent_';
|
||||
static const tileLayoutPrefixKey = 'tile_layout_';
|
||||
static const entryRenamingPatternKey = 'entry_renaming_pattern';
|
||||
static const topEntryIdsKey = 'top_entry_ids';
|
||||
static const recentDestinationAlbumsKey = 'recent_destination_albums';
|
||||
static const recentTagsKey = 'recent_tags';
|
||||
|
||||
// display
|
||||
static const displayRefreshRateModeKey = 'display_refresh_rate_mode';
|
||||
static const themeBrightnessKey = 'theme_brightness';
|
||||
static const themeColorModeKey = 'theme_color_mode';
|
||||
static const enableDynamicColorKey = 'dynamic_color';
|
||||
static const enableBlurEffectKey = 'enable_overlay_blur_effect';
|
||||
static const maxBrightnessKey = 'max_brightness';
|
||||
static const forceTvLayoutKey = 'force_tv_layout';
|
||||
|
||||
// navigation
|
||||
static const mustBackTwiceToExitKey = 'must_back_twice_to_exit';
|
||||
static const keepScreenOnKey = 'keep_screen_on';
|
||||
static const homePageKey = 'home_page';
|
||||
static const enableBottomNavigationBarKey = 'show_bottom_navigation_bar';
|
||||
static const confirmCreateVaultKey = 'confirm_create_vault';
|
||||
static const confirmDeleteForeverKey = 'confirm_delete_forever';
|
||||
static const confirmMoveToBinKey = 'confirm_move_to_bin';
|
||||
static const confirmMoveUndatedItemsKey = 'confirm_move_undated_items';
|
||||
static const confirmAfterMoveToBinKey = 'confirm_after_move_to_bin';
|
||||
static const setMetadataDateBeforeFileOpKey = 'set_metadata_date_before_file_op';
|
||||
static const drawerTypeBookmarksKey = 'drawer_type_bookmarks';
|
||||
static const drawerAlbumBookmarksKey = 'drawer_album_bookmarks';
|
||||
static const drawerPageBookmarksKey = 'drawer_page_bookmarks';
|
||||
|
||||
// collection
|
||||
static const collectionBurstPatternsKey = 'collection_burst_patterns';
|
||||
static const collectionGroupFactorKey = 'collection_group_factor';
|
||||
static const collectionSortFactorKey = 'collection_sort_factor';
|
||||
static const collectionSortReverseKey = 'collection_sort_reverse';
|
||||
static const collectionBrowsingQuickActionsKey = 'collection_browsing_quick_actions';
|
||||
static const collectionSelectionQuickActionsKey = 'collection_selection_quick_actions';
|
||||
static const showThumbnailFavouriteKey = 'show_thumbnail_favourite';
|
||||
static const thumbnailLocationIconKey = 'thumbnail_location_icon';
|
||||
static const thumbnailTagIconKey = 'thumbnail_tag_icon';
|
||||
static const showThumbnailMotionPhotoKey = 'show_thumbnail_motion_photo';
|
||||
static const showThumbnailRatingKey = 'show_thumbnail_rating';
|
||||
static const showThumbnailRawKey = 'show_thumbnail_raw';
|
||||
static const showThumbnailVideoDurationKey = 'show_thumbnail_video_duration';
|
||||
|
||||
// filter grids
|
||||
static const albumGroupFactorKey = 'album_group_factor';
|
||||
static const albumSortFactorKey = 'album_sort_factor';
|
||||
static const countrySortFactorKey = 'country_sort_factor';
|
||||
static const stateSortFactorKey = 'state_sort_factor';
|
||||
static const placeSortFactorKey = 'place_sort_factor';
|
||||
static const tagSortFactorKey = 'tag_sort_factor';
|
||||
static const albumSortReverseKey = 'album_sort_reverse';
|
||||
static const countrySortReverseKey = 'country_sort_reverse';
|
||||
static const stateSortReverseKey = 'state_sort_reverse';
|
||||
static const placeSortReverseKey = 'place_sort_reverse';
|
||||
static const tagSortReverseKey = 'tag_sort_reverse';
|
||||
static const pinnedFiltersKey = 'pinned_filters';
|
||||
static const hiddenFiltersKey = 'hidden_filters';
|
||||
static const showAlbumPickQueryKey = 'show_album_pick_query';
|
||||
|
||||
// viewer
|
||||
static const viewerQuickActionsKey = 'viewer_quick_actions';
|
||||
static const showOverlayOnOpeningKey = 'show_overlay_on_opening';
|
||||
static const showOverlayMinimapKey = 'show_overlay_minimap';
|
||||
static const showOverlayInfoKey = 'show_overlay_info';
|
||||
static const showOverlayDescriptionKey = 'show_overlay_description';
|
||||
static const showOverlayRatingTagsKey = 'show_overlay_rating_tags';
|
||||
static const showOverlayShootingDetailsKey = 'show_overlay_shooting_details';
|
||||
static const showOverlayThumbnailPreviewKey = 'show_overlay_thumbnail_preview';
|
||||
static const viewerGestureSideTapNextKey = 'viewer_gesture_side_tap_next';
|
||||
static const viewerUseCutoutKey = 'viewer_use_cutout';
|
||||
static const enableMotionPhotoAutoPlayKey = 'motion_photo_auto_play';
|
||||
static const imageBackgroundKey = 'image_background';
|
||||
|
||||
// video
|
||||
static const enableVideoHardwareAccelerationKey = 'video_hwaccel_mediacodec';
|
||||
static const videoBackgroundModeKey = 'video_background_mode';
|
||||
static const videoAutoPlayModeKey = 'video_auto_play_mode';
|
||||
static const videoLoopModeKey = 'video_loop';
|
||||
static const videoResumptionModeKey = 'video_resumption_mode';
|
||||
static const videoControlsKey = 'video_controls';
|
||||
static const videoGestureDoubleTapTogglePlayKey = 'video_gesture_double_tap_toggle_play';
|
||||
static const videoGestureSideDoubleTapSeekKey = 'video_gesture_side_double_tap_skip';
|
||||
static const videoGestureVerticalDragBrightnessVolumeKey = 'video_gesture_vertical_drag_brightness_volume';
|
||||
|
||||
// subtitles
|
||||
static const subtitleFontSizeKey = 'subtitle_font_size';
|
||||
static const subtitleTextAlignmentKey = 'subtitle_text_alignment';
|
||||
static const subtitleTextPositionKey = 'subtitle_text_position';
|
||||
static const subtitleShowOutlineKey = 'subtitle_show_outline';
|
||||
static const subtitleTextColorKey = 'subtitle_text_color';
|
||||
static const subtitleBackgroundColorKey = 'subtitle_background_color';
|
||||
|
||||
// info
|
||||
static const infoMapZoomKey = 'info_map_zoom';
|
||||
static const coordinateFormatKey = 'coordinates_format';
|
||||
static const unitSystemKey = 'unit_system';
|
||||
|
||||
// tag editor
|
||||
|
||||
static const tagEditorCurrentFilterSectionExpandedKey = 'tag_editor_current_filter_section_expanded';
|
||||
static const tagEditorExpandedSectionKey = 'tag_editor_expanded_section';
|
||||
|
||||
// converter
|
||||
|
||||
static const convertMimeTypeKey = 'convert_mime_type';
|
||||
static const convertQualityKey = 'convert_quality';
|
||||
static const convertWriteMetadataKey = 'convert_write_metadata';
|
||||
|
||||
// map
|
||||
static const mapStyleKey = 'info_map_style';
|
||||
static const mapDefaultCenterKey = 'map_default_center';
|
||||
|
||||
// search
|
||||
static const saveSearchHistoryKey = 'save_search_history';
|
||||
static const searchHistoryKey = 'search_history';
|
||||
|
||||
// bin
|
||||
static const enableBinKey = 'enable_bin';
|
||||
|
||||
// accessibility
|
||||
static const showPinchGestureAlternativesKey = 'show_pinch_gesture_alternatives';
|
||||
static const accessibilityAnimationsKey = 'accessibility_animations';
|
||||
static const timeToTakeActionKey = 'time_to_take_action';
|
||||
|
||||
// file picker
|
||||
static const filePickerShowHiddenFilesKey = 'file_picker_show_hidden_files';
|
||||
|
||||
// screen saver
|
||||
static const screenSaverFillScreenKey = 'screen_saver_fill_screen';
|
||||
static const screenSaverAnimatedZoomEffectKey = 'screen_saver_animated_zoom_effect';
|
||||
static const screenSaverTransitionKey = 'screen_saver_transition';
|
||||
static const screenSaverVideoPlaybackKey = 'screen_saver_video_playback';
|
||||
static const screenSaverIntervalKey = 'screen_saver_interval';
|
||||
static const screenSaverCollectionFiltersKey = 'screen_saver_collection_filters';
|
||||
|
||||
// slideshow
|
||||
static const slideshowRepeatKey = 'slideshow_loop';
|
||||
static const slideshowShuffleKey = 'slideshow_shuffle';
|
||||
static const slideshowFillScreenKey = 'slideshow_fill_screen';
|
||||
static const slideshowAnimatedZoomEffectKey = 'slideshow_animated_zoom_effect';
|
||||
static const slideshowTransitionKey = 'slideshow_transition';
|
||||
static const slideshowVideoPlaybackKey = 'slideshow_video_playback';
|
||||
static const slideshowIntervalKey = 'slideshow_interval';
|
||||
|
||||
// widget
|
||||
static const widgetOutlinePrefixKey = '${_widgetKeyPrefix}outline_';
|
||||
static const widgetShapePrefixKey = '${_widgetKeyPrefix}shape_';
|
||||
static const widgetCollectionFiltersPrefixKey = '${_widgetKeyPrefix}collection_filters_';
|
||||
static const widgetOpenPagePrefixKey = '${_widgetKeyPrefix}open_page_';
|
||||
static const widgetDisplayedItemPrefixKey = '${_widgetKeyPrefix}displayed_item_';
|
||||
static const widgetUriPrefixKey = '${_widgetKeyPrefix}uri_';
|
||||
|
||||
// platform settings
|
||||
// cf Android `Settings.System.ACCELEROMETER_ROTATION`
|
||||
static const platformAccelerometerRotationKey = 'accelerometer_rotation';
|
||||
|
||||
// cf Android `Settings.Global.TRANSITION_ANIMATION_SCALE`
|
||||
static const platformTransitionAnimationScaleKey = 'transition_animation_scale';
|
||||
}
|
|
@ -10,7 +10,7 @@ packages:
|
|||
source: hosted
|
||||
version: "1.3.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||
|
|
|
@ -8,6 +8,7 @@ environment:
|
|||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
collection:
|
||||
equatable:
|
||||
meta:
|
||||
|
||||
|
|
|
@ -188,10 +188,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: google_maps_flutter
|
||||
sha256: "7b417a64ee7a060f42cf44d8c274d3b562423f6fe57d2911b7b536857c0d8eb6"
|
||||
sha256: "7e35644d8a88ad86409976db8fa23ddc7d933f8239e57405e4660534be09acd2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
version: "2.3.1"
|
||||
google_maps_flutter_android:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -441,10 +441,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "7dacfda1edcca378031db9905ad7d7bd56b29fd1a90b0908b71a52a12c41e36b"
|
||||
sha256: "1414f27dd781737e51afa9711f2ac2ace6ab4498ee98e20863fa5505aa00c58c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.3"
|
||||
version: "5.0.4"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
library aves_utils;
|
||||
|
||||
export 'src/change_notifier.dart';
|
||||
export 'src/colors.dart';
|
||||
export 'src/optional_event_channel.dart';
|
||||
export 'src/vector_utils.dart';
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
library aves_video;
|
||||
|
||||
export 'src/controller.dart';
|
||||
export 'src/settings/subtitles.dart';
|
||||
export 'src/settings/video.dart';
|
||||
export 'src/stream.dart';
|
||||
export 'src/video_loop_mode.dart';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_video/src/settings/video.dart';
|
||||
import 'package:aves_video/src/stream.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
@ -8,12 +9,17 @@ import 'package:flutter/widgets.dart';
|
|||
abstract class AvesVideoController {
|
||||
final AvesEntryBase _entry;
|
||||
final PlaybackStateHandler playbackStateHandler;
|
||||
final VideoSettings settings;
|
||||
|
||||
AvesEntryBase get entry => _entry;
|
||||
|
||||
static const resumeTimeSaveMinDuration = Duration(minutes: 2);
|
||||
|
||||
AvesVideoController(AvesEntryBase entry, {required this.playbackStateHandler}) : _entry = entry {
|
||||
AvesVideoController(
|
||||
AvesEntryBase entry, {
|
||||
required this.playbackStateHandler,
|
||||
required this.settings,
|
||||
}) : _entry = entry {
|
||||
entry.visualChangeNotifier.addListener(onVisualChanged);
|
||||
}
|
||||
|
||||
|
|
26
plugins/aves_video/lib/src/settings/defaults.dart
Normal file
26
plugins/aves_video/lib/src/settings/defaults.dart
Normal file
|
@ -0,0 +1,26 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
|
||||
class SettingsDefaults {
|
||||
// video
|
||||
static const enableVideoHardwareAcceleration = true;
|
||||
static const videoAutoPlayMode = VideoAutoPlayMode.disabled;
|
||||
static const videoBackgroundMode = VideoBackgroundMode.disabled;
|
||||
static const videoLoopMode = VideoLoopMode.shortOnly;
|
||||
static const videoResumptionMode = VideoResumptionMode.ask;
|
||||
static const videoShowRawTimedText = false;
|
||||
static const videoControls = VideoControls.play;
|
||||
static const videoGestureDoubleTapTogglePlay = false;
|
||||
static const videoGestureSideDoubleTapSeek = true;
|
||||
static const videoGestureVerticalDragBrightnessVolume = false;
|
||||
|
||||
// subtitles
|
||||
static const subtitleFontSize = 20.0;
|
||||
static const subtitleTextAlignment = TextAlign.center;
|
||||
static const subtitleTextPosition = SubtitlePosition.bottom;
|
||||
static const subtitleShowOutline = true;
|
||||
static const subtitleTextColor = Color(0xFFFFFFFF);
|
||||
static const subtitleBackgroundColor = ColorUtils.transparentBlack;
|
||||
}
|
30
plugins/aves_video/lib/src/settings/subtitles.dart
Normal file
30
plugins/aves_video/lib/src/settings/subtitles.dart
Normal file
|
@ -0,0 +1,30 @@
|
|||
import 'dart:ui';
|
||||
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_video/src/settings/defaults.dart';
|
||||
|
||||
mixin SubtitlesSettings on SettingsAccess {
|
||||
double get subtitleFontSize => getDouble(SettingKeys.subtitleFontSizeKey) ?? SettingsDefaults.subtitleFontSize;
|
||||
|
||||
set subtitleFontSize(double newValue) => set(SettingKeys.subtitleFontSizeKey, newValue);
|
||||
|
||||
TextAlign get subtitleTextAlignment => getEnumOrDefault(SettingKeys.subtitleTextAlignmentKey, SettingsDefaults.subtitleTextAlignment, TextAlign.values);
|
||||
|
||||
set subtitleTextAlignment(TextAlign newValue) => set(SettingKeys.subtitleTextAlignmentKey, newValue.toString());
|
||||
|
||||
SubtitlePosition get subtitleTextPosition => getEnumOrDefault(SettingKeys.subtitleTextPositionKey, SettingsDefaults.subtitleTextPosition, SubtitlePosition.values);
|
||||
|
||||
set subtitleTextPosition(SubtitlePosition newValue) => set(SettingKeys.subtitleTextPositionKey, newValue.toString());
|
||||
|
||||
bool get subtitleShowOutline => getBool(SettingKeys.subtitleShowOutlineKey) ?? SettingsDefaults.subtitleShowOutline;
|
||||
|
||||
set subtitleShowOutline(bool newValue) => set(SettingKeys.subtitleShowOutlineKey, newValue);
|
||||
|
||||
Color get subtitleTextColor => Color(getInt(SettingKeys.subtitleTextColorKey) ?? SettingsDefaults.subtitleTextColor.value);
|
||||
|
||||
set subtitleTextColor(Color newValue) => set(SettingKeys.subtitleTextColorKey, newValue.value);
|
||||
|
||||
Color get subtitleBackgroundColor => Color(getInt(SettingKeys.subtitleBackgroundColorKey) ?? SettingsDefaults.subtitleBackgroundColor.value);
|
||||
|
||||
set subtitleBackgroundColor(Color newValue) => set(SettingKeys.subtitleBackgroundColorKey, newValue.value);
|
||||
}
|
40
plugins/aves_video/lib/src/settings/video.dart
Normal file
40
plugins/aves_video/lib/src/settings/video.dart
Normal file
|
@ -0,0 +1,40 @@
|
|||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_video/src/settings/defaults.dart';
|
||||
|
||||
mixin VideoSettings on SettingsAccess {
|
||||
bool get enableVideoHardwareAcceleration => getBool(SettingKeys.enableVideoHardwareAccelerationKey) ?? SettingsDefaults.enableVideoHardwareAcceleration;
|
||||
|
||||
set enableVideoHardwareAcceleration(bool newValue) => set(SettingKeys.enableVideoHardwareAccelerationKey, newValue);
|
||||
|
||||
VideoAutoPlayMode get videoAutoPlayMode => getEnumOrDefault(SettingKeys.videoAutoPlayModeKey, SettingsDefaults.videoAutoPlayMode, VideoAutoPlayMode.values);
|
||||
|
||||
set videoAutoPlayMode(VideoAutoPlayMode newValue) => set(SettingKeys.videoAutoPlayModeKey, newValue.toString());
|
||||
|
||||
VideoBackgroundMode get videoBackgroundMode => getEnumOrDefault(SettingKeys.videoBackgroundModeKey, SettingsDefaults.videoBackgroundMode, VideoBackgroundMode.values);
|
||||
|
||||
set videoBackgroundMode(VideoBackgroundMode newValue) => set(SettingKeys.videoBackgroundModeKey, newValue.toString());
|
||||
|
||||
VideoLoopMode get videoLoopMode => getEnumOrDefault(SettingKeys.videoLoopModeKey, SettingsDefaults.videoLoopMode, VideoLoopMode.values);
|
||||
|
||||
set videoLoopMode(VideoLoopMode newValue) => set(SettingKeys.videoLoopModeKey, newValue.toString());
|
||||
|
||||
VideoResumptionMode get videoResumptionMode => getEnumOrDefault(SettingKeys.videoResumptionModeKey, SettingsDefaults.videoResumptionMode, VideoResumptionMode.values);
|
||||
|
||||
set videoResumptionMode(VideoResumptionMode newValue) => set(SettingKeys.videoResumptionModeKey, newValue.toString());
|
||||
|
||||
VideoControls get videoControls => getEnumOrDefault(SettingKeys.videoControlsKey, SettingsDefaults.videoControls, VideoControls.values);
|
||||
|
||||
set videoControls(VideoControls newValue) => set(SettingKeys.videoControlsKey, newValue.toString());
|
||||
|
||||
bool get videoGestureDoubleTapTogglePlay => getBool(SettingKeys.videoGestureDoubleTapTogglePlayKey) ?? SettingsDefaults.videoGestureDoubleTapTogglePlay;
|
||||
|
||||
set videoGestureDoubleTapTogglePlay(bool newValue) => set(SettingKeys.videoGestureDoubleTapTogglePlayKey, newValue);
|
||||
|
||||
bool get videoGestureSideDoubleTapSeek => getBool(SettingKeys.videoGestureSideDoubleTapSeekKey) ?? SettingsDefaults.videoGestureSideDoubleTapSeek;
|
||||
|
||||
set videoGestureSideDoubleTapSeek(bool newValue) => set(SettingKeys.videoGestureSideDoubleTapSeekKey, newValue);
|
||||
|
||||
bool get videoGestureVerticalDragBrightnessVolume => getBool(SettingKeys.videoGestureVerticalDragBrightnessVolumeKey) ?? SettingsDefaults.videoGestureVerticalDragBrightnessVolume;
|
||||
|
||||
set videoGestureVerticalDragBrightnessVolume(bool newValue) => set(SettingKeys.videoGestureVerticalDragBrightnessVolumeKey, newValue);
|
||||
}
|
|
@ -8,6 +8,13 @@ packages:
|
|||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
aves_utils:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../aves_utils"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -10,6 +10,8 @@ dependencies:
|
|||
sdk: flutter
|
||||
aves_model:
|
||||
path: ../aves_model
|
||||
aves_utils:
|
||||
path: ../aves_utils
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints:
|
||||
|
|
30
plugins/aves_video_ijk/.gitignore
vendored
Normal file
30
plugins/aves_video_ijk/.gitignore
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# The .vscode folder contains launch configuration and tasks you configure in
|
||||
# VS Code which you may wish to be included in version control, so this line
|
||||
# is commented out by default.
|
||||
#.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||
#/pubspec.lock
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.packages
|
||||
build/
|
10
plugins/aves_video_ijk/.metadata
Normal file
10
plugins/aves_video_ijk/.metadata
Normal file
|
@ -0,0 +1,10 @@
|
|||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: 796c8ef79279f9c774545b3771238c3098dbefab
|
||||
channel: stable
|
||||
|
||||
project_type: package
|
1
plugins/aves_video_ijk/analysis_options.yaml
Normal file
1
plugins/aves_video_ijk/analysis_options.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
include: ../../analysis_options.yaml
|
3
plugins/aves_video_ijk/lib/aves_video_ijk.dart
Normal file
3
plugins/aves_video_ijk/lib/aves_video_ijk.dart
Normal file
|
@ -0,0 +1,3 @@
|
|||
library aves_video_ijk;
|
||||
|
||||
export 'src/controller.dart';
|
|
@ -1,7 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:aves/model/settings/enums/video_loop_mode.dart';
|
||||
import 'package:aves/model/settings/settings.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
import 'package:aves_video/aves_video.dart';
|
||||
|
@ -11,6 +9,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
|
||||
class IjkPlayerAvesVideoController extends AvesVideoController {
|
||||
static bool _initializedFijkLog = false;
|
||||
|
||||
final EventChannel _eventChannel = const OptionalEventChannel('befovy.com/fijk/event');
|
||||
|
||||
late FijkPlayer _instance;
|
||||
|
@ -61,7 +61,12 @@ class IjkPlayerAvesVideoController extends AvesVideoController {
|
|||
IjkPlayerAvesVideoController(
|
||||
super.entry, {
|
||||
required super.playbackStateHandler,
|
||||
required super.settings,
|
||||
}) {
|
||||
if (!_initializedFijkLog) {
|
||||
_initializedFijkLog = true;
|
||||
FijkLog.setLevel(FijkLogLevel.Warn);
|
||||
}
|
||||
_instance = FijkPlayer();
|
||||
_valueStream.map((value) => value.videoRenderStart).firstWhere((v) => v, orElse: () => false).then(
|
||||
(started) {
|
||||
|
@ -96,8 +101,8 @@ class IjkPlayerAvesVideoController extends AvesVideoController {
|
|||
_subscriptions.add(_instance.onTimedText.listen(_timedTextStreamController.add));
|
||||
_subscriptions.add(settings.updateStream
|
||||
.where((event) => {
|
||||
Settings.enableVideoHardwareAccelerationKey,
|
||||
Settings.videoLoopModeKey,
|
||||
SettingKeys.enableVideoHardwareAccelerationKey,
|
||||
SettingKeys.videoLoopModeKey,
|
||||
}.contains(event.key))
|
||||
.listen((_) => _instance.reset()));
|
||||
}
|
117
plugins/aves_video_ijk/pubspec.lock
Normal file
117
plugins/aves_video_ijk/pubspec.lock
Normal file
|
@ -0,0 +1,117 @@
|
|||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
aves_model:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../aves_model"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
aves_utils:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../aves_utils"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
aves_video:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../aves_video"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: characters
|
||||
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: collection
|
||||
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.17.1"
|
||||
equatable:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: equatable
|
||||
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.5"
|
||||
fijkplayer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: aves
|
||||
resolved-ref: "935a2d86ebf45fbdbaf8b4a0921d5eaea87410d6"
|
||||
url: "https://github.com/deckerst/fijkplayer.git"
|
||||
source: git
|
||||
version: "0.10.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
sha256: aeb0b80a8b3709709c9cc496cdc027c5b3216796bc0af0ce1007eaf24464fd4c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_math
|
||||
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
sdks:
|
||||
dart: ">=3.0.0 <4.0.0"
|
26
plugins/aves_video_ijk/pubspec.yaml
Normal file
26
plugins/aves_video_ijk/pubspec.yaml
Normal file
|
@ -0,0 +1,26 @@
|
|||
name: aves_video_ijk
|
||||
version: 0.0.1
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
aves_model:
|
||||
path: ../aves_model
|
||||
aves_video:
|
||||
path: ../aves_video
|
||||
aves_utils:
|
||||
path: ../aves_utils
|
||||
collection:
|
||||
fijkplayer:
|
||||
git:
|
||||
url: https://github.com/deckerst/fijkplayer.git
|
||||
ref: aves
|
||||
|
||||
dev_dependencies:
|
||||
flutter_lints:
|
||||
|
||||
flutter:
|
23
pubspec.lock
23
pubspec.lock
|
@ -126,6 +126,13 @@ packages:
|
|||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
aves_video_ijk:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "plugins/aves_video_ijk"
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
barcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -590,10 +597,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: google_maps_flutter
|
||||
sha256: "7b417a64ee7a060f42cf44d8c274d3b562423f6fe57d2911b7b536857c0d8eb6"
|
||||
sha256: "7e35644d8a88ad86409976db8fa23ddc7d933f8239e57405e4660534be09acd2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
version: "2.3.1"
|
||||
google_maps_flutter_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1454,10 +1461,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51
|
||||
sha256: "15f5acbf0dce90146a0f5a2c4a002b1814a6303c4c5c075aa2623b2d16156f03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.35"
|
||||
version: "6.0.36"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1486,10 +1493,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370"
|
||||
sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
version: "2.1.3"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1566,10 +1573,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "7dacfda1edcca378031db9905ad7d7bd56b29fd1a90b0908b71a52a12c41e36b"
|
||||
sha256: "1414f27dd781737e51afa9711f2ac2ace6ab4498ee98e20863fa5505aa00c58c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.3"
|
||||
version: "5.0.4"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -40,6 +40,8 @@ dependencies:
|
|||
path: plugins/aves_services_google
|
||||
aves_video:
|
||||
path: plugins/aves_video
|
||||
aves_video_ijk:
|
||||
path: plugins/aves_video_ijk
|
||||
aves_ui:
|
||||
path: plugins/aves_ui
|
||||
aves_utils:
|
||||
|
|
Loading…
Reference in a new issue