问题描述
Positioned(
bottom: 15,left: 15,child: SizedBox(
height: 100,child: Column(
children: [
Row(
children: [
ElevatedButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,minimumSize: Size(40,20),backgroundColor: colorSet.buttonForeground,),onpressed: () {},child: Text(
'Once',style: TextStyle(
color: colorSet.text,fontSize: 12,SizedBox(
width: 8,ElevatedButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,child: Text(
'Specific Days',],Row(
children: [
ElevatedButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,child: Text(
'Daily',SizedBox(
width: 3,child: Text(
'Weekly',))
嗨,我对 Flutter 比较陌生。我正在尝试为家务制作一张卡片,而卡片的这一特定部分给我带来了问题。 我不知道,为什么每行之间有这么多垂直空间(每行基本上有两个按钮)。我已经尝试了几件事来解决这个问题,但我现在放弃并来这里寻求建议。 谢谢!
解决方法
试试这个,去掉 Sizedbox(height:100)
另外,您可以删除行内的 SizedBox(width : 8)
并尝试 Row(mainAxisAlignment:MainAxisAlignment.spaceBetween,children:[]);
Positioned(
bottom: 15,left: 15,child: Column(
children: [
Row(
mainAxisAlignment:MainAxisAlignment.spaceBetween,children: [
ElevatedButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,minimumSize: Size(40,20),backgroundColor: colorSet.buttonForeground,),onPressed: () {},child: Text(
'Once',style: TextStyle(
color: colorSet.text,fontSize: 12,ElevatedButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,child: Text(
'Specific Days',],Row(
mainAxisAlignment:MainAxisAlignment.spaceBetween,child: Text(
'Daily',child: Text(
'Weekly',))