이미지 정렬하기

김동준·2025년 12월 31일

문제

이미지를 원하는 비율로 정렬

과정

ColumnCenter 로 감싸주어 가로기준 가운데로 정렬해줌

Spacer 와 그 속성인 flex 를 사용하여 세로비율 조정해줌

해결

body: Center(
        child: Column(
          children: [
            Spacer(flex: 1),
            Image.asset('assets/images/empty_page.png', height: 200),
            Text(
              "등록된 상품이 없습니다.",
              style: TextStyle(color: AppColors.textPrimary),
            ),
            Text(
              "+ 버튼을 눌러 첫 상품을 등록해보세요!",
              style: TextStyle(color: AppColors.textSecondary),
            ),
            Spacer(flex: 2),
          ],

0개의 댓글