[flutter7] SafeArea()

한별onestar·2024년 5월 2일

flutter 실전

목록 보기
7/15
post-thumbnail

SafeArea()

스마트폰 상하단에 요소가 가려지지 않는 영역

  • SafeArea 위젯 사용 전
.
.
.
      body: Container(
        color: Colors.black,
        child: Column(
          children: colors.map((e) => Container(
            width: 50,
            height: 50,
            color: e,
          )
          ).toList(),
        ),
      )

  • SafeArea 위젯 사용 후
body: SafeArea(
        child: Container(
          color: Colors.black,
          child: Column(
            children: colors.map((e) => Container(
              width: 50,
              height: 50,
              color: e,
            )
            ).toList(),
          ),
        ),
      )

SafeArea위젯을 사용하면 요소가 시계와 아랫 부분에 가려지지 않는다.

profile
한별잉

0개의 댓글