Ad
How To Set A GirdView Hight To Wrap Its Contant - Flutter Web
In my flutter web app i have gird which shows the mentors it fetchesthe data from firebase firestore but the gidviews shows error
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I have tired to wrap it in a expanded widget but did not work and when i wrap the gridview in sizedbox and set its height its works fine, but i want the height should be dynamic based on the items in the girdview.
The girdview is inside a listview.
This is my code
StreamBuilder(
stream: FirebaseFirestore.instance
.collection('consultants')
.snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return Center(
child: ProgressBar(loading: true),
);
} else {
return GridView.count(
crossAxisCount: 4,
childAspectRatio: 0.8,
children: snapshot.data.docs.map((documents) {
return ConsultantCard(
name: documents['name'],
profession: documents['profession'],
shortDesc: documents['shortDesc'],
countryCode: documents['countryCode'],
imageUrl: documents['imageUrl'],
rating: documents['rating'],
ratingsNum: documents['ratingsNum'],
fees: documents['fees'],
verified: documents['verified'],
popular: documents['popular'],
freeTrial: documents['freeTrial'],
languages: documents['languages'],
);
}).toList(),
);
}
}),
Ad
Answer
shrinkWrap: true
This is what you need inside your gridView
Ad
source: stackoverflow.com
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?
Ad