Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:convert';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:makola_market/Models/product.dart';
- import 'package:makola_market/Pages/Content%20Cards/contentCard.dart';
- import 'package:makola_market/Pages/productPage.dart';
- import 'package:makola_market/constants.dart';
- class ProductCard extends StatelessWidget {
- final Product product;
- ProductCard(this.product);
- @override
- Widget build(BuildContext context) {
- return ContentCard(
- GestureDetector(
- onTap: () => Navigator.pushNamed(context, ProductPage.routeName,
- arguments: product),
- child: Align(
- alignment: Alignment.centerLeft,
- child: Text(
- product.name,
- style: contentCardText,
- overflow: TextOverflow.ellipsis,
- ))),
- GestureDetector(
- onTap: () => Navigator.pushNamed(context, ProductPage.routeName,
- arguments: product),
- child: Center(
- child: Image(
- image:
- MemoryImage(base64Decode(product.imageStr), scale: 1.5)),
- )),
- Row(
- children: [
- Align(
- alignment: Alignment.centerLeft,
- child: Text(
- '\$${product.price.toStringAsFixed(2)}',
- style: contentCardText,
- ),
- ),
- Align(
- alignment: Alignment.centerRight,
- child: IconButton(
- icon: Icon(
- Icons.add_shopping_cart,
- size: 28,
- ),
- onPressed: null,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ));
- }
- }
Add Comment
Please, Sign In to add comment