[Flutter] EdgeInsets

2023. 9. 18. 13:13FrontEnd & Mobile/Flutter

EdgeInsets란?

padding, margin과 같이 특정 위젯의 상하좌우에 여백을 두기 위해 자주 사용하는 클래스입니다

 

EdgeInsets.all

모든 방향에 같은 값

//all
const EdgeInsets.all(7.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); //위아래 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);

 

 

 

 


출처

https://api.flutter.dev/flutter/painting/EdgeInsets-class.html

'FrontEnd & Mobile > Flutter' 카테고리의 다른 글

[Flutter] Flutter와 Firebase를 이용한 넷플릭스 클론 코딩  (0) 2023.11.26
[Flutter] @override  (0) 2023.09.15
[Flutter] MaterialApp  (1) 2023.09.15
[Flutter] Scaffold Widget  (0) 2023.09.15