diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7b25a520..5144cc21 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -581,6 +581,10 @@ "@listNoResultsText": { "description": "When there's nothing in a list" }, + "listEmptyText": "Empty", + "@listEmptyText": { + "description": "When there's nothing in a list" + }, "albumTrashLabel": "Trash", "@albumTrashLabel": { "description": "Deleted photos" diff --git a/lib/l10n/untranslated-messages.txt b/lib/l10n/untranslated-messages.txt index 854fdbab..93feb8f4 100644 --- a/lib/l10n/untranslated-messages.txt +++ b/lib/l10n/untranslated-messages.txt @@ -1,5 +1,6 @@ { "el": [ + "listEmptyText", "albumTrashLabel", "restoreTooltip", "restoreSelectedProcessingNotification", @@ -18,6 +19,7 @@ "albumSearchTextFieldHint", "clearTooltip", "listNoResultsText", + "listEmptyText", "albumTrashLabel", "restoreTooltip", "restoreSelectedProcessingNotification", diff --git a/lib/widget/archive_browser.dart b/lib/widget/archive_browser.dart index a44463ca..d8f0f4f9 100644 --- a/lib/widget/archive_browser.dart +++ b/lib/widget/archive_browser.dart @@ -18,6 +18,7 @@ import 'package:nc_photos/pref.dart'; import 'package:nc_photos/snack_bar_manager.dart'; import 'package:nc_photos/theme.dart'; import 'package:nc_photos/use_case/update_property.dart'; +import 'package:nc_photos/widget/empty_list_indicator.dart'; import 'package:nc_photos/widget/photo_list_item.dart'; import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart'; import 'package:nc_photos/widget/selection_app_bar.dart'; @@ -95,34 +96,51 @@ class _ArchiveBrowserState extends State } Widget _buildContent(BuildContext context, ScanDirBlocState state) { - return Stack( - children: [ - buildItemStreamListOuter( - context, - child: Theme( - data: Theme.of(context).copyWith( - accentColor: AppTheme.getOverscrollIndicatorColor(context), + if (state is ScanDirBlocSuccess && itemStreamListItems.isEmpty) { + return Column( + children: [ + AppBar( + title: Text(L10n.of(context).albumArchiveLabel), + elevation: 0, + ), + Expanded( + child: EmptyListIndicator( + icon: Icons.archive_outlined, + text: L10n.of(context).listEmptyText, ), - child: CustomScrollView( - slivers: [ - _buildAppBar(context), - SliverPadding( - padding: const EdgeInsets.only(top: 8), - sliver: buildItemStreamList( - maxCrossAxisExtent: _thumbSize.toDouble(), + ), + ], + ); + } else { + return Stack( + children: [ + buildItemStreamListOuter( + context, + child: Theme( + data: Theme.of(context).copyWith( + accentColor: AppTheme.getOverscrollIndicatorColor(context), + ), + child: CustomScrollView( + slivers: [ + _buildAppBar(context), + SliverPadding( + padding: const EdgeInsets.only(top: 8), + sliver: buildItemStreamList( + maxCrossAxisExtent: _thumbSize.toDouble(), + ), ), - ), - ], + ], + ), ), ), - ), - if (state is ScanDirBlocLoading) - Align( - alignment: Alignment.bottomCenter, - child: const LinearProgressIndicator(), - ), - ], - ); + if (state is ScanDirBlocLoading) + Align( + alignment: Alignment.bottomCenter, + child: const LinearProgressIndicator(), + ), + ], + ); + } } Widget _buildAppBar(BuildContext context) { diff --git a/lib/widget/trashbin_browser.dart b/lib/widget/trashbin_browser.dart index d17343c0..c8956981 100644 --- a/lib/widget/trashbin_browser.dart +++ b/lib/widget/trashbin_browser.dart @@ -19,6 +19,7 @@ import 'package:nc_photos/snack_bar_manager.dart'; import 'package:nc_photos/theme.dart'; import 'package:nc_photos/use_case/remove.dart'; import 'package:nc_photos/use_case/restore_trashbin.dart'; +import 'package:nc_photos/widget/empty_list_indicator.dart'; import 'package:nc_photos/widget/photo_list_item.dart'; import 'package:nc_photos/widget/selectable_item_stream_list_mixin.dart'; import 'package:nc_photos/widget/selection_app_bar.dart'; @@ -97,34 +98,51 @@ class _TrashbinBrowserState extends State } Widget _buildContent(BuildContext context, LsTrashbinBlocState state) { - return Stack( - children: [ - buildItemStreamListOuter( - context, - child: Theme( - data: Theme.of(context).copyWith( - accentColor: AppTheme.getOverscrollIndicatorColor(context), + if (state is LsTrashbinBlocSuccess && itemStreamListItems.isEmpty) { + return Column( + children: [ + AppBar( + title: Text(L10n.of(context).albumTrashLabel), + elevation: 0, + ), + Expanded( + child: EmptyListIndicator( + icon: Icons.delete_outline, + text: L10n.of(context).listEmptyText, ), - child: CustomScrollView( - slivers: [ - _buildAppBar(context), - SliverPadding( - padding: const EdgeInsets.only(top: 8), - sliver: buildItemStreamList( - maxCrossAxisExtent: _thumbSize.toDouble(), + ), + ], + ); + } else { + return Stack( + children: [ + buildItemStreamListOuter( + context, + child: Theme( + data: Theme.of(context).copyWith( + accentColor: AppTheme.getOverscrollIndicatorColor(context), + ), + child: CustomScrollView( + slivers: [ + _buildAppBar(context), + SliverPadding( + padding: const EdgeInsets.only(top: 8), + sliver: buildItemStreamList( + maxCrossAxisExtent: _thumbSize.toDouble(), + ), ), - ), - ], + ], + ), ), ), - ), - if (state is LsTrashbinBlocLoading) - Align( - alignment: Alignment.bottomCenter, - child: const LinearProgressIndicator(), - ), - ], - ); + if (state is LsTrashbinBlocLoading) + Align( + alignment: Alignment.bottomCenter, + child: const LinearProgressIndicator(), + ), + ], + ); + } } Widget _buildAppBar(BuildContext context) {