diff --git a/app/lib/dialogs/area/context.dart b/app/lib/dialogs/area/context.dart index bf1048f8420e..054bedd0ab5e 100644 --- a/app/lib/dialogs/area/context.dart +++ b/app/lib/dialogs/area/context.dart @@ -79,6 +79,18 @@ ContextMenuBuilder buildAreaContextMenu(DocumentBloc bloc, ContextMenuBuilder buildGeneralAreaContextMenu(DocumentBloc bloc, Area area, SettingsCubit settingsCubit, List elements) => (context) => [ + ContextMenuItem( + onPressed: () async { + Navigator.of(context).pop(true); + final result = await showDialog( + builder: (context) => NameDialog(), context: context); + if (result == null) return; + bloc.add(ElementsLayerChanged( + result, elements.map((e) => e.id).whereNotNull().toList())); + }, + icon: const PhosphorIcon(PhosphorIconsLight.stack), + label: AppLocalizations.of(context).changeLayer, + ), ContextMenuGroup( icon: const PhosphorIcon(PhosphorIconsLight.export), label: AppLocalizations.of(context).export, diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index f4af0cd097ad..0cd0490cd8d7 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -610,5 +610,6 @@ "hideCursorWhileDrawing": "Hide cursor while drawing", "installed": "Installed", "install": "Install", - "deselect": "Deselect" + "deselect": "Deselect", + "changeLayer": "Change layer" } diff --git a/app/lib/views/files/grid.dart b/app/lib/views/files/grid.dart index 811560c57bb5..00bbd33d110b 100644 --- a/app/lib/views/files/grid.dart +++ b/app/lib/views/files/grid.dart @@ -79,11 +79,7 @@ class FileEntityGridItem extends StatelessWidget { child: InkWell( onTap: onTap, highlightColor: active ? colorScheme.primaryContainer : null, - child: Container( - padding: const EdgeInsets.symmetric( - vertical: 8, - horizontal: 16, - ), + child: SizedBox( width: 160, height: 192, child: Column( @@ -92,15 +88,16 @@ class FileEntityGridItem extends StatelessWidget { Stack( children: [ Center( - child: SizedBox( - height: 64, - width: 64, + child: Container( + height: 96, + width: 96, + padding: const EdgeInsets.only(top: 8), child: thumbnail != null ? Image.memory( thumbnail!, fit: BoxFit.contain, - cacheWidth: 64, - cacheHeight: 64, + cacheWidth: 96, + cacheHeight: 96, errorBuilder: (context, error, stackTrace) => leading, ) @@ -137,121 +134,126 @@ class FileEntityGridItem extends StatelessWidget { ), const SizedBox(height: 8), Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - SizedBox( - height: 16, - child: modifiedText != null - ? Tooltip( - message: AppLocalizations.of(context).modified, - child: Row( - children: [ - PhosphorIcon( - PhosphorIconsLight.clockCounterClockwise, - size: 12, - color: colorScheme.outline, - ), - const SizedBox(width: 8), - Text( - modifiedText!, - style: Theme.of(context) - .textTheme - .bodySmall - ?.copyWith( - color: colorScheme.outline, - ), - ), - ], - ), - ) - : null, - ), - SizedBox( - height: 16, - child: createdText != null - ? Tooltip( - message: AppLocalizations.of(context).created, - child: Row( - children: [ - PhosphorIcon( - PhosphorIconsLight.plus, - size: 12, - color: colorScheme.outline, - ), - const SizedBox(width: 8), - Text( - createdText!, - style: Theme.of(context) - .textTheme - .bodySmall - ?.copyWith( - color: colorScheme.outline, - ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox( + height: 16, + child: modifiedText != null + ? Tooltip( + message: AppLocalizations.of(context).modified, + child: Row( + children: [ + PhosphorIcon( + PhosphorIconsLight.clockCounterClockwise, + size: 12, + color: colorScheme.outline, + ), + const SizedBox(width: 8), + Text( + modifiedText!, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: colorScheme.outline, + ), + ), + ], + ), + ) + : null, + ), + SizedBox( + height: 16, + child: createdText != null + ? Tooltip( + message: AppLocalizations.of(context).created, + child: Row( + children: [ + PhosphorIcon( + PhosphorIconsLight.plus, + size: 12, + color: colorScheme.outline, + ), + const SizedBox(width: 8), + Text( + createdText!, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: colorScheme.outline, + ), + ), + ], + ), + ) + : null, + ), + const SizedBox(height: 8), + SizedBox( + height: 32, + child: editable + ? ConstrainedBox( + constraints: const BoxConstraints( + maxWidth: 200, + ), + child: TextField( + controller: nameController, + autofocus: true, + style: Theme.of(context).textTheme.labelLarge, + onSubmitted: (value) async { + await documentSystem.renameAsset( + entity.location.path, value); + onEdit(false); + onReload(); + }, + decoration: InputDecoration( + filled: true, + hintText: + AppLocalizations.of(context).enterText, + suffix: IconButton( + onPressed: () async { + await documentSystem.renameAsset( + entity.location.path, + nameController.text); + onEdit(false); + onReload(); + }, + icon: const PhosphorIcon( + PhosphorIconsLight.check), + tooltip: + AppLocalizations.of(context).save, + ), ), - ], - ), - ) - : null, - ), - const SizedBox(height: 8), - SizedBox( - height: 32, - child: editable - ? ConstrainedBox( - constraints: const BoxConstraints( - maxWidth: 200, - ), - child: TextField( - controller: nameController, - autofocus: true, - style: Theme.of(context).textTheme.labelLarge, - onSubmitted: (value) async { - await documentSystem.renameAsset( - entity.location.path, value); - onEdit(false); - onReload(); - }, - decoration: InputDecoration( - filled: true, - hintText: - AppLocalizations.of(context).enterText, - suffix: IconButton( - onPressed: () async { - await documentSystem.renameAsset( - entity.location.path, - nameController.text); - onEdit(false); - onReload(); + )) + : Align( + alignment: Alignment.centerLeft, + child: Tooltip( + message: entity.fileName, + child: GestureDetector( + child: Text( + entity.fileName, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: Theme.of(context) + .textTheme + .labelLarge, + ), + onDoubleTap: () { + onEdit(true); + nameController.text = entity.fileName; }, - icon: const PhosphorIcon( - PhosphorIconsLight.check), - tooltip: AppLocalizations.of(context).save, ), ), - )) - : Align( - alignment: Alignment.centerLeft, - child: Tooltip( - message: entity.fileName, - child: GestureDetector( - child: Text( - entity.fileName, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: - Theme.of(context).textTheme.labelLarge, - ), - onDoubleTap: () { - onEdit(true); - nameController.text = entity.fileName; - }, - ), ), - ), - ), - ], + ), + ], + ), ), ), ], diff --git a/app/lib/views/files/list.dart b/app/lib/views/files/list.dart index eb8ba014d55f..0a5d24c2017f 100644 --- a/app/lib/views/files/list.dart +++ b/app/lib/views/files/list.dart @@ -91,76 +91,76 @@ class FileEntityListTile extends StatelessWidget { icon, color: colorScheme.outline, ); - final fileName = Row( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - width: 32, - height: 32, - child: thumbnail != null - ? Image.memory( - thumbnail!, - fit: BoxFit.cover, - cacheHeight: 32, - cacheWidth: 32, - errorBuilder: - (context, error, stackTrace) => leading, - ) - : leading, - ), - const SizedBox(width: 8), - Flexible( - child: SizedBox( - height: 42, + final fileName = SizedBox( + height: 42, + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 32, + height: 32, + child: thumbnail != null + ? Image.memory( + thumbnail!, + fit: BoxFit.cover, + cacheHeight: 32, + cacheWidth: 32, + errorBuilder: + (context, error, stackTrace) => + leading, + ) + : leading, + ), + const SizedBox(width: 8), + Flexible( child: editable - ? ConstrainedBox( - constraints: BoxConstraints( - maxWidth: constraints.maxWidth, - minWidth: 100, + ? TextField( + controller: nameController, + autofocus: true, + style: Theme.of(context) + .textTheme + .labelLarge, + onSubmitted: (value) async { + await documentSystem.renameAsset( + entity.location.path, value); + onEdit(false); + onReload(); + }, + textAlignVertical: + TextAlignVertical.center, + decoration: InputDecoration( + filled: true, + constraints: BoxConstraints( + maxWidth: constraints.maxWidth, + minWidth: 100, + maxHeight: 40, + ), + hintText: AppLocalizations.of(context) + .enterText, + suffix: IconButton( + onPressed: () async { + await documentSystem.renameAsset( + entity.location.path, + nameController.text); + onEdit(false); + onReload(); + }, + icon: const PhosphorIcon( + PhosphorIconsLight.check), + tooltip: + AppLocalizations.of(context).save, + ), ), - child: TextField( - controller: nameController, - autofocus: true, + ) + : GestureDetector( + child: Text( + entity.fileName, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: Theme.of(context) .textTheme .labelLarge, - onSubmitted: (value) async { - await documentSystem.renameAsset( - entity.location.path, value); - onEdit(false); - onReload(); - }, - decoration: InputDecoration( - filled: true, - hintText: AppLocalizations.of(context) - .enterText, - suffix: IconButton( - onPressed: () async { - await documentSystem.renameAsset( - entity.location.path, - nameController.text); - onEdit(false); - onReload(); - }, - icon: const PhosphorIcon( - PhosphorIconsLight.check), - tooltip: - AppLocalizations.of(context) - .save, - ), - ), - )) - : GestureDetector( - child: Align( - alignment: Alignment.centerLeft, - child: Text( - entity.fileName, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: Theme.of(context) - .textTheme - .labelLarge, - ), ), onDoubleTap: () { onEdit(true); @@ -168,8 +168,8 @@ class FileEntityListTile extends StatelessWidget { }, ), ), - ), - ], + ], + ), ); final edit = editable ? Container() diff --git a/app/pubspec.lock b/app/pubspec.lock index ec3abb372287..cd3bce0d872e 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -1589,10 +1589,10 @@ packages: dependency: transitive description: name: win32_registry - sha256: "10589e0d7f4e053f2c61023a31c9ce01146656a70b7b7f0828c0b46d7da2a9bb" + sha256: "723b7f851e5724c55409bb3d5a32b203b3afe8587eaf5dafb93a5fed8ecda0d6" url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "1.1.4" window_manager: dependency: "direct main" description: diff --git a/metadata/en-US/changelogs/110.txt b/metadata/en-US/changelogs/110.txt index f256249d4cca..c9b9a982ee39 100644 --- a/metadata/en-US/changelogs/110.txt +++ b/metadata/en-US/changelogs/110.txt @@ -1,4 +1,5 @@ * Add navigator position to position it to the right (useful for left handed users) +* Add option to change layer in select and area context menu * Start adding multi file selection ([#713](https://github.com/LinwoodDev/Butterfly/issues/713)) * Improve renaming in files view * Improve grid view item