flutter - Flutter:TextFormField和RaisedButton对齐在同一行
问题描述
在屏幕底部,优惠券代码文本表单字段和申请按钮有错位。如何将它们设置为具有相同高度并完美对齐的这些小部件?
Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 150,
//color: Colors.blue,
child: TextFormField(
decoration: new InputDecoration(
hintText: 'Coupon Code',
contentPadding: EdgeInsets.all(8),
isDense: true,
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.grey)),
),
),
),
Container(
//color: Colors.green,
padding: EdgeInsets.fromLTRB(15, 0, 0, 15),
child: RaisedButton(
onPressed: () {},
color: Colors.grey[400],
textColor: Colors.black,
child: Text('Apply', style: TextStyle(fontSize: 12)),
),
),
],
)
解决方案
其实我想你会发现这样会有更好的结果。
Container(
padding: EdgeInsets.only(top: 8),
width: 150,
//color: Colors.blue,
child: TextFormField(
decoration: new InputDecoration(
hintText: 'Coupon Code',
contentPadding: EdgeInsets.all(8),
isDense: true,
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.grey)),
),
),
),
让我知道这对你有用
推荐阅读
- c# - 让我的 QR 扫描仪工作时遇到很多麻烦
- python - 在字典列表中查找匹配值并将字符串配对
- android - Firebase 不断删除所有条目,而不是仅删除特定条目
- javascript - 检索和显示 XML 数据
- django - raise AppRegistryNotReady("应用尚未加载。")
- python - 响应没有属性“用户名”
- intershop - ProductLineItem FreeGift 在我们不期望的地方发生了变化
- r - quantmod中是否有类似于“periodReturn”的函数来计算普通差异?
- hyperledger-fabric - 网络版
- android - 嵌套片段:onSaveInstanceState 后无法执行此操作