implements tags

This commit is contained in:
2025-02-11 18:42:56 +05:30
parent d230ab8d7f
commit ad7903d1e3
18 changed files with 1231 additions and 2840 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -364,6 +364,14 @@ class AddtocartProvider extends ChangeNotifier {
return result.fold(
(error) {
Fluttertoast.showToast(
msg: "${error.message}",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.green,
textColor: Colors.white,
fontSize: 14.0,
);
ispaymentLoader = false;
notifyListeners();
},
@@ -376,6 +384,15 @@ class AddtocartProvider extends ChangeNotifier {
);
} catch (e) {
ispaymentLoader = false;
Fluttertoast.showToast(
msg: "${e}",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.green,
textColor: Colors.white,
fontSize: 14.0,
);
notifyListeners();
}
}

View File

@@ -19,7 +19,8 @@ class BottomBarWidget extends StatefulWidget {
_BottomBarState createState() => _BottomBarState();
}
class _BottomBarState extends State<BottomBarWidget> {
class _BottomBarState extends State<BottomBarWidget>
{
int _currentIndex = 0;
PageController bottomWidgetPageController = PageController(
initialPage: 0,

View File

@@ -95,207 +95,210 @@ class _MycartState extends State<Mycart> {
Widget relatedProduct() {
return Consumer<ProductProvider>(builder: (context, provider, child) {
if (provider.isBestdealingloading) {
return Center(child: CircularProgressIndicator());
} else if (provider.bestdeal.isEmpty) {
return Center(child: Text('No products available'));
} else {
return SizedBox(
height: MediaQuery.of(context).size.height * 0.28,
child: ListView.builder(
itemCount: provider.bestdeal.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
var bestdealproduct = provider.bestdeal[index];
double cardWidth =
MediaQuery.of(context).size.width * 0.4; // Dynamic width
return GridView.builder(
itemCount:
provider.bestdeal.length < 8 ? provider.bestdeal.length : 6,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 5,
mainAxisSpacing: 5,
childAspectRatio: MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1.8),
),
itemBuilder: (context, index) {
var bestdealproduct = provider.bestdeal[index];
double cardWidth =
MediaQuery.of(context).size.width * 0.4; // Dynamic width
return InkWell(
onTap: () {
context.push(MyRoutes.PRODUCTDETAILS,
extra: bestdealproduct.id);
},
child: Padding(
padding: const EdgeInsets.only(right: 10, bottom: 5, top: 5),
child: Container(
width: cardWidth,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
blurRadius: 1,
offset: const Offset(5, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.12,
width: cardWidth * 0.9,
decoration: BoxDecoration(
color: APPCOLOR.bgGrey,
borderRadius: BorderRadius.circular(15),
),
child: Stack(
alignment: Alignment.center,
children: [
AppNetworkImage(
height: MediaQuery.of(context).size.height *
0.08,
width: cardWidth * 0.7,
imageUrl: bestdealproduct
.productImages?.first?.url ??
"",
backGroundColor: Colors.transparent,
),
Positioned(
right: 1,
bottom: 0,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(5),
),
child: Center(
child: Text(
"${calculateDiscountPercentage(double.parse(bestdealproduct!.basePrice), double.parse(bestdealproduct!.discountPrice))}% OFF",
style: TextStyle(
color: Colors.white,
fontSize: 12)),
),
),
)
],
),
return InkWell(
onTap: () {
context.push(MyRoutes.PRODUCTDETAILS,
extra: bestdealproduct.id);
},
child: Padding(
padding: const EdgeInsets.only(right: 10, bottom: 5, top: 5),
child: Container(
width: cardWidth,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
blurRadius: 1,
offset: const Offset(5, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.all(5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
height: MediaQuery.of(context).size.height * 0.12,
width: cardWidth * 0.9,
decoration: BoxDecoration(
color: APPCOLOR.bgGrey,
borderRadius: BorderRadius.circular(15),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.01,
),
Text(
bestdealproduct.name ?? "",
textAlign: TextAlign.left,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style:
context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.005,
),
Text(
bestdealproduct.unit ?? "",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.customMedium(
Colors.grey.withOpacity(0.8),
12,
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.005,
),
const Spacer(),
Row(
children: [
Row(
children: [
Text(
"\$${bestdealproduct.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.customSemiBold(
Colors.black, 12),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context
.customMedium(
Colors.grey.withOpacity(0.8),
12,
)
.copyWith(
decoration:
TextDecoration.lineThrough,
),
),
],
),
const Spacer(),
Align(
alignment: Alignment.centerRight,
child: GestureDetector(
onTap: () async {
if (await SharedPrefUtils.getToken() !=
null) {
await provider.addToCart(
context, bestdealproduct.id!, 1);
context
.read<AddtocartProvider>()
.getItemCards(context);
} else {
context.push(MyRoutes.SIGNUP);
}
},
child: Stack(
alignment: Alignment.center,
children: [
AppNetworkImage(
height:
MediaQuery.of(context).size.height * 0.08,
width: cardWidth * 0.7,
imageUrl: bestdealproduct
.productImages?.first?.url ??
"",
backGroundColor: Colors.transparent,
),
Positioned(
right: 1,
bottom: 0,
child: Container(
height: MediaQuery.of(context).size.height *
0.035,
width:
MediaQuery.of(context).size.width * 0.1,
padding: EdgeInsets.symmetric(
horizontal: 6, vertical: 2),
decoration: BoxDecoration(
color: APPCOLOR.lightGreen,
color: Colors.red,
borderRadius: BorderRadius.circular(5),
),
child: Center(
child: provider.isLoading[
bestdealproduct.id] ??
false
? Padding(
padding:
const EdgeInsets.all(8.0),
child: Container(
height: 10,
width: 10,
child:
CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2),
),
)
: Text(
'Add',
style: context.customRegular(
Colors.white, 12),
),
child: Text(
"${calculateDiscountPercentage(double.parse(bestdealproduct!.basePrice), double.parse(bestdealproduct!.discountPrice))}% OFF",
style: TextStyle(
color: Colors.white,
fontSize: 12)),
),
),
)
],
),
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.01,
),
Text(
bestdealproduct.name ?? "",
textAlign: TextAlign.left,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.005,
),
Text(
bestdealproduct.unit ?? "",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.customMedium(
Colors.grey.withOpacity(0.8),
12,
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.005,
),
const Spacer(),
Row(
children: [
Row(
children: [
Text(
"\$${bestdealproduct.discountPrice ?? ""} ",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style:
context.customSemiBold(Colors.black, 12),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
textAlign: TextAlign.left,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context
.customMedium(
Colors.grey.withOpacity(0.8),
12,
)
.copyWith(
decoration: TextDecoration.lineThrough,
),
),
],
),
const Spacer(),
Align(
alignment: Alignment.centerRight,
child: GestureDetector(
onTap: () async {
if (await SharedPrefUtils.getToken() !=
null) {
await provider.addToCart(
context, bestdealproduct.id!, 1);
context
.read<AddtocartProvider>()
.getItemCards(context);
} else {
context.push(MyRoutes.SIGNUP);
}
},
child: Container(
height: MediaQuery.of(context).size.height *
0.035,
width:
MediaQuery.of(context).size.width * 0.1,
decoration: BoxDecoration(
color: APPCOLOR.lightGreen,
borderRadius: BorderRadius.circular(5),
),
child: Center(
child: provider.isLoading[
bestdealproduct.id] ??
false
? Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 10,
width: 10,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2),
),
)
: Text(
'Add',
style: context.customRegular(
Colors.white, 12),
),
),
),
),
],
),
],
),
),
],
),
],
),
),
),
);
},
),
),
);
},
);
}
});

View File

@@ -190,7 +190,7 @@ class _HomeScreenState extends State<HomeScreen> {
? SizedBox(
height: MediaQuery.of(context).size.height * 0.28,
child: ListView.builder(
itemCount: 5, // Show 5 skeleton items
itemCount: 5,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
double cardWidth = MediaQuery.of(context).size.width * 0.4;
@@ -374,10 +374,10 @@ class _HomeScreenState extends State<HomeScreen> {
style: context.customMedium(
Colors.grey.withOpacity(0.8), 12),
),
SizedBox(
height:
MediaQuery.of(context).size.height *
0.005),
// SizedBox(
// height:
// MediaQuery.of(context).size.height *
// 0.005),
const Spacer(),
Row(
children: [
@@ -389,7 +389,7 @@ class _HomeScreenState extends State<HomeScreen> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.customSemiBold(
Colors.black, 12),
Colors.black, 11),
),
Text(
"\$${bestdealproduct.basePrice ?? ""}",
@@ -671,7 +671,7 @@ class _HomeScreenState extends State<HomeScreen> {
return provider.isLoadingg
? GridView.builder(
shrinkWrap: true,
itemCount: 8, // Show 8 skeleton items
itemCount: 8,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,

View File

@@ -29,7 +29,7 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
SizedBox(height: 20),
_itemsList(),
SizedBox(height: 20),
_cancelButton(),
//_cancelButton(),
],
),
),
@@ -51,6 +51,9 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
Text(widget.order.orderNumber,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
SizedBox(height: 5),
Text(widget.order.deliveryAddress!.addressLine ?? " ",
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
SizedBox(height: 5),
Text(widget.order.createdAt.toString()),
SizedBox(height: 5),
Text(
@@ -140,21 +143,6 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
/// List of Ordered Items
Widget _itemsList() {
// final List<Map<String, dynamic>> items = [
// {
// "name": "Coffee",
// "quantity": 2,
// "price": 10.00,
// "image": "https://via.placeholder.com/50"
// },
// {
// "name": "Rice",
// "quantity": 1,
// "price": 10.50,
// "image": "https://via.placeholder.com/50"
// }
// ];
return Expanded(
child: ListView.builder(
itemCount: widget.order.orderItems!.length,
@@ -176,7 +164,7 @@ class _OrderDetailsScreenState extends State<OrderDetailsScreen> {
),
title: Text(orderitem.productName ?? ""),
subtitle: Text("Qty: ${orderitem.quantity.toString()}"),
trailing: Text("\$${orderitem.price ?? ""}",
trailing: Text("\$${orderitem.totalOrderItemPrice ?? ""}",
style: TextStyle(fontWeight: FontWeight.bold)),
),
);

View File

@@ -69,8 +69,7 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
final order = orderProvider.orderList[index];
return InkWell(
onTap: ()
{
onTap: () {
context.pushNamed(MyRoutes.ORDERDETAILS, extra: order);
//context.push(MyRoutes.ORDERDETAILS);
},
@@ -108,43 +107,30 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
),
),
),
SizedBox(width: 10),
SizedBox(width: 5),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(order.orderNumber,
style: TextStyle(
fontWeight: FontWeight.bold)),
Text(order.paymentMethod,
Text(order.paymentStatus ?? "",
style: TextStyle(color: Colors.grey)),
Text(order.totalItems.toString() + " items",
style: TextStyle(color: Colors.grey)),
],
),
Spacer(),
if (order.totalItems == 1) ...{
Container(
padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: Colors.green.shade100,
borderRadius: BorderRadius.circular(10),
),
child: Text(order.orderStatus,
style: TextStyle(color: Colors.green)),
Container(
padding: EdgeInsets.symmetric(
horizontal: 5, vertical: 5),
decoration: BoxDecoration(
color: Colors.green.shade100,
borderRadius: BorderRadius.circular(10),
),
} else ...{
Container(
padding: EdgeInsets.symmetric(
horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: Colors.green.shade100,
borderRadius: BorderRadius.circular(10),
),
child: Text("View All",
style: TextStyle(color: Colors.green)),
),
}
child: Text(order.orderStatus,
style: TextStyle(color: Colors.green)),
),
],
),
SizedBox(height: 10),
@@ -154,7 +140,7 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("\$" + order.subtotal,
Text("\$" + order.finalTotal,
style:
TextStyle(fontWeight: FontWeight.bold)),
Row(
@@ -184,8 +170,8 @@ class _MyOrderScreenState extends State<MyOrderScreen> {
ElevatedButton(
onPressed: () {
print("lkdhgkjdfgj");
// _makePhoneCall(
// order.stores!.first.vendor!.phone);
_makePhoneCall(
order.stores!.first.vendor!.phone);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,