Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Widget build(BuildContext context) {
- return StreamBuilder(
- stream: Firestore.instance.collection("categories_item").snapshots(),
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return Center(
- child: CircularProgressIndicator(
- valueColor: AlwaysStoppedAnimation<Color>(redMaroon),
- ),
- );
- } else {
- return Scaffold(
- backgroundColor: Color(0xFFFCFAF8),
- body: ListView(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(right: 15.0),
- width: MediaQuery.of(context).size.width - 30.0,
- height: MediaQuery.of(context).size.height - 50.0,
- child: GridView.count(
- crossAxisCount: 2,
- primary: false,
- crossAxisSpacing: 10.0,
- mainAxisSpacing: 15.0,
- childAspectRatio: 0.8,
- children: snapshot.data.documents.map<Widget>((document) {
- return _buildCardItem(
- context,
- document,
- false,
- 'assets/burger.jpg',
- false,
- );
- }).toList(),
- ),
- )
- ],
- ),
- );
- }
- },
- );
- }
Add Comment
Please, Sign In to add comment