fixed category issue

This commit is contained in:
2025-03-18 18:48:07 +05:30
parent a073b7aeec
commit 7ab5c896f0
11 changed files with 679 additions and 645 deletions

View File

@@ -96,8 +96,11 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
// )
],
),
body: Row(
children: [filterCategory(), productWidget()],
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [filterCategory(), productWidget()],
),
),
);
}
@@ -130,7 +133,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
child: DataNotFound(
imagePath: 'assets/images/cart.jpg',
message: "Product not abailable ",
width: 200.w,
width: 220.w,
height: 250.h,
),
),
@@ -225,7 +228,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
children: [
AppNetworkImage(
height: 70,
width: 70,
width: 150,
imageUrl: product
.productImages!.first.url ??
"https://5.imimg.com/data5/SELLER/Default/2024/2/385126988/OL/DA/VW/8627346/1l-fortune-sunflower-oil.jpg",
@@ -319,12 +322,16 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
Text(
product.name ?? " ",
textAlign: TextAlign.left,
maxLines: 3,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: context.customMedium(
APPCOLOR.balck1A1A1A, 14),
style: context
.customMedium(
APPCOLOR.balck1A1A1A,
15,
)
.copyWith(fontWeight: FontWeight.bold),
),
const SizedBox(height: 5),
const SizedBox(height: 2),
Text(
product.unit ?? " ",
textAlign: TextAlign.left,
@@ -332,10 +339,10 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
overflow: TextOverflow.ellipsis,
style: context.customMedium(
Colors.grey.withOpacity(0.8),
12,
13,
),
),
const SizedBox(height: 3),
const SizedBox(height: 1),
Spacer(),
Row(
children: [
@@ -349,7 +356,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.customSemiBold(
Colors.black, 12),
Colors.black, 16),
),
const SizedBox(width: 5),
Text(
@@ -360,7 +367,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
style: context
.customMedium(
Colors.grey.withOpacity(0.8),
12,
16,
)
.copyWith(
decoration:
@@ -388,7 +395,7 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
child: Container(
height:
MediaQuery.of(context).size.height *
0.035,
0.038,
width:
MediaQuery.of(context).size.width *
0.1,
@@ -583,84 +590,108 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
),
);
} else {
// Add "All" category at the beginning
final categories = [Datum(id: "all", name: "ALL")];
categories.addAll(provider.categoryList.cast<Datum>());
return Container(
decoration: const BoxDecoration(color: Colors.white),
width: 100,
width: 70,
child: ListView.builder(
itemCount: categories.length,
scrollDirection: Axis.vertical,
itemBuilder: (context, index) {
var category = categories[index];
return InkWell(
onTap: () {
provider.iscroll = true;
provider.products.clear();
provider.isLoadingg = false;
provider.hasMore = true;
provider.page = 1;
provider.notifyListeners();
return Padding(
padding: const EdgeInsets.only(bottom: 8),
child: InkWell(
onTap: () {
provider.iscroll = true;
provider.products.clear();
provider.isLoadingg = false;
provider.hasMore = true;
provider.page = 1;
provider.notifyListeners();
if (category.id == "all") {
provider.gettAllProduct(context, "", true, '');
} else {
// Load filtered products
provider.gettAllProduct(
context, "/category/${category.id}", true, '');
}
if (category.id == "all") {
provider.gettAllProduct(context, "", true, '');
} else {
// Load filtered products
provider.gettAllProduct(
context, "/category/${category.id}", true, '');
}
activeIndexProvider.setActiveIndex(index);
},
child: SizedBox(
height: 150,
child: Column(
children: [
Row(
children: [
Expanded(
child: Center(
child: Container(
decoration: BoxDecoration(
color:
activeIndexProvider.activeIndex == index
? Colors.greenAccent.withOpacity(0.1)
: APPCOLOR.bgGrey,
borderRadius: BorderRadius.circular(5),
activeIndexProvider.setActiveIndex(index);
},
child: Container(
decoration: BoxDecoration(
color: activeIndexProvider.activeIndex == index
? Colors.greenAccent.withOpacity(0.3)
: APPCOLOR.bgGrey,
borderRadius: BorderRadius.circular(5)),
child: Padding(
padding: const EdgeInsets.only(top: 10, bottom: 10),
child: SizedBox(
// height: 80,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Column(
children: [
Center(
child: Container(
// decoration: BoxDecoration(
// color: activeIndexProvider.activeIndex ==
// index
// ? Colors.greenAccent.withOpacity(0.1)
// : APPCOLOR.bgGrey,
// borderRadius: BorderRadius.circular(5),
// ),
child: AppNetworkImage(
height: 30,
width: 50,
imageUrl: category.image ??
'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png',
backGroundColor: APPCOLOR.bgGrey,
radius: 10,
),
),
),
child: AppNetworkImage(
height: 80,
width: 80,
imageUrl: category.image ??
'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png',
backGroundColor: APPCOLOR.bgGrey,
radius: 10,
SizedBox(
height: 5,
),
),
Container(
width: 50,
child: Text(
category.name,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style:
activeIndexProvider.activeIndex == index
? context.customExtraBold(
APPCOLOR.balck1A1A1A, 9)
: context.customMedium(
APPCOLOR.balck1A1A1A, 10),
),
),
],
),
),
Container(
width: 3,
height: 100,
color: activeIndexProvider.activeIndex == index
? APPCOLOR.lightGreen
: Colors.transparent,
),
],
SizedBox(
width: 5,
),
Container(
width: 2,
// height: 60,
color: activeIndexProvider.activeIndex == index
? APPCOLOR.lightGreen
: Colors.transparent,
),
],
),
),
Text(
category.name,
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: activeIndexProvider.activeIndex == index
? context.customExtraBold(APPCOLOR.balck1A1A1A, 14)
: context.customMedium(APPCOLOR.balck1A1A1A, 14),
),
],
),
),
),
);