Reputation: 724
So I have data stored in a collection that I'm fetching from firestore. I'm trying to display the document names under a container (the container is for an image). I'm able to fetch the data and display it. The problem is, I can't scroll properly. If I touch the image and try to scroll, it works. But if I try to touch the listview and try to scroll, I can't.
The code:
class _DescriptionPageState extends State<DescriptionPage> {
Image img;
Future<QuerySnapshot> snap;
void initState(){
super.initState();
img = Image.asset("Assets/Images/bnha.jpg");
snap = getSnap();
}
Future<QuerySnapshot> getSnap() async {
return Firestore.instance.collection('BNHA').getDocuments();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
precacheImage(img.image, context);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
constraints: BoxConstraints.expand(height: 250),
alignment: Alignment.topLeft,
padding: const EdgeInsets.only(left: 10, top: 20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('Assets/Images/bnha.jpg'),
fit: BoxFit.cover)),
child: GestureDetector(
child: Icon(
Icons.arrow_back,
color: Colors.white,
size: 26,
),
onTap: () => Navigator.of(context).pop()),
),
FutureBuilder(
future: snap,
builder:
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
return Center(
child: CircularProgressIndicator(),
);
break;
default:
return ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: snapshot.data.documents.length,
itemBuilder: (BuildContext context, int index) {
return ListTile(
title:
Text(snapshot.data.documents[index].documentID),
);
});
break;
}
})
],
),
));
}
}
How do I fix this?
Upvotes: 0
Views: 43