
해당 그림자를 없애기 위해서는
return Scaffold(
appBar: AppBar(
elevation: 0.
),
Icon이 기본적으로 하얀색 default이기 때문에, 색을 변경을 원할시 IconThemeData widget사용 필요
iconTheme: IconThemeData(color: Colors.black),
아이폰의 경우 appbar의 title이 기본적으로 중앙에 오게 배치, 이를 false로 만들어주면 왼쪽 정렬 되게 됨.
centerTitle: false,

return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.white,
centerTitle: false,
iconTheme: IconThemeData(color: Colors.black),
title: Text("Food Recipe",
style: TextStyle(
color: Colors.black,
fontSize: 28,
fontWeight: FontWeight.bold,
)),
actions: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.person_outline,
))
],
),
Column(
children: [],
),
TextField(),
해당 영역에 대해서 ListView(), 를 생성해주며, 다른 요소들과 섞인 Column 영역에 들어갈 경우 반드시 expanded라는 요소로 묶어주어야 에러가 나지 않음.
( 왜? ListView가 어느 영역까지 차지 할지에 대한 정의를 해주지 않았기 때문.)
( 왜 expanded? : 가능한 한 최대한의 영역까지 볼 수 있도록 )
TextField와 함께 있는데도 Listview에 대한 영역 지정 없기 때문
body: Column(
childred: [
TextField(),
ListView(),
]
body: Column(
childred: [
TextField(),
Expanded(chile: ListView()),
]
ListView.builder()의 2가지 핵심인자
dataList.length
//datalist의 길이만큼
Expanded(
child: ListView.builder(
itemCount: dataList.length,
itemBuilder: (context, index) {
return Text(dataList[index]['category']!);
}),
)
TextField(),
에서 묶으면
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(),
),
이렇게 묶임.
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
decoration: InputDecoration(
hintText: "상품을 검색해주세요.",
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black),
)),
),
),
IconButton안에 icon을 불러서, 불러낼 icon을 Icon으로 묶어줌.
그리고 icon의 경우 onPressed함수 무조건 있어야 에러 발생하지 않음.
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {},
)
Divider(height: 1),
Stack는 children을 받음.
뒤에 오는 것 - 위에 깔림
앞 - 아래에 깔림

다음과 같이 요소가 중첩되어야 할때 사용
return Card(
child: Stack(
alignment: Alignment.center,
children: [
Image.network(
imgUrl,
width: double.infinity,
height: 120,
),
Text(category),
],
));
이미지가 상자에 꽉차도록 설정
children: [
Image.network(
imgUrl, //imgUrl에 있는 이미지 불러옴
width: double.infinity, //좌우로는 확장될 수 있는 곳까지 노출되도록 설정
height: 120, //높이는 한정해줌
fit: BoxFit.cover, //사진이 크기에 맞지 않아도, 높이에 맞춰 좌우를 잘라먹는게 아니라 최대한 펼쳐서 꽉차게 보이게 노출되도록 설정
),
기존 이미지 위에 올라와야하기 때문에, 이미지랑 동일한 크기로 설정
이후 반투명한 효과를 주고 싶다면, color.black.withOpacity(0.5), 설정 부여
Container(
width: double.infinity,
height: 120,
color: Colors.black.withOpacity(0.5),
),
style: TextStyle로 묶은 후 하얀색으로 설정
Text(
category,
style: TextStyle(
color: Colors.white,
fontSize: 36,
),
),
drawer: Drawer(
child: Column(
children: [
DrawerHeader(
decoration: BoxDecoration(color: Colors.amber),
child: SizedBox(
width: double.infinity,
child: Column(children: [
CircleAvatar(
radius: 36,
backgroundColor: Colors.white,
child: Image.network(
"https://i.ibb.co/CwzHq4z/trans-logo-512.png",
),
)
]),
),
),

SizedBox 활용
child: Column(children: [
CircleAvatar(
radius: 36,
backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network(
"https://i.ibb.co/CwzHq4z/trans-logo-512.png",
),
),
),
SizedBox(height: 16), //이렇게 SizedBox를 넣어주면 여백이 생김!
Text(
"닉네임",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
Text(
"hello@world.com",
style: TextStyle(fontSize: 16),
)
]),

Drawerheader안에 margin 넣어주면 됨.
margin: const EdgeInsets.all(0),

예)


ListTile(
title: Text(
"저장한 레시피",
style: TextStyle(fontSize: 18),
),
trailing: Icon(
Icons.arrow_forward_ios,
color: Colors.black,
),
onTap: () {
Navigator.pop(context);
},
),
홈으로 가도록 설정한 예시

drawer 정도까지 만듬..
return Scaffold(
appBar: AppBar(
elevation: 0,
title: Text(
'Food Recipe',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 30, color: Colors.black, fontWeight: FontWeight.bold),
),
backgroundColor: Colors.amber,
actions: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.person_outline,
))
IconButton(
icon: Icon(
Icons.perm_identity,
Icons.settings,
color: Colors.black,
),
),
],
),
body: Column(children: [
Text('Search for the products'),
Expanded(
child: ListView.builder(
itemCount: dataList.length,
itemBuilder: (context, index) {
return Text(dataList[index]['category']!);
}),
)
]),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text('Drawer Header'),
),
ListTile(
title: const Text('구매내역'),
)
],
),
),
);