fullscreen: rotate & flip in one menu row

This commit is contained in:
Thibault Deckers 2020-10-14 19:07:48 +09:00
parent e578caa4d5
commit 1ba93cdd19
3 changed files with 38 additions and 5 deletions

View file

@ -30,9 +30,6 @@ class EntryActions {
EntryAction.share,
EntryAction.delete,
EntryAction.rename,
EntryAction.rotateCCW,
EntryAction.rotateCW,
EntryAction.flip,
EntryAction.print,
];
@ -58,9 +55,9 @@ extension ExtraEntryAction on EntryAction {
case EntryAction.rename:
return 'Rename';
case EntryAction.rotateCCW:
return 'Rotate left';
return 'Rotate counterclockwise';
case EntryAction.rotateCW:
return 'Rotate right';
return 'Rotate clockwise';
case EntryAction.flip:
return 'Flip horizontally';
case EntryAction.print:

View file

@ -50,6 +50,7 @@ class _MetadataThumbnailsState extends State<MetadataThumbnails> {
future: _loader,
builder: (context, snapshot) {
if (!snapshot.hasError && snapshot.connectionState == ConnectionState.done && snapshot.data.isNotEmpty) {
// TODO TLAD apply the rotation to Exif thumbnail only, on Android side
final turns = (entry.rotationDegrees / 90).round();
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
return Container(

View file

@ -137,6 +137,7 @@ class _TopOverlayRow extends StatelessWidget {
key: Key('entry-menu-button'),
itemBuilder: (context) => [
...inAppActions.map(_buildPopupMenuItem),
if (entry.canRotateAndFlip) _buildRotateAndFlipMenuItems(),
PopupMenuDivider(),
...externalAppActions.map(_buildPopupMenuItem),
if (kDebugMode) ...[
@ -227,6 +228,40 @@ class _TopOverlayRow extends StatelessWidget {
child: child,
);
}
PopupMenuItem<EntryAction> _buildRotateAndFlipMenuItems() {
Widget buildDivider() => SizedBox(
height: 16,
child: VerticalDivider(
width: 1,
thickness: 1,
),
);
Widget buildItem(EntryAction action) => Expanded(
child: PopupMenuItem(
value: action,
child: Tooltip(
message: action.getText(),
child: Center(child: Icon(action.getIcon())),
),
),
);
return PopupMenuItem(
child: Row(
children: [
buildDivider(),
buildItem(EntryAction.rotateCCW),
buildDivider(),
buildItem(EntryAction.rotateCW),
buildDivider(),
buildItem(EntryAction.flip),
buildDivider(),
],
),
);
}
}
class _FavouriteToggler extends StatefulWidget {