0
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,
                        minimumSize: Size(40, 20),
                        backgroundColor: colorSet.buttonForeground,
                      ),
                      onPressed: () {},
                      child: Text(
                        'Specific Days',
                        style: TextStyle(
                          color: colorSet.text,
                          fontSize: 12,
                        ),
                      ),
                    ),
                  ],
                ),
                Row(
                  children: [
                    ElevatedButton(
                      style: TextButton.styleFrom(
                        padding: EdgeInsets.zero,
                        minimumSize: Size(40, 20),
                        backgroundColor: colorSet.buttonForeground,
                      ),
                      onPressed: () {},
                      child: Text(
                        'Daily',
                        style: TextStyle(
                          color: colorSet.text,
                          fontSize: 12,
                        ),
                      ),
                    ),
                    SizedBox(
                      width: 3,
                    ),
                    ElevatedButton(
                      style: TextButton.styleFrom(
                        padding: EdgeInsets.zero,
                        minimumSize: Size(40, 20),
                        backgroundColor: colorSet.buttonForeground,
                      ),
                      onPressed: () {},
                      child: Text(
                        'Weekly',
                        style: TextStyle(
                          color: colorSet.text,
                          fontSize: 12,
                        ),
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ))

嗨,我在颤振方面相对较新。我正在尝试为家务制作一张卡片,而卡片的这个特定部分给我带来了问题。我不知道,为什么每行之间有这么大的垂直空间(每行基本上有两个按钮)。我已经尝试了几件事来解决这个问题,但我现在放弃了,来这里寻求建议。谢谢!布局视图。

4

1 回答 1

0

试试这个,去掉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,
                        minimumSize: Size(40, 20),
                        backgroundColor: colorSet.buttonForeground,
                      ),
                      onPressed: () {},
                      child: Text(
                        'Specific Days',
                        style: TextStyle(
                          color: colorSet.text,
                          fontSize: 12,
                        ),
                      ),
                    ),
                  ],
                ),
                Row(
                    mainAxisAlignment:MainAxisAlignment.spaceBetween, 
                  children: [
                    ElevatedButton(
                      style: TextButton.styleFrom(
                        padding: EdgeInsets.zero,
                        minimumSize: Size(40, 20),
                        backgroundColor: colorSet.buttonForeground,
                      ),
                      onPressed: () {},
                      child: Text(
                        'Daily',
                        style: TextStyle(
                          color: colorSet.text,
                          fontSize: 12,
                        ),
                      ),
                    ),
                   
                    ElevatedButton(
                      style: TextButton.styleFrom(
                        padding: EdgeInsets.zero,
                        minimumSize: Size(40, 20),
                        backgroundColor: colorSet.buttonForeground,
                      ),
                      onPressed: () {},
                      child: Text(
                        'Weekly',
                        style: TextStyle(
                          color: colorSet.text,
                          fontSize: 12,
                        ),
                      ),
                    ),
                  ],
                ),
              ],
          )) 
于 2021-06-25T15:22:00.040 回答