title: Dynamic children for TabView in flutter
body: <p>I'm trying to build a Tabbed View that has lists as children.</p>
  
  <p>Both the Category labels and the lists content will be fetched from a database.</p>
  
  <p>I am passing the labels from the caller page and successfully passing them as a List.
  Now I'm trying to load my lists, and I have built a Widget (myList) that returns successfully a Future ListView.</p>
  
  <p>The problems are two:</p>
  
  <ol>
  <li>Every time i swipe left or right, the list rebuilds itself, while I would like to have it built only once</li>
  <li>How can I use the code I made to have the tabs' children actually reflect the labels and are loaded dinamically according to how many categories i have?</li>
  </ol>
  
  <p>Right now my code is this:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_app/ui/menu_category_list.dart';
  
  // Each TabBarView contains a _Page and for each _Page there is a list
  // of _CardData objects. Each _CardData object is displayed by a _CardItem.
  
  List&lt;Tab&gt; Tabs(List&lt;String&gt; l){
    List&lt;Tab&gt; list;
    for (String c in l) {
      list.add(new Tab(text: c));
    }
    return list;
  }
  
  
  
  class TabsDemo extends StatelessWidget {
  
    const TabsDemo({ Key key , this.categorie}) : super(key: key);
  
    final List&lt;Tab&gt; categorie;
  
    @override
    Widget build(BuildContext ctxt) {
      return new MaterialApp(
        title: "Nice app",
        home: new DefaultTabController(
        length: 5,
        child: new Scaffold(
          appBar: new AppBar(
            title: new Text("Title"),
            bottom: new TabBar(
              tabs:
                categories,
                //new Tab(text: "First Tab"),
                //new Tab(text: "Second Tab"),
  
            ),
  
          ),
          body: new TabBarView(
              children: [
                new MenuCategoryList(),
                new MenuCategoryList(),
                new MenuCategoryList(),
                new MenuCategoryList(),
                new MenuCategoryList()
              ]
          )
        ),
      )
      );
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/TBFwm.png" rel="noreferrer">currently result</a></p>
  
  <p>Thanks a lot in advance</p>