浏览代码

Display the available list of sharees

Vishnu Mohandas 4 年之前
父节点
当前提交
02b8e58c38
共有 2 个文件被更改,包括 15 次插入23 次删除
  1. 6 17
      lib/ui/gallery_app_bar_widget.dart
  2. 9 6
      lib/ui/share_collection_widget.dart

+ 6 - 17
lib/ui/gallery_app_bar_widget.dart

@@ -151,23 +151,12 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
             "Cannot create a collection of type" + widget.type.toString());
       }
     }
-    final dialog = createProgressDialog(context, "Please wait...");
-    await dialog.show();
-    try {
-      final sharees =
-          await CollectionsService.instance.getSharees(widget.collection.id);
-      await dialog.hide();
-      return showDialog<void>(
-        context: context,
-        builder: (BuildContext context) {
-          return SharingDialog(collection, sharees);
-        },
-      );
-    } catch (e, s) {
-      _logger.severe(e, s);
-      await dialog.hide();
-      showGenericErrorDialog(context);
-    }
+    return showDialog<void>(
+      context: context,
+      builder: (BuildContext context) {
+        return SharingDialog(collection);
+      },
+    );
   }
 
   Future<void> _createAlbum() async {

+ 9 - 6
lib/ui/share_collection_widget.dart

@@ -19,9 +19,8 @@ import 'package:photos/utils/toast_util.dart';
 
 class SharingDialog extends StatefulWidget {
   final Collection collection;
-  final List<User> sharees;
 
-  SharingDialog(this.collection, this.sharees, {Key key}) : super(key: key);
+  SharingDialog(this.collection, {Key key}) : super(key: key);
 
   @override
   _SharingDialogState createState() => _SharingDialogState();
@@ -34,13 +33,17 @@ class _SharingDialogState extends State<SharingDialog> {
 
   @override
   Widget build(BuildContext context) {
-    _sharees = widget.sharees;
+    _sharees = widget.collection.sharees;
     final children = List<Widget>();
     if (!_showEntryField &&
         (widget.collection == null || _sharees.length == 0)) {
-      children.add(Text("Click the + button to share this " +
-          Collection.typeToString(widget.collection.type) +
-          "."));
+      if (widget.collection.type != CollectionType.favorites) {
+        children.add(Text("Click the + button to share this " +
+            Collection.typeToString(widget.collection.type) +
+            "."));
+      } else {
+        children.add(Text("Click the + button to share your favorites."));
+      }
     } else {
       for (final user in _sharees) {
         children.add(EmailItemWidget(widget.collection.id, user.email));