123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import 'package:flutter/material.dart';
- import 'package:fooddeliveryapp/constants.dart';
- import 'package:fooddeliveryapp/model/product.dart';
- class ItemCard extends StatelessWidget {
- final Product product;
- final Function press;
- const ItemCard({
- Key key,
- this.product,
- this.press,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: press,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Expanded(
- child: Container(
- padding: EdgeInsets.all(kDefaultPaddin),
- // For demo we use fixed height and width
- // Now we dont need them
- // height: 180,
- // width: 160,
- decoration: BoxDecoration(
- color: product.color,
- borderRadius: BorderRadius.circular(16),
- ),
- child: Hero(
- tag: "${product.id}",
- child: Image.asset(product.image),
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.symmetric(vertical: kDefaultPaddin / 4),
- child: Text(
- // products is out demo list
- product.title,
- style: TextStyle(color: kTextLightColor),
- ),
- ),
- Text(
- "\$${product.price}",
- style: TextStyle(fontWeight: FontWeight.bold),
- )
- ],
- ),
- );
- }
- }
|