minor changes
This commit is contained in:
parent
60abdb7247
commit
8b4b88e077
6 changed files with 34 additions and 43 deletions
|
@ -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),
|
||||
});
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ class _CollectionScrollViewState extends State<CollectionScrollView> {
|
|||
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(
|
||||
|
|
|
@ -262,7 +262,7 @@ class _AppDrawerState extends State<AppDrawer> {
|
|||
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<AppDrawer> {
|
|||
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<AppDrawer> {
|
|||
filterBuilder: (s) => TagFilter(s),
|
||||
emptyBuilder: () => const EmptyContent(
|
||||
icon: AIcons.tag,
|
||||
text: 'No tags!',
|
||||
text: 'No tags',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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<void> _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<void> _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) {
|
||||
|
|
17
lib/widgets/common/action_delegates/feedback.dart
Normal file
17
lib/widgets/common/action_delegates/feedback.dart
Normal file
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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<String>(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 = <String>{};
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue