Skip to content

Instantly share code, notes, and snippets.

@ShivamGoyal1899
Created June 12, 2019 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShivamGoyal1899/c068d4a849dab60995d063333e460f10 to your computer and use it in GitHub Desktop.
Save ShivamGoyal1899/c068d4a849dab60995d063333e460f10 to your computer and use it in GitHub Desktop.
Future<void> _shareAlbum(BuildContext context) async {
// Show the loading indicator
setState(() {
_inSharingApiCall = true;
});
final SnackBar snackBar = SnackBar(
duration: Duration(seconds: 3),
content: const Text('Sharing Album...'),
);
Scaffold.of(context).showSnackBar(snackBar);
// Share the album and update the local model
await ScopedModel.of<PhotosLibraryApiModel>(context).shareAlbum(album.id);
final Album updatedAlbum =
await ScopedModel.of<PhotosLibraryApiModel>(context).getAlbum(album.id);
print('Album has been shared.');
setState(() {
album = updatedAlbum;
// Hide the loading indicator
_inSharingApiCall = false;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment