它應該是什么樣子
我想創建一個底部有另一個容器的容器。因為我在它們兩個中都使用了邊框,我可以看到它們沒有重疊。看起來像這樣:
有沒有辦法讓它看起來像第一張照片?
它的實際外觀
我當前的代碼如下所示:
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,
),
),
),
),
),
),
uj5u.com熱心網友回復:
您可以使用Stack并使用對齊方式在底部對齊其子項。
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,
),
),
)
],
);
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/334714.html
