flutter - 为什么我不能在颤动中更改凸起按钮的宽度和高度属性?
问题描述
我正在开发这个简单的应用程序,我似乎无法更改凸起按钮的宽度和高度属性,我也尝试使用平面按钮,但它也不起作用。这是一个屏幕截图
Row (mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
RaisedButton(
height: 20,
color: Colors.green,
onPressed: () {
setState(() { });
},
错误消息:未定义命名参数“高度”。尝试将名称更正为现有命名参数的名称,或使用名称“height”定义命名参数。
解决方案
你应该用其他通过他的约束的小部件包装你的 Raised Button,比如 Container
Container(
width: 200,
height: 50,
child: RaisedButton(
onPressed: this.action,
color: Colors.blue,
child: Text('Title', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
),
)
推荐阅读
- sql-server - 哪些表包含工作类别类和类型?
- python - 有没有办法使用另一个列表的索引将项目添加到熊猫列内的列表中?
- c - 无法获得正确的阵列定位器长度
- c# - 如何检测连接的 USB 设备是 android 还是 iphone?(C#)
- python - mypy - 可使用派生类调用会出错
- python - Azure 应用服务:从 FTP 下载文件突然停止
- javascript - 如何在JS中将每一行变成一个列表
- java - Windows 上的 Java 无法列出 cacerts
- javascript - 如何在 AJAX 回调中编写整个图表选项创建?
- postgresql - 如何从 sequelize join 中删除 hasMany id 属性?