How to create a list of Tab from a list of String?

Money Oriented Programmer

I want to improve the following code snippet by removing the hard coded number 5 (the number of elements in the list). How to do so?

child: TabBar(
            tabs: <Widget>[
              ...List.generate(
                5,
                (i) => Tab(
                  child: Text([
                    'Text',
                    'Icons',
                    'Images',
                    'Simple Form',
                    'Proper Form'
                  ][i]),
                ),
              ),
            ],
          ),
Randal Schwartz

Something like

tabs:
  'Text/Icons/Images/Simple Form/Proper Form'.split('/').
    map((e) => Tab(child: Text(e)).toList();

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How to fill a Map<String, List<String>> from a text file ? -Difficulites dynamically naming each List

来自分类Dev

How to create a constructor initialized with a list?

来自分类Dev

How store/save HashMap<String, List<String>>

来自分类Dev

Select single column as list from existing list using fieldname as string

来自分类Dev

List <String>减去List <String>

来自分类Dev

List <String>减去List <String>

来自分类Dev

Remove words from the string which are present in list

来自分类Dev

List <List <String >>到ArrayList <List <String >>

来自分类Dev

Play Framework: how to display a Future[List[String]]?

来自分类Dev

List(of String())包含String()

来自分类Dev

Map <String,List>或List <List>的休眠注释

来自分类Dev

Map <String,List>或List <List>的休眠注释

来自分类Dev

在scala中打印List [List [List [String]]]

来自分类Dev

Python 3: How to move an item from list x to list y and remove it from list x?

来自分类Dev

Passing Hashmap<String, List<MyModelClass>> from Spring Rest Controller resulting in HashMap<String, List<LinkedHashMap>>

来自分类Dev

create dropdown list from database in laravel via controller

来自分类Dev

How to list all items from QListWidget

来自分类Dev

How to get a value from keyvalue pair list?

来自分类Dev

How to return item index from list SML?

来自分类Dev

How to extract from this list of tuples and convert into this dictionary?

来自分类Dev

将List <List <object >>转换为List <List <string >>

来自分类Dev

WCF代理将List <string []>转换为List <List <string >>

来自分类Dev

LINQ从List <List <string >>获取List <string>以及任何

来自分类Dev

SqlDataReader读入List <string>

来自分类Dev

SqlDataReader读入List <string>

来自分类Dev

确定List <string []>枢轴

来自分类Dev

循环遍历 List<string[]>

来自分类Dev

如何显示 List<String>?

来自分类Dev

List<string> 和 string[] WCF?

Related 相关文章

  1. 1

    How to fill a Map<String, List<String>> from a text file ? -Difficulites dynamically naming each List

  2. 2

    How to create a constructor initialized with a list?

  3. 3

    How store/save HashMap<String, List<String>>

  4. 4

    Select single column as list from existing list using fieldname as string

  5. 5

    List <String>减去List <String>

  6. 6

    List <String>减去List <String>

  7. 7

    Remove words from the string which are present in list

  8. 8

    List <List <String >>到ArrayList <List <String >>

  9. 9

    Play Framework: how to display a Future[List[String]]?

  10. 10

    List(of String())包含String()

  11. 11

    Map <String,List>或List <List>的休眠注释

  12. 12

    Map <String,List>或List <List>的休眠注释

  13. 13

    在scala中打印List [List [List [String]]]

  14. 14

    Python 3: How to move an item from list x to list y and remove it from list x?

  15. 15

    Passing Hashmap<String, List<MyModelClass>> from Spring Rest Controller resulting in HashMap<String, List<LinkedHashMap>>

  16. 16

    create dropdown list from database in laravel via controller

  17. 17

    How to list all items from QListWidget

  18. 18

    How to get a value from keyvalue pair list?

  19. 19

    How to return item index from list SML?

  20. 20

    How to extract from this list of tuples and convert into this dictionary?

  21. 21

    将List <List <object >>转换为List <List <string >>

  22. 22

    WCF代理将List <string []>转换为List <List <string >>

  23. 23

    LINQ从List <List <string >>获取List <string>以及任何

  24. 24

    SqlDataReader读入List <string>

  25. 25

    SqlDataReader读入List <string>

  26. 26

    确定List <string []>枢轴

  27. 27

    循环遍历 List<string[]>

  28. 28

    如何显示 List<String>?

  29. 29

    List<string> 和 string[] WCF?

热门标签

归档