import 'package:flutter/material.dart'; import 'package:fooddeliveryapp/model/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: TextButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.red), shape: MaterialStateProperty.all(RoundedRectangleBorder( borderRadius: BorderRadius.circular(18)))), onPressed: () { ///加入购物车 print("数量:" + count.toString()); pressButton!(); }, child: Text( "结账".toUpperCase(), style: TextStyle( fontSize: 17, fontWeight: FontWeight.bold, color: Colors.white, ), ), ), ), ), ], ), ); } }