Merge pull request #888 from ente-io/empty_state_tweaks
Empty state tweaks
This commit is contained in:
commit
910b20dc21
3 changed files with 28 additions and 16 deletions
|
@ -324,7 +324,6 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
|||
}
|
||||
|
||||
Future<void> _albumListItemOnTap(CollectionWithThumbnail item) async {
|
||||
bool showLongToast = false;
|
||||
if (await _runCollectionAction(collection: item.collection)) {
|
||||
late final String toastMessage;
|
||||
bool shouldNavigateToCollection = false;
|
||||
|
@ -334,20 +333,14 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
|||
} else if (widget.actionType == CollectionActionType.moveFiles) {
|
||||
toastMessage = "Moved successfully to " + item.collection.name!;
|
||||
shouldNavigateToCollection = true;
|
||||
} else if (widget.actionType == CollectionActionType.collectPhotos) {
|
||||
toastMessage =
|
||||
"Collaborative link created for " + item.collection.name!;
|
||||
showLongToast = true;
|
||||
} else {
|
||||
toastMessage = "";
|
||||
}
|
||||
if (toastMessage.isNotEmpty) {
|
||||
showLongToast
|
||||
? showToast(context, toastMessage)
|
||||
: showShortToast(
|
||||
context,
|
||||
toastMessage,
|
||||
);
|
||||
showShortToast(
|
||||
context,
|
||||
toastMessage,
|
||||
);
|
||||
}
|
||||
if (shouldNavigateToCollection) {
|
||||
_navigateToCollection(
|
||||
|
@ -440,8 +433,19 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
|||
return Future.value(false);
|
||||
} else {
|
||||
try {
|
||||
await CollectionsService.instance
|
||||
.updateShareUrl(collection, {'enableCollect': true});
|
||||
unawaited(
|
||||
routeToPage(
|
||||
context,
|
||||
ShareCollectionPage(collection),
|
||||
),
|
||||
);
|
||||
CollectionsService.instance
|
||||
.updateShareUrl(collection, {'enableCollect': true}).then(
|
||||
(value) => showToast(
|
||||
context,
|
||||
"Collaborative link created for " + collection.name!,
|
||||
),
|
||||
);
|
||||
return true;
|
||||
} catch (e) {
|
||||
showGenericErrorDialog(context: context);
|
||||
|
@ -455,6 +459,10 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
|
|||
enableCollect: true,
|
||||
);
|
||||
if (result) {
|
||||
showToast(
|
||||
context,
|
||||
"Collaborative link created for " + collection.name!,
|
||||
);
|
||||
if (Configuration.instance.getUserID() == collection.owner!.id) {
|
||||
unawaited(
|
||||
routeToPage(
|
||||
|
|
|
@ -40,10 +40,10 @@ import 'package:photos/ui/home/landing_page_widget.dart';
|
|||
import 'package:photos/ui/home/preserve_footer_widget.dart';
|
||||
import 'package:photos/ui/home/start_backup_hook_widget.dart';
|
||||
import 'package:photos/ui/loading_photos_widget.dart';
|
||||
import "package:photos/ui/new_shared_collections_gallery.dart";
|
||||
import 'package:photos/ui/notification/update/change_log_page.dart';
|
||||
import 'package:photos/ui/settings/app_update_dialog.dart';
|
||||
import 'package:photos/ui/settings_page.dart';
|
||||
import "package:photos/ui/shared_collections_gallery.dart";
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||
import 'package:uni_links/uni_links.dart';
|
||||
|
@ -59,8 +59,7 @@ class HomeWidget extends StatefulWidget {
|
|||
|
||||
class _HomeWidgetState extends State<HomeWidget> {
|
||||
static const _deviceFolderGalleryWidget = CollectionsGalleryWidget();
|
||||
// static const _sharedCollectionGallery = SharedCollectionGallery();
|
||||
static const _sharedCollectionGallery = NewSharedCollectionsGallery();
|
||||
static const _sharedCollectionGallery = SharedCollectionGallery();
|
||||
static final _settingsPage = SettingsPage(
|
||||
emailNotifier: UserService.instance.emailValueNotifier,
|
||||
);
|
||||
|
|
|
@ -19,6 +19,7 @@ import 'package:photos/theme/colors.dart';
|
|||
import 'package:photos/ui/collections/section_title.dart';
|
||||
import 'package:photos/ui/common/gradient_button.dart';
|
||||
import 'package:photos/ui/common/loading_widget.dart';
|
||||
import "package:photos/ui/new_shared_collections_gallery.dart";
|
||||
import 'package:photos/ui/sharing/user_avator_widget.dart';
|
||||
import 'package:photos/ui/viewer/file/thumbnail_widget.dart';
|
||||
import 'package:photos/ui/viewer/gallery/collection_page.dart';
|
||||
|
@ -122,6 +123,10 @@ class _SharedCollectionGalleryState extends State<SharedCollectionGallery>
|
|||
}),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
if ((snapshot.data?.incoming.length ?? 0) == 0 &&
|
||||
(snapshot.data?.outgoing.length ?? 0) == 0) {
|
||||
return const Center(child: EmptyStateWidget());
|
||||
}
|
||||
return _getSharedCollectionsGallery(snapshot.data!);
|
||||
} else if (snapshot.hasError) {
|
||||
_logger.severe(
|
||||
|
|
Loading…
Add table
Reference in a new issue