Flutter
[Flutter, 토이 프로젝트] 위젯 사이의 간격 간편하게 주고 싶을 때 - SizedBox
hminor
2023. 8. 22. 23:52
반응형
목적
- Row() 위젯에 추가한 Icon 간의 간격을 간편하게
- CSS의 word-spacing 처럼 요소 간의 간격을 쉽게 주고 싶었지만...
- 계속된 Container로 감싼 다음 margin 을 주는 노가다를 하게 되어 찾게 된 방법.
코드
- SizedBox() 위젯을 추가하여 공간만 차지하게 만들어주기
Container(
child: Row(
children: [
Icon(Icons.search),
SizedBox(width: 10),
Icon(Icons.notification_add_outlined),
SizedBox(width: 10),
Icon(Icons.menu)
],
),
)