Scaffold(
appBar: //상단 바,
body: //화면 중앙에 가장 큰 면적,
bottomNavigationBar: //하단바,
floatingActionButton://우측 하단
)
텍스트 위젯
style: 꾸밀 때 사용하는 기능.
Textstyle: 텍스트를 꾸밀 때 사용.
📌 자동완성 기능
ctrl/cmd +s : 코드 띄어쓰기 자동완성
ctrl+ Spave : 코드 자동완성
Text(
style:textStyle(
fontsize: 15,//크기
fontWeight: FontWeight.bold,//두께
color: Collors.amber, //색
)
)
Column(
children: [ // 자식 위젯들
Text("위젯1"),
Text("위젯2"),
],
),
body: Column(
children: [
Text(
"Hello world",
style: Textstyle(fontSize: 28),
),
TextField(
decoration: InputDecoration(
labelText: "이메일"
),
),
TextField(
obscureText: true
decoration: InputDecoration(
labelText: "비밀번호"
),
),
],
)
)
버튼
1) 볼록버튼
2) 텍스트 버튼
3) 아이콘 버튼
onpressed : 클릭이벤트를 처리하는 역할
child : 버튼 속의 내용.
// 볼록 버튼
ElevatedButton(
onPressed: () {},//클릭 이벤트
child: Text('Elevated Button'), //버튼 속 내용
),
// 텍스트 버튼
TextButton(
onPressed: () {},
child: Text('Text Button'),
),
// 아이콘 버튼
IconButton(
onPressed: () {},
icon: Icon(Icons.add),
),
AppBar(
centerTitle: true, // 가운데 정렬
title: Text(
"Hello world",
style: TextStyle(fontsize: 28),
),
),
body column ~
1) 모든 방향에 적용
EdgeInsect.all(5)
2) 특정한 방향에만 적용
EdgeInsect.only(
left: 8,
right: 8,
)
3) 위아래 또는 좌우 적용
EdgeInscets.symmrtric(
vertical: 8,
horizontal: 8,
)
~//Appbar
body : Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
TextField(
decoration: InputDecoration(
labelText: "이메일:,
),
섹션을 지정 (여러 children을 모아 하나의 섹션으로 만들어 줌)
예를 들어, body에서 section1, section2...
자식 위젯들을 커스터마이징 할 수 있는 위젯 클래스
여백, 간격, 테두리, 배경색 추가를 할 수 있음
wrap with Container
Container(
width: 200, // 폭
height: 200, // 높이
color: Colors.amber, // 박스 색상
child: Text("I Love Flutter!"), // 자식 위젯
),