flutter - 如何在颤动中使用while或for创建按钮?
问题描述
我想根据排列的长度制作按钮。但我不知道,因为我是颤振的首发。
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
推荐阅读
- python - 如何在gensim中使用cosssim
- typescript - 来自类型参数的 Typescript 类型推断
- python - statsmodel.SARIMAX .forecast() 方法不执行
- reactjs - 尝试在 ReactDOM.render 中使用 React Hooks。这样对吗?
- tfs - TFS 查询按受理人显示所有任务
- selenium - Angular CLI 7:如何在 e2e 中使用随机端口?
- php - 原始 MySQL 中的 Laravel Eloquent 的 belongsTo 等价物是什么
- java - ScheduledThreadPoolExecutor 不等待 TimerTask 终止
- javascript - 颜色条没有显示在我的地图顶部(使用 d3 的传单)
- inno-setup - 在 Inno Setup 脚本中提供 SignTool 配置