title: Flutter: Card() / Firebase - (Beginner problem)
body: <p>I am new in Flutter. I have a problem with a small project. I collect data from a Firebase DB and adding it into a listTile. I am trying to add 2 static ListTile but they are added to the homescreen for every loop. I can't get a out of the loop - Any one there are willing to help.</p>
  
  <p>The "Datablade" and "Vejledning" listtile are added for every loop</p>
  
  <p>'''</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_app/services/auth.dart';
  import 'package:flutter_app/services/database.dart';
  import 'package:provider/provider.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  
  //import 'package:flutter_app/screens/home/brew_list.dart';
  import 'package:flutter_app/models/brew.dart';
  
  class Home extends StatelessWidget {
  
    final AuthService _auth = AuthService();
  
    @override
    Widget build(BuildContext context) {
      return StreamProvider&lt;List&lt;Brew&gt;&gt;.value(
        value: DatabaseService().filer,
        child: Scaffold(
          backgroundColor: Colors.white,
  
          appBar: AppBar(
            title: Text('Arbejdsmiljø'),
            backgroundColor: Colors.orange[400],
            elevation: 0.0,
            actions: &lt;Widget&gt;[
              FlatButton.icon(
                icon: Icon(Icons.person),
                label: Text('Log ud'),
                onPressed: () async {
                  await _auth.signOut();
  
                },
              ),
            ],
  
          ),
  
          body:
  
  
                ListPage(),
  
              ),
  
  
            );
  
  
  
  
  
  
  
  
        //ListPage(),
  
  
  
    }
  }
  
  class ListPage extends StatefulWidget {
    @override
    _ListPageState createState() =&gt; _ListPageState();
  }
  
  class _ListPageState extends State&lt;ListPage&gt; {
  
    Future _data;
  
    Future getPosts() async{
  
      var firestore = Firestore.instance;
  
      QuerySnapshot qn = await firestore.collection('filer').getDocuments();
      return qn.documents;
  
    }
  
    navigateToDetail(DocumentSnapshot post) {
      Navigator.push(context, MaterialPageRoute(builder: (context) =&gt; DetailPage(post: post,)));
    }
  
    void initState() {
      super.initState();
      _data = getPosts();
    }
  
  
  
    @override
    Widget build(BuildContext context) {
      return Container(
  
  
  
        child: FutureBuilder(
            future: _data,
            builder: (_, snapshot){
  
              if(snapshot.connectionState == ConnectionState.waiting){
                return Center(
                  child: Text('Loading'),
                );
              } else {
  
                return ListView.builder(
  
  
  
  
                  //return ListView.builder(
                    itemCount: snapshot.data.length,
                    itemBuilder: (_, index){
                      return Card(
  
                        child: Column(
                          children: &lt;Widget&gt; [
                            ListTile(
                              leading: Icon(Icons.star, color: Colors.orange, size: 26.0),
                              onTap: () =&gt; navigateToDetail(snapshot.data[index]),
                              title: Text('Datablade'),
                              trailing: Icon(Icons.keyboard_arrow_right),
  
                            ),
                            Divider(color: Colors.orange,indent: 16.0),
  
  
                            ListTile(
                              title: new Center(child: new Text("Vejledninger",
                                style: new TextStyle(
                                    color: Colors.orange[400],
                                    fontWeight: FontWeight.w500, fontSize: 25.0),)),
  
                            ),
  
  
  
  
                            ListTile(
                                onTap: () =&gt; navigateToDetail(snapshot.data[index]),
                                title: Text(snapshot.data[index].data["name"]),
                                leading: CircleAvatar(
                                    backgroundColor: Colors.orange[400],
                                    foregroundColor: Colors.white,
                                    child: Text(snapshot.data[index].data["name"][0])
                                )
  
                            )
                          ],
                        ),
                      );
  
                      //return ListTile(
                      //title: Text(snapshot.data[index].data["name"]),
                      //onTap: () =&gt; navigateToDetail(snapshot.data[index]),
                      //);
  
  
                    });
  
              }
  
            }),
  
  
      );
    }
  }
  
  
  
  class DetailPage extends StatefulWidget {
  
    final DocumentSnapshot post;
    DetailPage ({this.post});
  
    @override
    _DetailPageState createState() =&gt; _DetailPageState();
  }
  
  class _DetailPageState extends State&lt;DetailPage&gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(widget.post.data["name"]),
        ),
        body: Container(
          child: Card(
            child: ListTile(
              title: Text(widget.post.data["name"]),
              subtitle: Text(widget.post.data['beskrivelse']),
            ),
          ),
        ),
      );
    }
  }
  
  '''
  </code></pre>