productRow method

Widget productRow(
  1. BuildContext context,
  2. _ViewModel vm,
  3. Product product
)

Implementation

Widget productRow(
  BuildContext context,
  _ViewModel vm,
  Product product,
) {
  return Row(
    children: [
      Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: const EdgeInsets.all(8.0),
            child: Icon(Icons.local_mall),
          ),
        ],
      ),
      Expanded(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              "${product.title}",
              style: TextStyle(
                fontWeight: FontWeight.bold,
              ),
            ),
            Text(
              "${product.description}",
              style: Theme.of(context).textTheme.bodySmall,
            ),
            Text("ID: ${product.id}",
                style: Theme.of(context).textTheme.bodySmall),
            Text("${product.price}",
                style: Theme.of(context).textTheme.bodySmall),
            Text(
              product.isValidString(),
              style: Theme.of(context).textTheme.bodyMedium!.merge(
                    TextStyle(
                      fontWeight: FontWeight.bold,
                      color: product.validColor(),
                    ),
                  ),
            ),
          ],
        ),
      ),
      Column(
        crossAxisAlignment: CrossAxisAlignment.end,
        children: [
          GestureDetector(
            onTap: () {
              vm.store.dispatch(PurchaseProductAction(productID: product.id));
            },
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Chip(
                label: Text("Buy Now",
                    style: Theme.of(context).textTheme.bodySmall),
              ),
            ),
          ),
        ],
      )
    ],
  );
}