feat(): navigate to meals'es category + meal card
parent
3c94b603a5
commit
083a617c95
@ -0,0 +1,75 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:meals/models/Meal.dart';
|
||||||
|
import 'package:meals/widgets/meal_item%20treat.dart';
|
||||||
|
import 'package:transparent_image/transparent_image.dart';
|
||||||
|
|
||||||
|
class MealItem extends StatelessWidget {
|
||||||
|
final Meal meal;
|
||||||
|
const MealItem({Key? key, required this.meal}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Card(
|
||||||
|
margin: const EdgeInsets.all(8),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
elevation: 2,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {},
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
FadeInImage(
|
||||||
|
placeholder: MemoryImage(kTransparentImage),
|
||||||
|
image: NetworkImage(meal.imageUrl),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
height: 200,
|
||||||
|
width: double.infinity,
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
color: Colors.black54,
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(vertical: 6, horizontal: 44),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
meal.title,
|
||||||
|
maxLines: 2,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
softWrap: true,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
MealItemTreat(
|
||||||
|
icon: Icons.schedule,
|
||||||
|
label: '${meal.duration} mins.'),
|
||||||
|
MealItemTreat(
|
||||||
|
icon: Icons.work, label: meal.beautifulComplexity),
|
||||||
|
MealItemTreat(
|
||||||
|
icon: Icons.attach_money,
|
||||||
|
label: meal.beautifulAffordability),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class MealItemTreat extends StatelessWidget {
|
||||||
|
final IconData icon;
|
||||||
|
final String label;
|
||||||
|
const MealItemTreat({Key? key, required this.icon, required this.label})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Icon(icon, size: 17, color: Colors.white),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue