#245 thumbnail overlay tag icon
This commit is contained in:
parent
39aebf49e2
commit
5b7caa7caf
9 changed files with 85 additions and 23 deletions
|
@ -622,6 +622,7 @@
|
||||||
"settingsThumbnailOverlayTile": "Overlay",
|
"settingsThumbnailOverlayTile": "Overlay",
|
||||||
"settingsThumbnailOverlayTitle": "Overlay",
|
"settingsThumbnailOverlayTitle": "Overlay",
|
||||||
"settingsThumbnailShowFavouriteIcon": "Show favorite icon",
|
"settingsThumbnailShowFavouriteIcon": "Show favorite icon",
|
||||||
|
"settingsThumbnailShowTagIcon": "Show tag icon",
|
||||||
"settingsThumbnailShowLocationIcon": "Show location icon",
|
"settingsThumbnailShowLocationIcon": "Show location icon",
|
||||||
"settingsThumbnailShowMotionPhotoIcon": "Show motion photo icon",
|
"settingsThumbnailShowMotionPhotoIcon": "Show motion photo icon",
|
||||||
"settingsThumbnailShowRating": "Show rating",
|
"settingsThumbnailShowRating": "Show rating",
|
||||||
|
|
|
@ -54,6 +54,7 @@ class SettingsDefaults {
|
||||||
EntrySetAction.delete,
|
EntrySetAction.delete,
|
||||||
];
|
];
|
||||||
static const showThumbnailFavourite = true;
|
static const showThumbnailFavourite = true;
|
||||||
|
static const showThumbnailTag = false;
|
||||||
static const showThumbnailLocation = true;
|
static const showThumbnailLocation = true;
|
||||||
static const showThumbnailMotionPhoto = true;
|
static const showThumbnailMotionPhoto = true;
|
||||||
static const showThumbnailRating = true;
|
static const showThumbnailRating = true;
|
||||||
|
|
|
@ -71,6 +71,7 @@ class Settings extends ChangeNotifier {
|
||||||
static const collectionBrowsingQuickActionsKey = 'collection_browsing_quick_actions';
|
static const collectionBrowsingQuickActionsKey = 'collection_browsing_quick_actions';
|
||||||
static const collectionSelectionQuickActionsKey = 'collection_selection_quick_actions';
|
static const collectionSelectionQuickActionsKey = 'collection_selection_quick_actions';
|
||||||
static const showThumbnailFavouriteKey = 'show_thumbnail_favourite';
|
static const showThumbnailFavouriteKey = 'show_thumbnail_favourite';
|
||||||
|
static const showThumbnailTagKey = 'show_thumbnail_tag';
|
||||||
static const showThumbnailLocationKey = 'show_thumbnail_location';
|
static const showThumbnailLocationKey = 'show_thumbnail_location';
|
||||||
static const showThumbnailMotionPhotoKey = 'show_thumbnail_motion_photo';
|
static const showThumbnailMotionPhotoKey = 'show_thumbnail_motion_photo';
|
||||||
static const showThumbnailRatingKey = 'show_thumbnail_rating';
|
static const showThumbnailRatingKey = 'show_thumbnail_rating';
|
||||||
|
@ -354,6 +355,10 @@ class Settings extends ChangeNotifier {
|
||||||
|
|
||||||
set showThumbnailFavourite(bool newValue) => setAndNotify(showThumbnailFavouriteKey, newValue);
|
set showThumbnailFavourite(bool newValue) => setAndNotify(showThumbnailFavouriteKey, newValue);
|
||||||
|
|
||||||
|
bool get showThumbnailTag => getBoolOrDefault(showThumbnailTagKey, SettingsDefaults.showThumbnailTag);
|
||||||
|
|
||||||
|
set showThumbnailTag(bool newValue) => setAndNotify(showThumbnailTagKey, newValue);
|
||||||
|
|
||||||
bool get showThumbnailLocation => getBoolOrDefault(showThumbnailLocationKey, SettingsDefaults.showThumbnailLocation);
|
bool get showThumbnailLocation => getBoolOrDefault(showThumbnailLocationKey, SettingsDefaults.showThumbnailLocation);
|
||||||
|
|
||||||
set showThumbnailLocation(bool newValue) => setAndNotify(showThumbnailLocationKey, newValue);
|
set showThumbnailLocation(bool newValue) => setAndNotify(showThumbnailLocationKey, newValue);
|
||||||
|
@ -694,6 +699,7 @@ class Settings extends ChangeNotifier {
|
||||||
case confirmMoveUndatedItemsKey:
|
case confirmMoveUndatedItemsKey:
|
||||||
case setMetadataDateBeforeFileOpKey:
|
case setMetadataDateBeforeFileOpKey:
|
||||||
case showThumbnailFavouriteKey:
|
case showThumbnailFavouriteKey:
|
||||||
|
case showThumbnailTagKey:
|
||||||
case showThumbnailLocationKey:
|
case showThumbnailLocationKey:
|
||||||
case showThumbnailMotionPhotoKey:
|
case showThumbnailMotionPhotoKey:
|
||||||
case showThumbnailRatingKey:
|
case showThumbnailRatingKey:
|
||||||
|
|
|
@ -34,6 +34,7 @@ class GridTheme extends StatelessWidget {
|
||||||
showMotionPhoto: settings.showThumbnailMotionPhoto,
|
showMotionPhoto: settings.showThumbnailMotionPhoto,
|
||||||
showRating: settings.showThumbnailRating,
|
showRating: settings.showThumbnailRating,
|
||||||
showRaw: settings.showThumbnailRaw,
|
showRaw: settings.showThumbnailRaw,
|
||||||
|
showTag: settings.showThumbnailTag,
|
||||||
showTrash: showTrash ?? true,
|
showTrash: showTrash ?? true,
|
||||||
showVideoDuration: settings.showThumbnailVideoDuration,
|
showVideoDuration: settings.showThumbnailVideoDuration,
|
||||||
);
|
);
|
||||||
|
@ -45,7 +46,7 @@ class GridTheme extends StatelessWidget {
|
||||||
|
|
||||||
class GridThemeData {
|
class GridThemeData {
|
||||||
final double iconSize, fontSize, highlightBorderWidth;
|
final double iconSize, fontSize, highlightBorderWidth;
|
||||||
final bool showFavourite, showLocation, showMotionPhoto, showRating, showRaw, showTrash, showVideoDuration;
|
final bool showFavourite, showLocation, showMotionPhoto, showRating, showRaw, showTag, showTrash, showVideoDuration;
|
||||||
|
|
||||||
const GridThemeData({
|
const GridThemeData({
|
||||||
required this.iconSize,
|
required this.iconSize,
|
||||||
|
@ -56,6 +57,7 @@ class GridThemeData {
|
||||||
required this.showMotionPhoto,
|
required this.showMotionPhoto,
|
||||||
required this.showRating,
|
required this.showRating,
|
||||||
required this.showRaw,
|
required this.showRaw,
|
||||||
|
required this.showTag,
|
||||||
required this.showTrash,
|
required this.showTrash,
|
||||||
required this.showVideoDuration,
|
required this.showVideoDuration,
|
||||||
});
|
});
|
||||||
|
|
|
@ -87,6 +87,21 @@ class FavouriteIcon extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TagIcon extends StatelessWidget {
|
||||||
|
const TagIcon({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
static const scale = .9;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const OverlayIcon(
|
||||||
|
icon: AIcons.tag,
|
||||||
|
iconScale: scale,
|
||||||
|
relativeOffset: Offset(.05, .05),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class GpsIcon extends StatelessWidget {
|
class GpsIcon extends StatelessWidget {
|
||||||
const GpsIcon({Key? key}) : super(key: key);
|
const GpsIcon({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@ -204,7 +219,8 @@ class OverlayIcon extends StatelessWidget {
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
final String? text;
|
final String? text;
|
||||||
final double iconScale;
|
final double iconScale;
|
||||||
final EdgeInsets margin;
|
final EdgeInsetsGeometry margin;
|
||||||
|
final Offset? relativeOffset;
|
||||||
|
|
||||||
const OverlayIcon({
|
const OverlayIcon({
|
||||||
Key? key,
|
Key? key,
|
||||||
|
@ -213,25 +229,36 @@ class OverlayIcon extends StatelessWidget {
|
||||||
this.text,
|
this.text,
|
||||||
// default margin for multiple icons in a `Column`
|
// default margin for multiple icons in a `Column`
|
||||||
this.margin = const EdgeInsets.only(left: 1, right: 1, bottom: 1),
|
this.margin = const EdgeInsets.only(left: 1, right: 1, bottom: 1),
|
||||||
|
this.relativeOffset,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final size = context.select<GridThemeData, double>((t) => t.iconSize);
|
final size = context.select<GridThemeData, double>((t) => t.iconSize);
|
||||||
final iconChild = Icon(
|
Widget iconChild = Icon(
|
||||||
icon,
|
icon,
|
||||||
size: size,
|
size: size,
|
||||||
);
|
);
|
||||||
final iconBox = SizedBox(
|
|
||||||
width: size,
|
if (relativeOffset != null) {
|
||||||
height: size,
|
iconChild = FractionalTranslation(
|
||||||
|
translation: relativeOffset!,
|
||||||
|
child: iconChild,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconScale != 1) {
|
||||||
// using a transform is better than modifying the icon size to properly center the scaled icon
|
// using a transform is better than modifying the icon size to properly center the scaled icon
|
||||||
child: iconScale != 1
|
iconChild = Transform.scale(
|
||||||
? Transform.scale(
|
|
||||||
scale: iconScale,
|
scale: iconScale,
|
||||||
child: iconChild,
|
child: iconChild,
|
||||||
)
|
);
|
||||||
: iconChild,
|
}
|
||||||
|
|
||||||
|
iconChild = SizedBox(
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
child: iconChild,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -242,12 +269,12 @@ class OverlayIcon extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.all(Radius.circular(size)),
|
borderRadius: BorderRadius.all(Radius.circular(size)),
|
||||||
),
|
),
|
||||||
child: text == null
|
child: text == null
|
||||||
? iconBox
|
? iconChild
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
iconBox,
|
iconChild,
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
Text(
|
Text(
|
||||||
text!,
|
text!,
|
||||||
|
|
|
@ -20,6 +20,7 @@ class ThumbnailEntryOverlay extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final children = [
|
final children = [
|
||||||
if (entry.isFavourite && context.select<GridThemeData, bool>((t) => t.showFavourite)) const FavouriteIcon(),
|
if (entry.isFavourite && context.select<GridThemeData, bool>((t) => t.showFavourite)) const FavouriteIcon(),
|
||||||
|
if (entry.tags.isNotEmpty && context.select<GridThemeData, bool>((t) => t.showTag)) const TagIcon(),
|
||||||
if (entry.hasGps && context.select<GridThemeData, bool>((t) => t.showLocation)) const GpsIcon(),
|
if (entry.hasGps && context.select<GridThemeData, bool>((t) => t.showLocation)) const GpsIcon(),
|
||||||
if (entry.rating != 0 && context.select<GridThemeData, bool>((t) => t.showRating)) RatingIcon(entry: entry),
|
if (entry.rating != 0 && context.select<GridThemeData, bool>((t) => t.showRating)) RatingIcon(entry: entry),
|
||||||
if (entry.isVideo)
|
if (entry.isVideo)
|
||||||
|
|
|
@ -37,6 +37,19 @@ class ThumbnailOverlayPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SettingsSwitchListTile(
|
||||||
|
selector: (context, s) => s.showThumbnailTag,
|
||||||
|
onChanged: (v) => settings.showThumbnailTag = v,
|
||||||
|
title: context.l10n.settingsThumbnailShowTagIcon,
|
||||||
|
trailing: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: iconSize * (1 - TagIcon.scale) / 2),
|
||||||
|
child: Icon(
|
||||||
|
AIcons.tag,
|
||||||
|
size: iconSize * TagIcon.scale,
|
||||||
|
color: iconColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
SettingsSwitchListTile(
|
SettingsSwitchListTile(
|
||||||
selector: (context, s) => s.showThumbnailLocation,
|
selector: (context, s) => s.showThumbnailLocation,
|
||||||
onChanged: (v) => settings.showThumbnailLocation = v,
|
onChanged: (v) => settings.showThumbnailLocation = v,
|
||||||
|
|
|
@ -27,6 +27,7 @@ Future<void> configureAndLaunch() async {
|
||||||
..collectionSortFactor = EntrySortFactor.date
|
..collectionSortFactor = EntrySortFactor.date
|
||||||
..collectionBrowsingQuickActions = SettingsDefaults.collectionBrowsingQuickActions
|
..collectionBrowsingQuickActions = SettingsDefaults.collectionBrowsingQuickActions
|
||||||
..showThumbnailFavourite = false
|
..showThumbnailFavourite = false
|
||||||
|
..showThumbnailTag = false
|
||||||
..showThumbnailLocation = false
|
..showThumbnailLocation = false
|
||||||
..hiddenFilters = {}
|
..hiddenFilters = {}
|
||||||
// viewer
|
// viewer
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
"de": [
|
"de": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"es": [
|
"es": [
|
||||||
|
@ -18,25 +19,29 @@
|
||||||
"appPickDialogNone",
|
"appPickDialogNone",
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"fr": [
|
"fr": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"id": [
|
"id": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"it": [
|
"it": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"ja": [
|
"ja": [
|
||||||
|
@ -52,30 +57,35 @@
|
||||||
"appPickDialogNone",
|
"appPickDialogNone",
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"ko": [
|
"ko": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"pt": [
|
"pt": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"ru": [
|
"ru": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
],
|
],
|
||||||
|
|
||||||
"zh": [
|
"zh": [
|
||||||
"settingsSearchFieldLabel",
|
"settingsSearchFieldLabel",
|
||||||
"settingsSearchEmpty",
|
"settingsSearchEmpty",
|
||||||
"settingsShowBottomNavigationBar"
|
"settingsShowBottomNavigationBar",
|
||||||
|
"settingsThumbnailShowTagIcon"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue