背景知識
有使用到 Container 可參考Flutter-最簡單的 Container 使用範例
介紹內容
給予 widget 對齊方式,支援左上(topLeft)、上中(topCenter)、上右(topRight)、左中(centerLeft)、中心(center)、中右(centerRight)、下左(bottomLeft)、下中(bottomCenter)、下右(bottomRight)
使用方法
使用 Align 包裹一個 Container , 預設為 center 所以顯示如下圖
Align(
child: Container(
width: 100,
height: 100,
color: Colors.red,
),
);

下面測試其他格式
topLeft | topCenter | topRight |
![]() | ![]() | ![]() |
centerLeft | center | centerRight |
![]() | ![]() | ![]() |
bottomLeft | bottomCenter | bottomRight |
![]() | ![]() | ![]() |