@@ -15,24 +15,25 @@ class Home extends StatefulWidget {
15
15
}
16
16
17
17
class _HomeState extends State <Home > {
18
+
18
19
// List<Widget> list=[ ToDayWidget(), ToDayWidget()]; ************
19
20
20
- static List <String > RestaurantName = [
21
- 'sample1' ,
22
- 'sample2' ,
23
- 'sample3' ,
24
- ];
21
+ // static List<String> RestaurantName = [
22
+ // 'sample1',
23
+ // 'sample2',
24
+ // 'sample3',
25
+ // ];
25
26
26
- static List <String > RestaurantImagePath = [
27
- 'images/sample1.jpg' ,
28
- 'images/sample2.jpg' ,
29
- 'images/sample3.jpg' ,
30
- ];
27
+ // static List<String> RestaurantImagePath = [
28
+ // 'images/sample1.jpg',
29
+ // 'images/sample2.jpg',
30
+ // 'images/sample3.jpg',
31
+ // ];
31
32
32
- final List <infinityRestaurant> RestaurantData = List .generate (
33
- RestaurantName .length,
34
- (index) => infinityRestaurant (
35
- RestaurantName [index], RestaurantImagePath [index]));
33
+ // final List<infinityRestaurant> RestaurantData = List.generate(
34
+ // RestaurantName.length,
35
+ // (index) => infinityRestaurant(
36
+ // RestaurantName[index], RestaurantImagePath[index]));
36
37
37
38
@override
38
39
Widget build (BuildContext context) {
@@ -47,29 +48,34 @@ class _HomeState extends State<Home> {
47
48
),
48
49
drawerEdgeDragWidth: 20 ,
49
50
drawerEnableOpenDragGesture: true ,
50
- body: ListView .builder (
51
- itemCount: RestaurantData .length,
52
- itemBuilder: (context, index){
53
- return Card (
54
- child: ListTile (
55
- title: Text (
56
- RestaurantData [index].name
57
- ),
58
- leading: SizedBox (
59
- height: 50 , width: 50 , child: Image .asset (RestaurantData [index].imgPath),
60
- ),
61
- ),
62
- );
63
- },
64
- ),
51
+ body: ListView (children: [
52
+ ToDayWidget (),
53
+ FavorateFood (),
54
+ BestFood (),
55
+ ]),
56
+ );
57
+ }
58
+ }
59
+
65
60
66
- // ListView(
67
- // children: [
68
- // // Row(children: list,), *************
69
- // ToDayWidget(),
70
- // // ToDayWidget(), ToDayWidget(), ToDayWidget(), ToDayWidget(), ToDayWidget(),
71
- // ],
72
- // ),
61
+
62
+
63
+ class FoodWidget extends StatelessWidget {
64
+ const FoodWidget ({Key ? key}) : super (key: key);
65
+
66
+ @override
67
+ Widget build (BuildContext context) {
68
+ return Container (
69
+ child: Column (
70
+ children: [
71
+ Container (
72
+ width: 150 ,
73
+ height: 100 ,
74
+ color: Colors .grey,
75
+ ),
76
+ Text ("음식 이름" ),
77
+ ],
78
+ ),
73
79
);
74
80
}
75
81
}
@@ -78,78 +84,118 @@ class ToDayWidget extends StatelessWidget {
78
84
//const
79
85
ToDayWidget ({Key ? key}) : super (key: key);
80
86
81
- static List <String > RestaurantName = [
82
- 'sample1' ,
83
- 'sample2' ,
84
- 'sample3' ,
85
- ];
86
-
87
- static List <String > RestaurantImagePath = [
88
- 'images/sample1.jpg' ,
89
- 'images/sample2.jpg' ,
90
- 'images/sample3.jpg' ,
91
- ];
92
-
93
- final List <infinityRestaurant> RestaurantData = List .generate (
94
- RestaurantName .length,
95
- (index) => infinityRestaurant (
96
- RestaurantName [index], RestaurantImagePath [index]));
97
-
98
87
@override
99
88
Widget build (BuildContext context) {
100
89
return Padding (
101
90
padding: const EdgeInsets .all (8.0 ),
102
91
child: Column (
103
- // mainAxisAlignment: ,
104
- crossAxisAlignment: CrossAxisAlignment .start,
105
92
children: [
93
+ Text (
94
+ "오늘 이거 어때요?" ,
95
+ style: TextStyle (fontSize: 24 ),
96
+ ),
106
97
Container (
107
- padding: const EdgeInsets .all (8.0 ),
108
- child: Center (child: Text ("오늘 이건 어때요?" )),
109
- width: double .infinity,
110
- decoration: BoxDecoration (
111
- color: Colors .grey[300 ],
112
- borderRadius: BorderRadius .all (Radius .circular (15.0 )),
98
+ height: 160 ,
99
+ child: ListView (
100
+ scrollDirection: Axis .horizontal,
101
+ children: [
102
+ Padding (
103
+ padding: const EdgeInsets .all (16.0 ),
104
+ child: FoodWidget (),
105
+ ),
106
+ Padding (
107
+ padding: const EdgeInsets .all (16.0 ),
108
+ child: FoodWidget (),
109
+ ),
110
+ Padding (
111
+ padding: const EdgeInsets .all (16.0 ),
112
+ child: FoodWidget (),
113
+ ),
114
+ ],
113
115
),
116
+ )
117
+ ],
118
+ ),
119
+ );
120
+ }
121
+ }
122
+
123
+ class FavorateFood extends StatelessWidget {
124
+ //const
125
+ FavorateFood ({Key ? key}) : super (key: key);
126
+
127
+ @override
128
+ Widget build (BuildContext context) {
129
+ return Padding (
130
+ padding: const EdgeInsets .all (8.0 ),
131
+ child: Column (
132
+ children: [
133
+ Text (
134
+ "남성이 좋아하는 음식" ,
135
+ style: TextStyle (fontSize: 24 ),
114
136
),
115
137
Container (
116
- height: 1.0 ,
117
- width: 500 ,
118
- color: Colors .black,
119
- ),
120
- SizedBox (
121
- height: 5 ,
122
- ),
123
- SizedBox (
124
- child: Image .asset ('assets/images/sample1.jpg' ),
138
+ height: 160 ,
139
+ child: ListView (
140
+ scrollDirection: Axis .horizontal,
141
+ children: [
142
+ Padding (
143
+ padding: const EdgeInsets .all (16.0 ),
144
+ child: FoodWidget (),
145
+ ),
146
+ Padding (
147
+ padding: const EdgeInsets .all (16.0 ),
148
+ child: FoodWidget (),
149
+ ),
150
+ Padding (
151
+ padding: const EdgeInsets .all (16.0 ),
152
+ child: FoodWidget (),
153
+ ),
154
+ ],
155
+ ),
156
+ )
157
+ ],
158
+ ),
159
+ );
160
+ }
161
+ }
162
+
163
+ class BestFood extends StatelessWidget {
164
+ //const
165
+ BestFood ({Key ? key}) : super (key: key);
166
+
167
+ @override
168
+ Widget build (BuildContext context) {
169
+ return Padding (
170
+ padding: const EdgeInsets .all (8.0 ),
171
+ child: Column (
172
+ children: [
173
+ Text (
174
+ "최근 일주일 인기 음식점" ,
175
+ style: TextStyle (fontSize: 24 ),
125
176
),
126
177
Container (
127
- child: Center (child: Text (" 갈비탕" )),
128
- decoration: BoxDecoration (color: Colors .grey[300 ]),
129
- ),
130
- Text ("00이 선호하는 음식" ),
131
- Text ("최근 일주일 인기 음식점" ),
132
- Text ("최근 남겨진 리뷰" ),
133
- // ListView.builder(
134
- // itemCount: RestaurantData.length,
135
- // itemBuilder: (context, index){
136
- // return Card(
137
- // child: ListTile(
138
- // title: Text(
139
- // RestaurantData[index].name
140
- // ),
141
- // leading: SizedBox(
142
- // height: 50, width: 50, child: Image.asset(RestaurantData[index].imgPath),
143
- // ),
144
- // ),
145
- // );
146
- // },
147
- // ),
148
- Text ("음식점 이름" ),
149
- Text ("음식점 이름" ),
178
+ height: 160 ,
179
+ child: ListView (
180
+ scrollDirection: Axis .horizontal,
181
+ children: [
182
+ Padding (
183
+ padding: const EdgeInsets .all (16.0 ),
184
+ child: FoodWidget (),
185
+ ),
186
+ Padding (
187
+ padding: const EdgeInsets .all (16.0 ),
188
+ child: FoodWidget (),
189
+ ),
190
+ Padding (
191
+ padding: const EdgeInsets .all (16.0 ),
192
+ child: FoodWidget (),
193
+ ),
194
+ ],
195
+ ),
196
+ )
150
197
],
151
198
),
152
199
);
153
200
}
154
201
}
155
-
0 commit comments