如何将一个容器放入一个容器中,并使容器的边界完全重叠?

How to put a container inside a container with the borders overlaying exactly?

How it should look like

我想创建一个底部有另一个容器的容器。 因为我在两者中都使用了边框,所以我可以看到它们没有重叠。看起来像这样:

有没有办法让它看起来像第一张图?

How it actually looks

我当前的代码是这样的:

                    Container(
                      height: 364.h,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        border: Border.all(
                          width: 5.r,
                        ),
                      ),
                      child: Expanded(
                        child: Align(
                          alignment: FractionalOffset.bottomCenter,
                          child: Container(
                            height: 50.h,
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(10),
                              border: Border.all(
                                width: 5.r,                            
                              ),
                            ),
                          ),
                        ),
                      ),
                    ),

您可以使用 Stack 并使用 alignment 在底部对齐其子项。

 Stack(
  alignment: Alignment.bottomCenter,
  children: [
    Container(
      height: 364.0,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
        border: Border.all(
          width: 5.0,
        ),
      ),
    ),
    Container(
        height: 50.0,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10),
          border: Border.all(
            width: 5.0,
          ),
        ),
      )
  ],
);