107 lines
2.3 KiB
Dart
107 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../modules/search/grocery_item.dart';
|
|
|
|
class GroceryCard extends StatelessWidget {
|
|
final GroceryItem item;
|
|
final VoidCallback onTap;
|
|
|
|
const GroceryCard({
|
|
super.key,
|
|
required this.item,
|
|
required this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: Card(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(item.emoji, style: const TextStyle(fontSize: 30)),
|
|
Text(item.name),
|
|
Text(item.quantity),
|
|
Text(item.inCart ? "Added" : "Add"),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class StoreCard extends StatelessWidget {
|
|
final dynamic storeData;
|
|
|
|
const StoreCard({
|
|
super.key,
|
|
required this.storeData,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final store = storeData["store"];
|
|
|
|
return Container(
|
|
margin: const EdgeInsets.only(
|
|
bottom: 15,
|
|
),
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius:
|
|
BorderRadius.circular(20),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
store["name"],
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
Text(store["address"]),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"₹${store["total_discounted_price"]}",
|
|
style: const TextStyle(
|
|
fontSize: 24,
|
|
color: Colors.green,
|
|
fontWeight:
|
|
FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
|
|
ElevatedButton(
|
|
onPressed: () {},
|
|
child: const Text(
|
|
"Select Store",
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
Text(
|
|
"Save ₹${store["total_savings"]}",
|
|
style: const TextStyle(
|
|
color: Colors.green,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |