8000 Tambahkan widget GestureDetector untuk setiap item di UI List Meals · CoderJava/Food-Recipe@5d588d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5d588d3

Browse files
committed
Tambahkan widget GestureDetector untuk setiap item di UI List Meals
1 parent 01016b3 commit 5d588d3

File tree

1 file changed

+66
-59
lines changed

1 file changed

+66
-59
lines changed

lib/src/ui/listmeals/list_meals.dart

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -69,70 +69,77 @@ class _ListMealsState extends State<ListMeals> {
6969
filterCategories.filterCategoryItems[index];
7070
return Padding(
7171
padding: const EdgeInsets.only(bottom: 16.0),
72-
child: Card(
73-
elevation: 8.0,
74-
shape: RoundedRectangleBorder(
75-
borderRadius: BorderRadius.circular(16.0),
76-
),
77-
child: ClipRRect(
78-
borderRadius: BorderRadius.circular(16.0),
79-
child: Stack(
80-
children: <Widget>[
81-
FadeInImage(
82-
image: NetworkImage(
83-
filterCategoryItem.strMealThumb),
84-
placeholder: AssetImage(
85-
"assets/images/img_not_found.jpg"),
86-
fit: BoxFit.cover,
87-
width: double.infinity,
88-
height: mediaQuery.size.width / 1.5,
89-
),
90-
Container(
91-
width: double.infinity,
92-
height: mediaQuery.size.width / 1.5,
93-
decoration: BoxDecoration(
94-
gradient: LinearGradient(
95-
begin: Alignment.topCenter,
96-
end: Alignment.bottomCenter,
97-
stops: [
98-
0.1,
99-
0.9
100-
],
101-
colors: [
102-
Color(0xFFFFFFFF),
103-
Color(0x00FFFFFF),
104-
]),
72+
child: GestureDetector(
73+
onTap: () {
74+
// TODO: do something in here
75+
print("tap item list meals");
76+
},
77+
child: Card(
78+
elevation: 8.0,
79+
shape: RoundedRectangleBorder(
80+
borderRadius: BorderRadius.circular(16.0),
81+
),
82+
child: ClipRRect(
83+
borderRadius: BorderRadius.circular(16.0),
84+
child: Stack(
85+
children: <Widget>[
86+
FadeInImage(
87+
image: NetworkImage(
88+
filterCategoryItem.strMealThumb),
89+
placeholder: AssetImage(
90+
"assets/images/img_not_found.jpg"),
91+
fit: BoxFit.cover,
92+
width: double.infinity,
93+
height: mediaQuery.size.width / 1.5,
10594
),
106-
),
107-
Padding(
108-
padding: const EdgeInsets.all(16.0),
109-
child: Row(
110-
crossAxisAlignment: CrossAxisAlignment.start,
111-
children: <Widget>[
112-
Expanded(
113-
child: Text(
114-
filterCategoryItem.strMeal,
115-
style:
116-
Theme.of(context).textTheme.title,
117-
maxLines: 2,
95+
Container(
96+
width: double.infinity,
97+
height: mediaQuery.size.width / 1.5,
98+
decoration: BoxDecoration(
99+
gradient: LinearGradient(
100+
begin: Alignment.topCenter,
101+
end: Alignment.bottomCenter,
102+
stops: [
103+
0.1,
104+
0.9
105+
],
106+
colors: [
107+
Color(0xFFFFFFFF),
108+
Color(0x00FFFFFF),
109+
]),
110+
),
111+
),
112+
Padding(
113+
padding: const EdgeInsets.all(16.0),
114+
child: Row(
115+
crossAxisAlignment: CrossAxisAlignment.start,
116+
children: <Widget>[
117+
Expanded(
118+
child: Text(
119+
filterCategoryItem.strMeal,
120+
style:
121+
Theme.of(context).textTheme.title,
122+
maxLines: 2,
123+
),
118124
),
119-
),
120-
GestureDetector(
121-
onTap: () {
122-
// TODO: do something in here
123-
},
124-
child: CircleAvatar(
125-
backgroundColor: Color(0xAFE8364B),
126-
child: Icon(
127-
Icons.favorite_border,
128-
color: Colors.white,
125+
GestureDetector(
126+
onTap: () {
127+
// TODO: do something in here
128+
print("tap favorite");
129+
},
130+
child: CircleAvatar(
131+
backgroundColor: Color(0xAFE8364B),
132+
child: Icon(
133+
Icons.favorite_border,
134+
color: Colors.white,
135+
),
129136
),
130137
),
131-
),
132-
],
138+
],
139+
),
133140
),
134-
),
135-
],
141+
],
142+
),
136143
),
137144
),
138145
),

0 commit comments

Comments
 (0)
0