Display the available list of sharees

This commit is contained in:
Vishnu Mohandas 2020-12-04 04:11:01 +05:30
parent 6a26d7482f
commit 02b8e58c38
2 changed files with 15 additions and 23 deletions

View file

@ -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 {

View file

@ -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));