fullscreen: hide editing actions for non editable entries

This commit is contained in:
Thibault Deckers 2020-03-20 09:50:11 +09:00
parent b48dc4cd56
commit 8c756182b7
3 changed files with 14 additions and 14 deletions

View file

@ -103,11 +103,11 @@ class ImageEntry {
bool get isCatalogued => catalogMetadata != null;
bool get canEdit => path != null;
bool get canPrint => !isVideo;
bool get canRename => path != null;
bool get canRotate => mimeType == MimeTypes.MIME_JPEG || mimeType == MimeTypes.MIME_PNG;
bool get canRotate => canEdit && (mimeType == MimeTypes.MIME_JPEG || mimeType == MimeTypes.MIME_PNG);
double get aspectRatio {
if (width == 0 || height == 0) return 1;

View file

@ -1,5 +1,3 @@
import 'dart:collection';
import 'package:aves/model/image_entry.dart';
import 'package:aves/utils/file_utils.dart';
import 'package:aves/widgets/fullscreen/info/info_page.dart';

View file

@ -45,15 +45,17 @@ class FullscreenTopOverlay extends StatelessWidget {
tooltip: 'Share',
),
),
const SizedBox(width: 8),
OverlayButton(
scale: scale,
child: IconButton(
icon: Icon(OMIcons.delete),
onPressed: () => onActionSelected?.call(FullscreenAction.delete),
tooltip: 'Delete',
if (entry.canEdit) ...[
const SizedBox(width: 8),
OverlayButton(
scale: scale,
child: IconButton(
icon: Icon(OMIcons.delete),
onPressed: () => onActionSelected?.call(FullscreenAction.delete),
tooltip: 'Delete',
),
),
),
],
const SizedBox(width: 8),
OverlayButton(
scale: scale,
@ -63,7 +65,7 @@ class FullscreenTopOverlay extends StatelessWidget {
value: FullscreenAction.info,
child: MenuRow(text: 'Info', icon: OMIcons.info),
),
if (entry.canRename)
if (entry.canEdit)
PopupMenuItem(
value: FullscreenAction.rename,
child: MenuRow(text: 'Rename', icon: OMIcons.title),