繁体   English   中英

如何使用while或for来创建按钮?

[英]How to create button using while or for in flutter?

我想根据排列的长度来制作按钮。 但我不知道,因为我是发烧级的入门者。

Widget menubar = Center(
          child: Container(
            padding: const EdgeInsets.all(20),
            child: Row(
              children: <Widget>[
                // I want make some button here button number is 10
              ],
             ),//Row
            ),//Container
           );//Center

我不知道我是否完全了解您,但也许您可以尝试以下方法:

Widget menubar = Center(
    child: Container(
      padding: const EdgeInsets.all(20),
      child: Row(
        children: List.generate(10, (index) => RaisedButton(
          child: Text("Button number $index"),
        )),
      ),//Row
    ),//Container
  );//Center

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM