Created
June 12, 2019 11:10
-
-
Save ShivamGoyal1899/c068d4a849dab60995d063333e460f10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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