Flutter 在一行内对齐扁平按钮
我想将一行中的FlatButton小部件与顶部对齐 不幸的是,似乎存在某种边界,不允许FlatButton(Add+)小部件移动到顶部 Align小部件正在工作,但只起到了最低限度的作用。这是我的密码:Flutter 在一行内对齐扁平按钮,flutter,Flutter,我想将一行中的FlatButton小部件与顶部对齐 不幸的是,似乎存在某种边界,不允许FlatButton(Add+)小部件移动到顶部 Align小部件正在工作,但只起到了最低限度的作用。这是我的密码: return Container( height: 70.0, decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Colors.g
return Container(
height: 70.0,
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey))),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Align(
alignment: Alignment.topLeft,
child: Padding(
padding: EdgeInsets.only(top: 6.0),
child: Text(
'Designations:',
style: TextStyle(
color: Colors.grey.shade600,
fontSize: 13.0,
),
),
),
),
Align(
alignment: Alignment.topRight,
child: ButtonTheme(
height: 30.0,
// child: Container(),
child: FlatButton(
color: Colors.blueGrey.shade200,
onPressed: () {},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0)),
child: Text(
'Add +',
style: TextStyle(color: Colors.black),
),
),
),
)
],
),
),
);
返回容器(
身高:70.0,
装饰:盒子装饰(
边框:边框(底部:边框边(颜色:Colors.grey)),
孩子:填充(
填充:边缘设置。对称(垂直:8.0),
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
对齐(
对齐:alignment.topLeft,
孩子:填充(
填充:仅限边缘设置(顶部:6.0),
子:文本(
“名称:”,
样式:TextStyle(
颜色:Colors.grey.shade600,
字体大小:13.0,
),
),
),
),
对齐(
对齐:alignment.topRight,
孩子:ButtonTheme(
身高:30.0,
//子级:容器(),
孩子:扁平按钮(
颜色:Colors.blueGrey.shade200,
按下:(){},
形状:圆形矩形边框(
边界半径:边界半径。圆形(8.0)),
子:文本(
“添加+”,
样式:TextStyle(颜色:Colors.black),
),
),
),
)
],
),
),
);
将此添加到FlatButton以删除默认填充:
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
试着用展开按钮包装扁平按钮。