final category issue fixed
This commit is contained in:
@@ -241,37 +241,13 @@ class ProductProvider extends ChangeNotifier {
|
||||
Future<void> getAllcategory(BuildContext context) async {
|
||||
var data = {};
|
||||
|
||||
var result = await _homeRepo.getAllcategory(data, context);
|
||||
return result.fold(
|
||||
(error) {
|
||||
print("djhgfjdfhjg ${error}");
|
||||
iscategroyloading = false;
|
||||
notifyListeners();
|
||||
},
|
||||
(response) {
|
||||
print("jdshfjghdhfjhgjd");
|
||||
|
||||
categoryList = response.data!;
|
||||
iscategroyloading = false;
|
||||
notifyListeners();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> getSubcategory(BuildContext context, String? id) async {
|
||||
var data = {"parentId": id};
|
||||
|
||||
print("kdjhgkjfkjgkj ${id}");
|
||||
|
||||
var result = await _homeRepo.getSubcategory(data, context);
|
||||
return result.fold(
|
||||
(error) {
|
||||
print("djhgfjdfhjg ${error}");
|
||||
iscategroyloading = false;
|
||||
notifyListeners();
|
||||
},
|
||||
(response) {
|
||||
print("dsfdgdfgfhfghjghjghjghjhkghj");
|
||||
categoryList = response!;
|
||||
iscategroyloading = false;
|
||||
notifyListeners();
|
||||
@@ -279,10 +255,31 @@ class ProductProvider extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
// Future<void> getSubcategory(BuildContext context, String? id) async {
|
||||
// var data = {"parentId": id};
|
||||
|
||||
// var result = await _homeRepo.getSubcategory(data, context);
|
||||
// return result.fold(
|
||||
// (error) {
|
||||
// print("djhgfjdfhjg ${error}");
|
||||
// subCategoryloading = false;
|
||||
// notifyListeners();
|
||||
// },
|
||||
// (response) {
|
||||
// print("dsfdgdfgfhfghjghjghjghjhkghj");
|
||||
// categoryList = response!;
|
||||
// subCategoryloading = false;
|
||||
// notifyListeners();
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
List<ProductCategoryModel> categoriesss = [];
|
||||
|
||||
ProductCategoryModel? selectedCategory;
|
||||
|
||||
bool subCategoryloading = true;
|
||||
|
||||
Future<void> getCategoryByLevel() async {
|
||||
categoriesss.clear();
|
||||
|
||||
@@ -290,6 +287,7 @@ class ProductProvider extends ChangeNotifier {
|
||||
|
||||
result.fold(
|
||||
(error) {
|
||||
subCategoryloading = false;
|
||||
print("Error fetching categories: $error");
|
||||
notifyListeners();
|
||||
},
|
||||
@@ -302,6 +300,7 @@ class ProductProvider extends ChangeNotifier {
|
||||
} else {
|
||||
print("No categories found.");
|
||||
}
|
||||
subCategoryloading = false;
|
||||
notifyListeners(); // Notify UI after update
|
||||
},
|
||||
);
|
||||
@@ -534,10 +533,9 @@ class ProductProvider extends ChangeNotifier {
|
||||
),
|
||||
);
|
||||
},
|
||||
(response)
|
||||
async {
|
||||
cartItems.add(productId);
|
||||
|
||||
(response) async {
|
||||
cartItems.add(productId);
|
||||
|
||||
Fluttertoast.showToast(
|
||||
msg: "Added to cart successfully!",
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
@@ -547,7 +545,7 @@ class ProductProvider extends ChangeNotifier {
|
||||
fontSize: 14.0,
|
||||
);
|
||||
iscardAdded = true;
|
||||
notifyListeners();
|
||||
notifyListeners();
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class ProductRepo {
|
||||
ProductCategory productCategory =
|
||||
productCategoryFromJson(response.toString());
|
||||
|
||||
// final String model = response.toString();
|
||||
|
||||
|
||||
return right(productCategory);
|
||||
} on DioException catch (e) {
|
||||
@@ -103,8 +103,7 @@ class ProductRepo {
|
||||
}
|
||||
}
|
||||
|
||||
FutureResult<List<DatumCategory>> getSubcategory(
|
||||
data, BuildContext context) async {
|
||||
FutureResult<List<DatumCategory>> getSubcategory( data, BuildContext context) async {
|
||||
try {
|
||||
var response = await _productService.getSubcategory(data);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ class ProductService extends ApiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
Future updateDeviceToken(data) async {
|
||||
var response =
|
||||
await api.post(APIURL.upDateDeviceToken, data: jsonEncode(data));
|
||||
@@ -48,8 +47,6 @@ class ProductService extends ApiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
Future getBestDealProduct(data) async {
|
||||
@@ -65,20 +62,20 @@ class ProductService extends ApiService {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future getSubcategory(data) async {
|
||||
var response = await api.get(APIURL.getSubcategory, data: jsonEncode(data),queryParameters: data);
|
||||
Future getSubcategory(data) async {
|
||||
|
||||
var response = await api.get(APIURL.getSubcategory, data: jsonEncode(data));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Future getCategoryByLevel(data) async {
|
||||
var response = await api.get(APIURL.getCategoryByLevel, data: jsonEncode(data));
|
||||
Future getCategoryByLevel(data) async {
|
||||
var response =
|
||||
await api.get(APIURL.getCategoryByLevel, data: jsonEncode(data));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future paymentOrder(data) async {
|
||||
var response = await api.post(APIURL.paymentOrder, data: jsonEncode(data));
|
||||
|
||||
@@ -124,7 +121,7 @@ Future getCategoryByLevel(data) async {
|
||||
return response;
|
||||
}
|
||||
|
||||
Future checkAddress(data, id) async {
|
||||
Future checkAddress(data, id) async {
|
||||
var response =
|
||||
await api.get(APIURL.checkAddress + id, data: jsonEncode(data));
|
||||
return response;
|
||||
|
||||
@@ -9,7 +9,6 @@ import 'package:grocery_app/src/common_widget/network_image.dart';
|
||||
import 'package:grocery_app/src/core/routes/routes.dart';
|
||||
import 'package:grocery_app/src/data/ProductCategoryModel.dart';
|
||||
import 'package:grocery_app/src/data/product_category.dart';
|
||||
|
||||
import 'package:grocery_app/src/logic/provider/home_provider.dart';
|
||||
import 'package:grocery_app/src/ui/data_notfound.dart';
|
||||
import 'package:grocery_app/utils/constants/assets_constant.dart';
|
||||
@@ -34,20 +33,12 @@ class _CtegoryProductState extends State<CtegoryProduct> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final productProvider =
|
||||
Provider.of<ProductProvider>(context, listen: false);
|
||||
productProvider.page = 1;
|
||||
|
||||
// productProvider.gettAllProduct(context, "", true, '', true);
|
||||
productProvider.gettAllProduct(
|
||||
context, "/category/${widget.categoryId}", true, '', false);
|
||||
|
||||
// productProvider.getAllcategory(context);
|
||||
// productProvider.getCategoryByLevel();
|
||||
|
||||
// productProvider.setActiveIndex(0);
|
||||
});
|
||||
|
||||
_scrollController.addListener(() {
|
||||
@@ -55,7 +46,6 @@ class _CtegoryProductState extends State<CtegoryProduct> {
|
||||
_scrollController.position.maxScrollExtent) {
|
||||
final productProvider =
|
||||
Provider.of<ProductProvider>(context, listen: false);
|
||||
|
||||
productProvider.gettAllProduct(context, "", false, '', false);
|
||||
}
|
||||
});
|
||||
@@ -78,28 +68,31 @@ class _CtegoryProductState extends State<CtegoryProduct> {
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: SvgPicture.asset(
|
||||
APPASSETS.back,
|
||||
height: 20,
|
||||
width: 20,
|
||||
)),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: SvgPicture.asset(
|
||||
APPASSETS.back,
|
||||
height: 20,
|
||||
width: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
widget.name ?? "",
|
||||
style: TextStyle(
|
||||
widget.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
actions: [],
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: productWidget(),
|
||||
body: Column(
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
Expanded(child: productWidget()),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -108,20 +101,22 @@ class _CtegoryProductState extends State<CtegoryProduct> {
|
||||
return Consumer<ProductProvider>(builder: (context, provider, child) {
|
||||
if (provider.isLoadingg) {
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: APPCOLOR.bgGrey,
|
||||
width: 1,
|
||||
)),
|
||||
child: const Center(
|
||||
child: CupertinoActivityIndicator(),
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: CupertinoActivityIndicator(),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
} else if (provider.products.isEmpty) {
|
||||
return Center(
|
||||
child: DataNotFound(
|
||||
@@ -132,235 +127,200 @@ class _CtegoryProductState extends State<CtegoryProduct> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final itemWidth = (constraints.maxWidth - 20) / 2;
|
||||
final itemHeight = itemWidth * 1.7;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final itemWidth = (constraints.maxWidth - 20) / 2;
|
||||
final itemHeight = itemWidth * 1.7;
|
||||
|
||||
return GridView.builder(
|
||||
controller: _scrollController,
|
||||
itemCount:
|
||||
provider.products.length + (provider.hasMore ? 1 : 0),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: itemWidth / itemHeight,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == provider.products.length) {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
var product = provider.products[index];
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var status = await provider.getProduuctDetails(
|
||||
context, product.id, 1, product.discountPrice);
|
||||
if (status) {
|
||||
context.push(
|
||||
MyRoutes.PRODUCTDETAILS,
|
||||
extra: {
|
||||
"id": product.id,
|
||||
"quantity": 1,
|
||||
"price": product.discountPrice,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// context.push(
|
||||
// MyRoutes.PRODUCTDETAILS,
|
||||
// extra: {
|
||||
// "id": product.id,
|
||||
// "quantity": 1,
|
||||
// "price": product.discountPrice,
|
||||
// },
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
height: itemHeight,
|
||||
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: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: itemWidth *
|
||||
1.1, // Adjust height for image container
|
||||
// width: itemWidth,
|
||||
decoration: BoxDecoration(
|
||||
color: APPCOLOR.bgGrey,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
AppNetworkImage(
|
||||
imageUrl: product
|
||||
.productImages!.first.url ??
|
||||
"https://5.imimg.com/data5/SELLER/Default/2024/2/385126988/OL/DA/VW/8627346/1l-fortune-sunflower-oil.jpg",
|
||||
backGroundColor: Colors.transparent,
|
||||
radius: 10,
|
||||
boxFit: BoxFit.fill),
|
||||
Positioned(
|
||||
right: 1,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 35,
|
||||
width: 35,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 1, vertical: 1),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius:
|
||||
BorderRadius.circular(100),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"${calculateDiscountPercentage(double.parse(product.basePrice), double.parse(product!.discountPrice))}%\nOFF",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 10)),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
return GridView.builder(
|
||||
physics: BouncingScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemCount:
|
||||
provider.products.length + (provider.hasMore ? 1 : 0),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: itemWidth / itemHeight,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == provider.products.length) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
var product = provider.products[index];
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var status = await provider.getProduuctDetails(
|
||||
context, product.id, 1, product.discountPrice);
|
||||
if (status) {
|
||||
context.push(
|
||||
MyRoutes.PRODUCTDETAILS,
|
||||
extra: {
|
||||
"id": product.id,
|
||||
"quantity": 1,
|
||||
"price": product.discountPrice,
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: itemHeight,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: itemWidth * 1.1,
|
||||
decoration: BoxDecoration(
|
||||
color: APPCOLOR.bgGrey,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
product.name ?? " ",
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context
|
||||
.customMedium(
|
||||
APPCOLOR.balck1A1A1A,
|
||||
15,
|
||||
)
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
product.unit ?? " ",
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context.customMedium(
|
||||
Colors.grey.withOpacity(0.8),
|
||||
13,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 1),
|
||||
Spacer(),
|
||||
Row(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"₹${product.discountPrice ?? " "}",
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context.customSemiBold(
|
||||
Colors.black, 15),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"₹${product.basePrice ?? " "}",
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context
|
||||
.customMedium(
|
||||
Colors.grey.withOpacity(0.8),
|
||||
15,
|
||||
)
|
||||
.copyWith(
|
||||
decoration:
|
||||
TextDecoration.lineThrough,
|
||||
),
|
||||
),
|
||||
],
|
||||
AppNetworkImage(
|
||||
imageUrl: product.productImages!.first.url ??
|
||||
"https://5.imimg.com/data5/SELLER/Default/2024/2/385126988/OL/DA/VW/8627346/1l-fortune-sunflower-oil.jpg",
|
||||
backGroundColor: Colors.transparent,
|
||||
radius: 10,
|
||||
boxFit: BoxFit.fill,
|
||||
),
|
||||
Spacer(),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
print(
|
||||
"Add to Cart Pressed for ${product.id}");
|
||||
|
||||
if (await SharedPrefUtils.getToken() !=
|
||||
null) {
|
||||
await provider.addToCart(
|
||||
context, product.id!, 1);
|
||||
} else {
|
||||
context.push(MyRoutes.SIGNUP);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height:
|
||||
MediaQuery.of(context).size.height *
|
||||
0.038,
|
||||
width: MediaQuery.of(context).size.width *
|
||||
0.1,
|
||||
decoration: BoxDecoration(
|
||||
color: APPCOLOR.lightGreen,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Center(
|
||||
child: provider.isLoading[product.id] ??
|
||||
false
|
||||
? Padding(
|
||||
padding:
|
||||
const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
height: 10,
|
||||
width: 10,
|
||||
child:
|
||||
CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
strokeWidth: 2),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
// provider.cartItems
|
||||
// .contains(bestdealproduct.id)
|
||||
// ? 'Added'
|
||||
// :
|
||||
'Add',
|
||||
style: context.customRegular(
|
||||
Colors.white, 12),
|
||||
),
|
||||
Positioned(
|
||||
right: 1,
|
||||
bottom: 0,
|
||||
child: Container(
|
||||
height: 35,
|
||||
width: 35,
|
||||
padding: const EdgeInsets.all(1),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"${calculateDiscountPercentage(double.parse(product.basePrice), double.parse(product.discountPrice))}%\nOFF",
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
product.name ?? " ",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context
|
||||
.customMedium(
|
||||
APPCOLOR.balck1A1A1A,
|
||||
15,
|
||||
)
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
product.unit ?? " ",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: context.customMedium(
|
||||
Colors.grey.withOpacity(0.8),
|
||||
13,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 1),
|
||||
const Spacer(),
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"₹${product.discountPrice ?? " "}",
|
||||
style: context.customSemiBold(
|
||||
Colors.black, 15),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
"₹${product.basePrice ?? " "}",
|
||||
style: context
|
||||
.customMedium(
|
||||
Colors.grey.withOpacity(0.8),
|
||||
15,
|
||||
)
|
||||
.copyWith(
|
||||
decoration:
|
||||
TextDecoration.lineThrough,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const Spacer(),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
if (await SharedPrefUtils.getToken() !=
|
||||
null) {
|
||||
await provider.addToCart(
|
||||
context, product.id!, 1);
|
||||
} else {
|
||||
context.push(MyRoutes.SIGNUP);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height *
|
||||
0.038,
|
||||
width:
|
||||
MediaQuery.of(context).size.width * 0.1,
|
||||
decoration: BoxDecoration(
|
||||
color: APPCOLOR.lightGreen,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Center(
|
||||
child: provider.isLoading[product.id] ??
|
||||
false
|
||||
? const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: SizedBox(
|
||||
height: 10,
|
||||
width: 10,
|
||||
child:
|
||||
CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Add',
|
||||
style: context.customRegular(
|
||||
Colors.white, 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,31 +32,14 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
Provider.of<ProductProvider>(context, listen: false);
|
||||
productProvider.page = 1;
|
||||
|
||||
// productProvider.gettAllProduct(context, "", true, '', true);
|
||||
productProvider.getCategoryByLevel();
|
||||
|
||||
productProvider.getAllcategory(context);
|
||||
productProvider.getCategoryByLevel();
|
||||
|
||||
productProvider.setActiveIndex(0);
|
||||
});
|
||||
|
||||
// _scrollController.addListener(() {
|
||||
// if (_scrollController.position.pixels ==
|
||||
// _scrollController.position.maxScrollExtent) {
|
||||
// final productProvider =
|
||||
// Provider.of<ProductProvider>(context, listen: false);
|
||||
|
||||
// productProvider.gettAllProduct(context, "", false, '', false);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// @override
|
||||
// void dispose() {
|
||||
// _scrollController.dispose();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -103,7 +86,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
Widget expendablecategory() {
|
||||
return Consumer<ProductProvider>(
|
||||
builder: (context, provider, child) {
|
||||
if (provider.iscategroyloading) {
|
||||
if (provider.subCategoryloading) {
|
||||
return const Center(child: CupertinoActivityIndicator());
|
||||
}
|
||||
|
||||
@@ -180,6 +163,8 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (provider.categoryList.isEmpty) {
|
||||
return SizedBox.shrink();
|
||||
} else {
|
||||
// final categories = [DatumCategory(id: "all", name: "ALL")];
|
||||
// categories.addAll(provider.categoryList.cast<DatumCategory>());
|
||||
|
||||
@@ -37,7 +37,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
productProvider.getBanners(context);
|
||||
productProvider.getHomeProduct(context, "", '', '', '', '');
|
||||
productProvider.getBestDealProduct(context, '');
|
||||
productProvider.getAllcategory(context);
|
||||
// productProvider.getAllcategory(context);
|
||||
|
||||
productProvider.updateDeviceToken(context);
|
||||
// productProvider.getCategoryByLevel();
|
||||
|
||||
Reference in New Issue
Block a user