import 'package:flutter/material.dart';
import 'package:fooddeliveryapp/constants.dart';

class AddToCart extends StatelessWidget {
  final Function pressButton;

  const AddToCart({
    Key key,
    // @required this.product,
    this.count,
    this.pressButton,
  }) : super(key: key);

  // final Product product;
  final int count;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: kDefaultPaddin),
      child: Row(
        children: [
          Expanded(
            child: SizedBox(
              height: 50,
              child: FlatButton(
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(18)),
                // color: product.color,
                color: Colors.red,
                onPressed: () {
                  ///加入购物车
                  print("数量:" + count.toString());
                  pressButton();
                },
                child: Text(
                  "结账".toUpperCase(),
                  style: TextStyle(
                    fontSize: 17,
                    fontWeight: FontWeight.bold,
                    color: Colors.white,
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
