fix checkout/cart

This commit is contained in:
Phuoc Nguyen
2025-11-20 10:44:51 +07:00
parent 0708ed7d6f
commit 1fcef52d5e
7 changed files with 271 additions and 100 deletions

View File

@@ -34,61 +34,45 @@ class CheckoutSubmitButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
return Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.md),
child: Column(
children: [
// Terms Agreement Text
const Text(
'Bằng việc đặt hàng, bạn đồng ý với các điều khoản và điều kiện của chúng tôi',
style: TextStyle(fontSize: 12, color: AppColors.grey500),
textAlign: TextAlign.center,
),
const SizedBox(height: AppSpacing.md),
// Place Order / Send Negotiation Button
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
// Validate address is selected
if (selectedAddress == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Vui lòng chọn địa chỉ giao hàng'),
backgroundColor: AppColors.danger,
duration: Duration(seconds: 2),
),
);
return;
}
if (formKey.currentState?.validate() ?? false) {
_handlePlaceOrder(context);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: needsNegotiation
? AppColors.warning
: AppColors.primaryBlue,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.button),
),
child: ElevatedButton(
onPressed: () {
// Validate address is selected
if (selectedAddress == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Vui lòng chọn địa chỉ giao hàng'),
backgroundColor: AppColors.danger,
duration: Duration(seconds: 2),
),
child: Text(
needsNegotiation ? 'Gửi yêu cầu đàm phán' : 'Đặt hàng',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
);
return;
}
if (formKey.currentState?.validate() ?? false) {
_handlePlaceOrder(context);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: needsNegotiation
? AppColors.warning
: AppColors.primaryBlue,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppRadius.button),
),
],
),
child: Text(
needsNegotiation ? 'Gửi yêu cầu đàm phán' : 'Đặt hàng',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
);
}