본문 바로가기
프로그래밍/Flutter & Dart

[Flutter] EdgeInsets class

by 소꿍 2021. 8. 15.

EdgeInsets class

padding, margin과 같이 여백을 줄 때 사용한다.

 

EdgeInsets.all - 모든 방향에 같은 값

// all
const EdgeInsets.all(8.0); // 모든 방향으로 8pixels의 여백

 

EdgeInsets.only - 한 방향

// only
const EdgeInsets.only(left: 40.0); // 왼쪽에만 40pixels의 여백

 

EdgeInsets.symmetric - 수직 혹은 수평

// symmetric
const EdgeInsets.symmetric(
	{double vertical = 0.0,
	double horizontal = 0.0}
)

const EdgeInsets.symmetric(vertical: 8.0); // ex. 위아래 8pixels의 여백

 

EdgeInsets.fromLTRB - 상하좌우 값을 각각 설정 가능

// fromLTRB
const EdgeInsets.fromLTRB(
	double left,
	double top,
	double right,
	double bottom
)

// left, right은 8.0, top, bottom은 10.0pixels의 여백
const EdgeInsets.fromLTRB(8.0, 10.0, 8.0, 10.0);

 

댓글