'flutter on click download image from firebase
Here, when I add a new picture, it appears here and it can be opened to a full screen, but when I click I want to download the picture that I long pressed on to the phone storage
StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('gallery').snapshots(),
builder: (context, snapshot) {
return !snapshot.hasData ? Center(
child: CircularProgressIndicator(),
) : Container(
child: GridView.builder(
itemCount: snapshot.data!.docs.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3
),
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.all(3),
child: FullScreenWidget(
backgroundColor: Colors.white,
child: FadeInImage.assetNetwork(
fit: BoxFit.contain,
placeholder: 'assets/loading.gif',
imageErrorBuilder:
(context, error, stackTrace) {
return Image.asset(
'assets/error.gif',
fit: BoxFit.fitWidth);
},
image: snapshot.data!.docs[index].get('url')),
),
);
}),
);
},
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
