forked from markandey007/hacktoberfest_2022
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmealItem.dart
117 lines (112 loc) · 3.58 KB
/
mealItem.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:shopmeals/model/meal.dart';
class MealItem extends StatelessWidget {
final String imageUrl;
final String title;
final int duration;
final Complexity complexity;
final Affordability affordability;
MealItem(
{@required this.title,
@required this.duration,
@required this.affordability,
@required this.complexity,
@required this.imageUrl,
Key key})
: super(key: key);
void SelectMeal() {}
String get complexityTest {
if (complexity == Complexity.Simple) return "Simple";
if (complexity == Complexity.Challenging) return "Challenging";
if (complexity == Complexity.Hard) return "Hard";
}
String get affordabilityTest {
if (affordability == Affordability.Pricey) return "Pricey";
if (affordability == Affordability.Luxurious) return "Expensive";
if (affordability == Affordability.Affordable) return "Affordable";
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: SelectMeal,
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
elevation: 4,
margin: const EdgeInsets.all(10),
child: Column(
children: [
Stack(
children: [
ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
child: Image.network(
imageUrl,
height: 250,
width: double.infinity,
fit: BoxFit.cover,
),
),
Positioned(
bottom: 20,
right: 10,
child: Container(
padding: EdgeInsets.all(5),
width: 300,
color: Colors.black54,
child: Text(
title,
style: TextStyle(fontSize: 24, color: Colors.white),
overflow: TextOverflow.fade,
softWrap: true,
),
),
)
],
),
Padding(
padding: EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
children: [
Icon(Icons.schedule),
SizedBox(
width: 6,
),
Text('$duration'),
],
),
Row(
children: [
Icon(Icons.work),
SizedBox(
width: 6,
),
Text(complexityTest),
],
),
Row(
children: [
Icon(Icons.attach_money),
SizedBox(
width: 6,
),
Text(affordabilityTest),
],
),
],
))
],
),
),
);
}
}