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()); "Cannot create a collection of type" + widget.type.toString());
} }
} }
final dialog = createProgressDialog(context, "Please wait..."); return showDialog<void>(
await dialog.show(); context: context,
try { builder: (BuildContext context) {
final sharees = return SharingDialog(collection);
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);
}
} }
Future<void> _createAlbum() async { Future<void> _createAlbum() async {

View file

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