[Flutter] IconButton 기본 여백(padding) 삭제

조형민·2022년 8월 9일
0

Flutter

목록 보기
8/10

일반적으로 아이콘은 위의 그림과 같은 형태를 가진다.
푸른색 음영 부분이 padding인데 padding을 없애면 크기가 줄어들까?

아니다. 전체적인 크기는 그대로 유지가 된다. 이는 버튼의 최소 터치 영역을 48로 유지하기 때문이라고 한다.
이럴 경우에는 constraints 속성을 BoxContraints()로 주면 해결된다.

IconButton(
   padding: EdgeInsets.zero,
   iconSize: 20,
   constraints: BoxConstraints(),

profile
기획하다가 Flutter 배우는 늦깎이 코린이

0개의 댓글