diff --git a/lib/widgets/album/empty.dart b/lib/widgets/album/empty.dart index dfc3ad805..890ac4f33 100644 --- a/lib/widgets/album/empty.dart +++ b/lib/widgets/album/empty.dart @@ -8,7 +8,7 @@ class EmptyContent extends StatelessWidget { const EmptyContent({ this.icon = AIcons.image, - this.text = 'Nothing!', + this.text = 'No images', this.alignment = const FractionalOffset(.5, .35), }); diff --git a/lib/widgets/album/thumbnail_collection.dart b/lib/widgets/album/thumbnail_collection.dart index bde436329..0fea6d2c0 100644 --- a/lib/widgets/album/thumbnail_collection.dart +++ b/lib/widgets/album/thumbnail_collection.dart @@ -208,7 +208,7 @@ class _CollectionScrollViewState extends State { return collection.filters.any((filter) => filter is FavouriteFilter) ? const EmptyContent( icon: AIcons.favourite, - text: 'No favourites!', + text: 'No favourites', ) : collection.filters.any((filter) => filter is MimeFilter && filter.mime == MimeTypes.ANY_VIDEO) ? const EmptyContent( diff --git a/lib/widgets/app_drawer.dart b/lib/widgets/app_drawer.dart index ebd5cfd23..6598801c5 100644 --- a/lib/widgets/app_drawer.dart +++ b/lib/widgets/app_drawer.dart @@ -262,7 +262,7 @@ class _AppDrawerState extends State { filterBuilder: (s) => AlbumFilter(s, source.getUniqueAlbumName(s)), emptyBuilder: () => const EmptyContent( icon: AIcons.album, - text: 'No albums!', + text: 'No albums', ), ), ), @@ -281,7 +281,7 @@ class _AppDrawerState extends State { filterBuilder: (s) => LocationFilter(LocationLevel.country, s), emptyBuilder: () => const EmptyContent( icon: AIcons.location, - text: 'No countries!', + text: 'No countries', ), ), ), @@ -300,7 +300,7 @@ class _AppDrawerState extends State { filterBuilder: (s) => TagFilter(s), emptyBuilder: () => const EmptyContent( icon: AIcons.tag, - text: 'No tags!', + text: 'No tags', ), ), ), diff --git a/lib/widgets/common/action_delegates/entry_action_delegate.dart b/lib/widgets/common/action_delegates/entry_action_delegate.dart index cbc325df7..3baed655e 100644 --- a/lib/widgets/common/action_delegates/entry_action_delegate.dart +++ b/lib/widgets/common/action_delegates/entry_action_delegate.dart @@ -4,12 +4,12 @@ import 'package:aves/model/collection_lens.dart'; import 'package:aves/model/image_entry.dart'; import 'package:aves/services/android_app_service.dart'; import 'package:aves/services/image_file_service.dart'; -import 'package:aves/widgets/common/action_delegates/rename_entry_dialog.dart'; +import 'package:aves/widgets/common/action_delegates/feedback.dart'; import 'package:aves/widgets/common/action_delegates/permission_aware.dart'; +import 'package:aves/widgets/common/action_delegates/rename_entry_dialog.dart'; import 'package:aves/widgets/common/entry_actions.dart'; import 'package:aves/widgets/common/image_providers/uri_image_provider.dart'; import 'package:aves/widgets/fullscreen/debug.dart'; -import 'package:flushbar/flushbar.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:pdf/pdf.dart'; @@ -17,7 +17,7 @@ import 'package:pdf/widgets.dart' as pdf; import 'package:pedantic/pedantic.dart'; import 'package:printing/printing.dart'; -class EntryActionDelegate with PermissionAwareMixin { +class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin { final CollectionLens collection; final VoidCallback showInfo; @@ -74,19 +74,6 @@ class EntryActionDelegate with PermissionAwareMixin { } } - void _showFeedback(BuildContext context, String message) { - Flushbar( - message: message, - margin: const EdgeInsets.all(8), - borderRadius: 8, - borderColor: Colors.white30, - borderWidth: 0.5, - duration: const Duration(seconds: 2), - flushbarPosition: FlushbarPosition.TOP, - animationDuration: const Duration(milliseconds: 600), - ).show(context); - } - Future _print(ImageEntry entry) async { final uri = entry.uri; final mimeType = entry.mimeType; @@ -127,7 +114,7 @@ class EntryActionDelegate with PermissionAwareMixin { if (!await checkStoragePermission(context, [entry])) return; final success = await entry.rotate(clockwise: clockwise); - if (!success) _showFeedback(context, 'Failed'); + if (!success) showFeedback(context, 'Failed'); } Future _showDeleteDialog(BuildContext context, ImageEntry entry) async { @@ -154,7 +141,7 @@ class EntryActionDelegate with PermissionAwareMixin { if (!await checkStoragePermission(context, [entry])) return; if (!await entry.delete()) { - _showFeedback(context, 'Failed'); + showFeedback(context, 'Failed'); } else if (hasCollection) { // update collection collection.source.removeEntries([entry]); @@ -176,7 +163,7 @@ class EntryActionDelegate with PermissionAwareMixin { if (!await checkStoragePermission(context, [entry])) return; - _showFeedback(context, await entry.rename(newName) ? 'Done!' : 'Failed'); + showFeedback(context, await entry.rename(newName) ? 'Done!' : 'Failed'); } void _goToDebug(BuildContext context, ImageEntry entry) { diff --git a/lib/widgets/common/action_delegates/feedback.dart b/lib/widgets/common/action_delegates/feedback.dart new file mode 100644 index 000000000..dab322d90 --- /dev/null +++ b/lib/widgets/common/action_delegates/feedback.dart @@ -0,0 +1,17 @@ +import 'package:flushbar/flushbar.dart'; +import 'package:flutter/material.dart'; + +mixin FeedbackMixin { + void showFeedback(BuildContext context, String message) { + Flushbar( + message: message, + margin: const EdgeInsets.all(8), + borderRadius: 8, + borderColor: Colors.white30, + borderWidth: 0.5, + duration: const Duration(seconds: 2), + flushbarPosition: FlushbarPosition.TOP, + animationDuration: const Duration(milliseconds: 600), + ).show(context); + } +} \ No newline at end of file diff --git a/lib/widgets/common/action_delegates/selection_action_delegate.dart b/lib/widgets/common/action_delegates/selection_action_delegate.dart index b7828404e..d5473365b 100644 --- a/lib/widgets/common/action_delegates/selection_action_delegate.dart +++ b/lib/widgets/common/action_delegates/selection_action_delegate.dart @@ -10,19 +10,19 @@ import 'package:aves/services/image_file_service.dart'; import 'package:aves/widgets/album/app_bar.dart'; import 'package:aves/widgets/album/empty.dart'; import 'package:aves/widgets/common/action_delegates/create_album_dialog.dart'; +import 'package:aves/widgets/common/action_delegates/feedback.dart'; import 'package:aves/widgets/common/action_delegates/permission_aware.dart'; import 'package:aves/widgets/common/entry_actions.dart'; import 'package:aves/widgets/common/icons.dart'; import 'package:aves/widgets/filter_grid_page.dart'; import 'package:collection/collection.dart'; -import 'package:flushbar/flushbar.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:intl/intl.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; -class SelectionActionDelegate with PermissionAwareMixin { +class SelectionActionDelegate with FeedbackMixin, PermissionAwareMixin { final CollectionLens collection; SelectionActionDelegate({ @@ -87,7 +87,7 @@ class SelectionActionDelegate with PermissionAwareMixin { filterBuilder: (s) => AlbumFilter(s, source.getUniqueAlbumName(s)), emptyBuilder: () => const EmptyContent( icon: AIcons.album, - text: 'No albums!', + text: 'No albums', ), onPressed: (filter) => Navigator.pop(context, (filter as AlbumFilter)?.album), ); @@ -110,10 +110,10 @@ class SelectionActionDelegate with PermissionAwareMixin { final selectionCount = selection.length; if (movedCount < selectionCount) { final count = selectionCount - movedCount; - _showFeedback(context, 'Failed to move ${Intl.plural(count, one: '${count} item', other: '${count} items')}'); + showFeedback(context, 'Failed to move ${Intl.plural(count, one: '${count} item', other: '${count} items')}'); } else { final count = movedCount; - _showFeedback(context, '${copy ? 'Copied' : 'Moved'} ${Intl.plural(count, one: '${count} item', other: '${count} items')}'); + showFeedback(context, '${copy ? 'Copied' : 'Moved'} ${Intl.plural(count, one: '${count} item', other: '${count} items')}'); } if (movedCount > 0) { final fromAlbums = {}; @@ -201,7 +201,7 @@ class SelectionActionDelegate with PermissionAwareMixin { final selectionCount = selection.length; if (deletedCount < selectionCount) { final count = selectionCount - deletedCount; - _showFeedback(context, 'Failed to delete ${Intl.plural(count, one: '${count} item', other: '${count} items')}'); + showFeedback(context, 'Failed to delete ${Intl.plural(count, one: '${count} item', other: '${count} items')}'); } if (deletedCount > 0) { collection.source.removeEntries(selection.where((e) => deletedUris.contains(e.uri))); @@ -274,17 +274,4 @@ class SelectionActionDelegate with PermissionAwareMixin { _opReportOverlayEntry.remove(); _opReportOverlayEntry = null; } - - void _showFeedback(BuildContext context, String message) { - Flushbar( - message: message, - margin: const EdgeInsets.all(8), - borderRadius: 8, - borderColor: Colors.white30, - borderWidth: 0.5, - duration: const Duration(seconds: 2), - flushbarPosition: FlushbarPosition.TOP, - animationDuration: const Duration(milliseconds: 600), - ).show(context); - } }