prep
This commit is contained in:
parent
1bfbaca794
commit
6b392f84cc
5 changed files with 104 additions and 239 deletions
|
@ -34,6 +34,7 @@ class AboutTranslators extends StatelessWidget {
|
|||
Contributor('Igor Sorocean', 'sorocean.igor@gmail.com'),
|
||||
Contributor('JY3', 'GeeyunJY3@gmail.com'),
|
||||
Contributor('Gediminas Murauskas', 'muziejusinfo@gmail.com'),
|
||||
Contributor('Oğuz Ersen', 'oguz@ersen.moe'),
|
||||
// Contributor('Allan Nordhøy', 'epost@anotheragency.no'),
|
||||
// Contributor('Piotr K', '1337.kelt@gmail.com'),
|
||||
// Contributor('امیر جهانگرد', 'ijahangard.a@gmail.com'),
|
||||
|
|
|
@ -5,8 +5,8 @@ import 'package:aves/utils/constants.dart';
|
|||
import 'package:aves/widgets/common/identity/aves_filter_chip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ExpandableFilterRow extends StatelessWidget {
|
||||
final String? title;
|
||||
class TitledExpandableFilterRow extends StatelessWidget {
|
||||
final String title;
|
||||
final Iterable<CollectionFilter> filters;
|
||||
final ValueNotifier<String?> expandedNotifier;
|
||||
final bool showGenericIcon;
|
||||
|
@ -14,9 +14,9 @@ class ExpandableFilterRow extends StatelessWidget {
|
|||
final FilterCallback onTap;
|
||||
final OffsetFilterCallback? onLongPress;
|
||||
|
||||
const ExpandableFilterRow({
|
||||
const TitledExpandableFilterRow({
|
||||
super.key,
|
||||
this.title,
|
||||
required this.title,
|
||||
required this.filters,
|
||||
required this.expandedNotifier,
|
||||
this.showGenericIcon = true,
|
||||
|
@ -25,25 +25,21 @@ class ExpandableFilterRow extends StatelessWidget {
|
|||
required this.onLongPress,
|
||||
});
|
||||
|
||||
static const double horizontalPadding = 8;
|
||||
static const double verticalPadding = 8;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (filters.isEmpty) return const SizedBox();
|
||||
|
||||
final hasTitle = title != null && title!.isNotEmpty;
|
||||
final isExpanded = expandedNotifier.value == title;
|
||||
|
||||
final isExpanded = hasTitle && expandedNotifier.value == title;
|
||||
|
||||
Widget? titleRow;
|
||||
if (hasTitle) {
|
||||
titleRow = Padding(
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
title!,
|
||||
title,
|
||||
style: Constants.knownTitleTextStyle,
|
||||
),
|
||||
const Spacer(),
|
||||
|
@ -54,12 +50,60 @@ class ExpandableFilterRow extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
ExpandableFilterRow(
|
||||
filters: filters,
|
||||
isExpanded: isExpanded,
|
||||
showGenericIcon: showGenericIcon,
|
||||
heroTypeBuilder: heroTypeBuilder,
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ExpandableFilterRow extends StatelessWidget {
|
||||
final Iterable<CollectionFilter> filters;
|
||||
final bool isExpanded;
|
||||
final bool showGenericIcon;
|
||||
final HeroType Function(CollectionFilter filter)? heroTypeBuilder;
|
||||
final FilterCallback onTap;
|
||||
final OffsetFilterCallback? onLongPress;
|
||||
|
||||
static const double horizontalPadding = 8;
|
||||
static const double verticalPadding = 8;
|
||||
|
||||
const ExpandableFilterRow({
|
||||
super.key,
|
||||
required this.filters,
|
||||
required this.isExpanded,
|
||||
this.showGenericIcon = true,
|
||||
this.heroTypeBuilder,
|
||||
required this.onTap,
|
||||
required this.onLongPress,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (filters.isEmpty) return const SizedBox();
|
||||
return AnimatedSwitcher(
|
||||
duration: Durations.filterRowExpandAnimation,
|
||||
layoutBuilder: (currentChild, previousChildren) => Stack(
|
||||
children: [
|
||||
...previousChildren,
|
||||
if (currentChild != null) currentChild,
|
||||
],
|
||||
),
|
||||
child: isExpanded ? _buildExpanded() : _buildCollapsed(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildExpanded() {
|
||||
final filterList = filters.toList();
|
||||
final wrap = Container(
|
||||
key: Key('wrap$title'),
|
||||
return Container(
|
||||
key: const Key('wrap'),
|
||||
padding: const EdgeInsets.symmetric(horizontal: horizontalPadding),
|
||||
// specify transparent as a workaround to prevent
|
||||
// chip border clipping when the floating app bar is fading
|
||||
|
@ -67,11 +111,15 @@ class ExpandableFilterRow extends StatelessWidget {
|
|||
child: Wrap(
|
||||
spacing: horizontalPadding,
|
||||
runSpacing: verticalPadding,
|
||||
children: filterList.map(_buildFilterChip).toList(),
|
||||
children: filterList.map(_buildChip).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCollapsed() {
|
||||
final filterList = filters.toList();
|
||||
final list = Container(
|
||||
key: Key('list$title'),
|
||||
key: const Key('list'),
|
||||
// specify transparent as a workaround to prevent
|
||||
// chip border clipping when the floating app bar is fading
|
||||
color: Colors.transparent,
|
||||
|
@ -80,34 +128,16 @@ class ExpandableFilterRow extends StatelessWidget {
|
|||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.symmetric(horizontal: horizontalPadding),
|
||||
itemBuilder: (context, index) {
|
||||
return index < filterList.length ? _buildFilterChip(filterList[index]) : const SizedBox();
|
||||
return index < filterList.length ? _buildChip(filterList[index]) : const SizedBox();
|
||||
},
|
||||
separatorBuilder: (context, index) => const SizedBox(width: 8),
|
||||
itemCount: filterList.length,
|
||||
),
|
||||
);
|
||||
final filterChips = isExpanded ? wrap : list;
|
||||
return titleRow != null
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
titleRow,
|
||||
AnimatedSwitcher(
|
||||
duration: Durations.filterRowExpandAnimation,
|
||||
layoutBuilder: (currentChild, previousChildren) => Stack(
|
||||
children: [
|
||||
...previousChildren,
|
||||
if (currentChild != null) currentChild,
|
||||
],
|
||||
),
|
||||
child: filterChips,
|
||||
),
|
||||
],
|
||||
)
|
||||
: filterChips;
|
||||
return list;
|
||||
}
|
||||
|
||||
Widget _buildFilterChip(CollectionFilter filter) {
|
||||
Widget _buildChip(CollectionFilter filter) {
|
||||
return AvesFilterChip(
|
||||
// key `album-{path}` is expected by test driver
|
||||
key: Key(filter.key),
|
||||
|
|
|
@ -245,7 +245,7 @@ class _FilterRow extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return filters.isEmpty
|
||||
? const SizedBox()
|
||||
: ExpandableFilterRow(
|
||||
: TitledExpandableFilterRow(
|
||||
title: title,
|
||||
filters: filters,
|
||||
expandedNotifier: expandedNotifier,
|
||||
|
|
|
@ -132,13 +132,23 @@ class CollectionSearchDelegate extends AvesSearchDelegate {
|
|||
required List<CollectionFilter> filters,
|
||||
HeroType Function(CollectionFilter filter)? heroTypeBuilder,
|
||||
}) {
|
||||
return ExpandableFilterRow(
|
||||
void onTap(filter) => _select(context, filter is QueryFilter ? QueryFilter(filter.query) : filter);
|
||||
const onLongPress = AvesFilterChip.showDefaultLongPressMenu;
|
||||
return title != null
|
||||
? TitledExpandableFilterRow(
|
||||
title: title,
|
||||
filters: filters,
|
||||
expandedNotifier: _expandedSectionNotifier,
|
||||
heroTypeBuilder: heroTypeBuilder,
|
||||
onTap: (filter) => _select(context, filter is QueryFilter ? QueryFilter(filter.query) : filter),
|
||||
onLongPress: AvesFilterChip.showDefaultLongPressMenu,
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
)
|
||||
: ExpandableFilterRow(
|
||||
filters: filters,
|
||||
isExpanded: false,
|
||||
heroTypeBuilder: heroTypeBuilder,
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -593,20 +593,6 @@
|
|||
"filePickerUseThisFolder"
|
||||
],
|
||||
|
||||
"de": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"subtitlePositionTop",
|
||||
"subtitlePositionBottom",
|
||||
"widgetDisplayedItemRandom",
|
||||
"widgetDisplayedItemMostRecent",
|
||||
"settingsViewerShowRatingTags",
|
||||
"settingsSubtitleThemeTextPositionTile",
|
||||
"settingsSubtitleThemeTextPositionDialogTitle",
|
||||
"settingsWidgetDisplayedItem"
|
||||
],
|
||||
|
||||
"el": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
|
@ -614,13 +600,6 @@
|
|||
"settingsViewerShowRatingTags"
|
||||
],
|
||||
|
||||
"es": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"settingsViewerShowRatingTags"
|
||||
],
|
||||
|
||||
"fa": [
|
||||
"appName",
|
||||
"welcomeMessage",
|
||||
|
@ -1215,13 +1194,6 @@
|
|||
"filePickerUseThisFolder"
|
||||
],
|
||||
|
||||
"fr": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"settingsViewerShowRatingTags"
|
||||
],
|
||||
|
||||
"gl": [
|
||||
"entryInfoActionExportMetadata",
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
|
@ -1721,145 +1693,6 @@
|
|||
"settingsWidgetDisplayedItem"
|
||||
],
|
||||
|
||||
"ko": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"settingsViewerShowRatingTags"
|
||||
],
|
||||
|
||||
"lt": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"settingsViewerShowRatingTags"
|
||||
],
|
||||
|
||||
"nb": [
|
||||
"videoActionCaptureFrame",
|
||||
"videoActionSelectStreams",
|
||||
"entryInfoActionEditLocation",
|
||||
"entryInfoActionExportMetadata",
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"coordinateFormatDms",
|
||||
"mapStyleHuaweiNormal",
|
||||
"mapStyleHuaweiTerrain",
|
||||
"mapStyleStamenToner",
|
||||
"mapStyleStamenWatercolor",
|
||||
"keepScreenOnViewerOnly",
|
||||
"subtitlePositionTop",
|
||||
"subtitlePositionBottom",
|
||||
"viewerTransitionFade",
|
||||
"widgetDisplayedItemRandom",
|
||||
"widgetDisplayedItemMostRecent",
|
||||
"albumTierSpecial",
|
||||
"storageAccessDialogMessage",
|
||||
"restrictedAccessDialogMessage",
|
||||
"notEnoughSpaceDialogMessage",
|
||||
"missingSystemFilePickerDialogMessage",
|
||||
"unsupportedTypeDialogMessage",
|
||||
"binEntriesConfirmationDialogMessage",
|
||||
"deleteEntriesConfirmationDialogMessage",
|
||||
"moveUndatedConfirmationDialogMessage",
|
||||
"setCoverDialogLatest",
|
||||
"hideFilterConfirmationDialogMessage",
|
||||
"deleteSingleAlbumConfirmationDialogMessage",
|
||||
"deleteMultiAlbumConfirmationDialogMessage",
|
||||
"editEntryDateDialogExtractFromTitle",
|
||||
"editEntryDateDialogShift",
|
||||
"editEntryDateDialogSourceFileModifiedDate",
|
||||
"editEntryLocationDialogTitle",
|
||||
"editEntryLocationDialogSetCustom",
|
||||
"locationPickerUseThisLocationButton",
|
||||
"removeEntryMetadataMotionPhotoXmpWarningDialogMessage",
|
||||
"videoStreamSelectionDialogText",
|
||||
"videoStreamSelectionDialogTrack",
|
||||
"videoStreamSelectionDialogNoSelection",
|
||||
"viewDialogLayoutSectionTitle",
|
||||
"viewDialogReverseSortOrder",
|
||||
"tileLayoutMosaic",
|
||||
"collectionDeleteFailureFeedback",
|
||||
"collectionCopyFailureFeedback",
|
||||
"collectionMoveFailureFeedback",
|
||||
"collectionRenameFailureFeedback",
|
||||
"collectionEditFailureFeedback",
|
||||
"collectionExportFailureFeedback",
|
||||
"collectionCopySuccessFeedback",
|
||||
"collectionMoveSuccessFeedback",
|
||||
"collectionRenameSuccessFeedback",
|
||||
"collectionEditSuccessFeedback",
|
||||
"collectionSelectSectionTooltip",
|
||||
"collectionDeselectSectionTooltip",
|
||||
"albumGroupTier",
|
||||
"settingsConfirmationBeforeDeleteItems",
|
||||
"settingsConfirmationBeforeMoveToBinItems",
|
||||
"settingsConfirmationBeforeMoveUndatedItems",
|
||||
"settingsConfirmationAfterMoveToBinItems",
|
||||
"settingsNavigationDrawerBanner",
|
||||
"settingsThumbnailOverlayTile",
|
||||
"settingsThumbnailOverlayPageTitle",
|
||||
"settingsThumbnailShowFavouriteIcon",
|
||||
"settingsThumbnailShowTagIcon",
|
||||
"settingsThumbnailShowLocationIcon",
|
||||
"settingsThumbnailShowMotionPhotoIcon",
|
||||
"settingsThumbnailShowRating",
|
||||
"settingsThumbnailShowRawIcon",
|
||||
"settingsThumbnailShowVideoDuration",
|
||||
"settingsCollectionQuickActionsTile",
|
||||
"settingsCollectionQuickActionEditorPageTitle",
|
||||
"settingsCollectionQuickActionTabBrowsing",
|
||||
"settingsCollectionQuickActionTabSelecting",
|
||||
"settingsCollectionBrowsingQuickActionEditorBanner",
|
||||
"settingsCollectionSelectionQuickActionEditorBanner",
|
||||
"settingsViewerSectionTitle",
|
||||
"settingsViewerGestureSideTapNext",
|
||||
"settingsViewerUseCutout",
|
||||
"settingsViewerMaximumBrightness",
|
||||
"settingsMotionPhotoAutoPlay",
|
||||
"settingsImageBackground",
|
||||
"settingsViewerQuickActionEditorBanner",
|
||||
"settingsViewerQuickActionEditorDisplayedButtonsSectionTitle",
|
||||
"settingsViewerQuickActionEditorAvailableButtonsSectionTitle",
|
||||
"settingsViewerQuickActionEmpty",
|
||||
"settingsViewerOverlayTile",
|
||||
"settingsViewerOverlayPageTitle",
|
||||
"settingsViewerShowOverlayOnOpening",
|
||||
"settingsViewerShowRatingTags",
|
||||
"settingsViewerShowShootingDetails",
|
||||
"settingsViewerEnableOverlayBlurEffect",
|
||||
"settingsSlideshowShuffle",
|
||||
"settingsSubtitleThemeSample",
|
||||
"settingsSubtitleThemeTextPositionTile",
|
||||
"settingsSubtitleThemeTextPositionDialogTitle",
|
||||
"settingsAllowInstalledAppAccess",
|
||||
"settingsAllowMediaManagement",
|
||||
"settingsHiddenFiltersBanner",
|
||||
"settingsHiddenFiltersEmpty",
|
||||
"settingsHiddenItemsTabPaths",
|
||||
"settingsHiddenPathsBanner",
|
||||
"addPathTooltip",
|
||||
"settingsStorageAccessTile",
|
||||
"settingsStorageAccessBanner",
|
||||
"settingsStorageAccessEmpty",
|
||||
"settingsTimeToTakeActionTile",
|
||||
"settingsThemeColorHighlights",
|
||||
"settingsDisplayRefreshRateModeTile",
|
||||
"settingsDisplayRefreshRateModeDialogTitle",
|
||||
"settingsWidgetDisplayedItem",
|
||||
"statsWithGps",
|
||||
"viewerErrorDoesNotExist",
|
||||
"mapAttributionStamen",
|
||||
"mapEmptyRegion",
|
||||
"viewerInfoOpenEmbeddedFailureFeedback",
|
||||
"viewerInfoSearchEmpty",
|
||||
"wallpaperUseScrollEffect",
|
||||
"tagEditorSectionPlaceholders",
|
||||
"tagPlaceholderCountry",
|
||||
"tagPlaceholderPlace"
|
||||
],
|
||||
|
||||
"nl": [
|
||||
"entryInfoActionExportMetadata",
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
|
@ -2779,19 +2612,10 @@
|
|||
"filePickerUseThisFolder"
|
||||
],
|
||||
|
||||
"tr": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"settingsViewerShowRatingTags"
|
||||
],
|
||||
|
||||
"zh": [
|
||||
"filterAspectRatioLandscapeLabel",
|
||||
"filterAspectRatioPortraitLabel",
|
||||
"filterNoAddressLabel",
|
||||
"aboutLicensesFlutterPackagesSectionTitle",
|
||||
"aboutLicensesDartPackagesSectionTitle",
|
||||
"settingsViewerShowRatingTags"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue