fixed category issue
This commit is contained in:
@@ -998,7 +998,7 @@
|
|||||||
"languageVersion": "3.4"
|
"languageVersion": "3.4"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"generated": "2025-03-03T13:34:10.761161Z",
|
"generated": "2025-03-04T11:22:10.239881Z",
|
||||||
"generator": "pub",
|
"generator": "pub",
|
||||||
"generatorVersion": "3.4.4",
|
"generatorVersion": "3.4.4",
|
||||||
"flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter",
|
"flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -40,8 +40,10 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUserDetails() async {
|
getUserDetails() async {
|
||||||
firstController.text = APPSTRING.userName;
|
firstController.text =
|
||||||
lastController.text = APPSTRING.userLastName;
|
APPSTRING.userName == "user_name" ? "" : APPSTRING.userName;
|
||||||
|
lastController.text =
|
||||||
|
APPSTRING.userLastName == "user_name" ? "" : APPSTRING.userLastName;
|
||||||
profile = APPSTRING.userProfile;
|
profile = APPSTRING.userProfile;
|
||||||
|
|
||||||
print("jshdgjkdhfg ${profile}");
|
print("jshdgjkdhfg ${profile}");
|
||||||
@@ -121,8 +123,6 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
|||||||
lastController.text);
|
lastController.text);
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
print('dksfjghdkfgh');
|
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: imageProvider.isImageLoading
|
color: imageProvider.isImageLoading
|
||||||
? APPCOLOR.lightGreen
|
? APPCOLOR.lightGreen
|
||||||
: APPCOLOR.grey666666,
|
: Colors.grey.withOpacity(0.7),
|
||||||
borderRadius: BorderRadius.circular(10)),
|
borderRadius: BorderRadius.circular(10)),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -170,13 +170,12 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
|||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
radius: 40,
|
radius: 40,
|
||||||
backgroundColor: Colors.grey,
|
backgroundColor: Colors.grey.withOpacity(0.2),
|
||||||
backgroundImage: _image != null
|
backgroundImage: _image != null
|
||||||
? FileImage(_image!)
|
? FileImage(_image!)
|
||||||
: (profile != null && profile!.isNotEmpty
|
: (profile != null && profile!.isNotEmpty
|
||||||
? NetworkImage(profile!)
|
? NetworkImage(profile!)
|
||||||
: const AssetImage(
|
: const AssetImage(APPASSETS.placeHolder)),
|
||||||
"assets/default_profile.png")),
|
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import 'package:fluttertoast/fluttertoast.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:grocery_app/src/common_widget/network_image.dart';
|
import 'package:grocery_app/src/common_widget/network_image.dart';
|
||||||
import 'package:grocery_app/src/core/routes/routes.dart';
|
import 'package:grocery_app/src/core/routes/routes.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/logic/provider/home_provider.dart';
|
||||||
import 'package:grocery_app/src/ui/data_notfound.dart';
|
import 'package:grocery_app/src/ui/data_notfound.dart';
|
||||||
import 'package:grocery_app/utils/constants/assets_constant.dart';
|
import 'package:grocery_app/utils/constants/assets_constant.dart';
|
||||||
@@ -456,52 +458,162 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
|||||||
return discountPercentage.round();
|
return discountPercentage.round();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Widget filterCategory() {
|
||||||
|
// final activeIndexProvider = Provider.of<ProductProvider>(context);
|
||||||
|
// return Consumer<ProductProvider>(builder: (context, provider, child) {
|
||||||
|
// if (provider.iscategroyloading) {
|
||||||
|
// return Center(
|
||||||
|
// child: Container(
|
||||||
|
// width: 20,
|
||||||
|
// height: 20,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: APPCOLOR.bgGrey,
|
||||||
|
// borderRadius: BorderRadius.circular(10),
|
||||||
|
// border: Border.all(
|
||||||
|
// color: APPCOLOR.bgGrey,
|
||||||
|
// width: 1,
|
||||||
|
// )),
|
||||||
|
// child: const Center(
|
||||||
|
// child: CupertinoActivityIndicator(),
|
||||||
|
// ),
|
||||||
|
// ));
|
||||||
|
// } else if (provider.categoryList.isEmpty) {
|
||||||
|
// return SizedBox.shrink();
|
||||||
|
// } else {
|
||||||
|
// return Container(
|
||||||
|
// decoration: const BoxDecoration(color: Colors.white),
|
||||||
|
// width: 100,
|
||||||
|
// child: ListView.builder(
|
||||||
|
// itemCount: provider.categoryList.length,
|
||||||
|
// scrollDirection: Axis.vertical,
|
||||||
|
// itemBuilder: (context, index) {
|
||||||
|
// var category = provider.categoryList[index];
|
||||||
|
// return InkWell(
|
||||||
|
// onTap: () {
|
||||||
|
// provider.iscroll = true;
|
||||||
|
// provider.products.clear();
|
||||||
|
// provider.isLoadingg = false;
|
||||||
|
// provider.hasMore = true;
|
||||||
|
// provider.page = 1;
|
||||||
|
// provider.notifyListeners();
|
||||||
|
// provider.gettAllProduct(
|
||||||
|
// context, "/category/${category.id}", true, '');
|
||||||
|
// activeIndexProvider.setActiveIndex(index);
|
||||||
|
// // provider.isLoadingg = false;
|
||||||
|
// // provider.hasMore = false;
|
||||||
|
// // provider.gettAllProduct(context, "/category/${category.id}");
|
||||||
|
// // 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),
|
||||||
|
// ),
|
||||||
|
// child: AppNetworkImage(
|
||||||
|
// height: 80,
|
||||||
|
// width: 80,
|
||||||
|
// imageUrl: category.image ??
|
||||||
|
// 'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png',
|
||||||
|
// backGroundColor: APPCOLOR.bgGrey,
|
||||||
|
// radius: 10,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// Container(
|
||||||
|
// width: 3,
|
||||||
|
// height: 100,
|
||||||
|
// 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),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
Widget filterCategory() {
|
Widget filterCategory() {
|
||||||
final activeIndexProvider = Provider.of<ProductProvider>(context);
|
final activeIndexProvider = Provider.of<ProductProvider>(context);
|
||||||
|
|
||||||
return Consumer<ProductProvider>(builder: (context, provider, child) {
|
return Consumer<ProductProvider>(builder: (context, provider, child) {
|
||||||
if (provider.iscategroyloading) {
|
if (provider.iscategroyloading) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: APPCOLOR.bgGrey,
|
color: APPCOLOR.bgGrey,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: APPCOLOR.bgGrey,
|
color: APPCOLOR.bgGrey,
|
||||||
width: 1,
|
width: 1,
|
||||||
)),
|
),
|
||||||
child: const Center(
|
),
|
||||||
child: CupertinoActivityIndicator(),
|
child: const Center(
|
||||||
|
child: CupertinoActivityIndicator(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
} else if (provider.categoryList.isEmpty) {
|
|
||||||
return SizedBox.shrink();
|
|
||||||
} else {
|
} else {
|
||||||
|
// Add "All" category at the beginning
|
||||||
|
final categories = [Datum(id: "all", name: "ALL")];
|
||||||
|
categories.addAll(provider.categoryList.cast<Datum>());
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: const BoxDecoration(color: Colors.white),
|
decoration: const BoxDecoration(color: Colors.white),
|
||||||
width: 100,
|
width: 100,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: provider.categoryList.length,
|
itemCount: categories.length,
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
var category = provider.categoryList[index];
|
var category = categories[index];
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
provider.iscroll = true;
|
provider.iscroll = true;
|
||||||
provider.products.clear(); // Clear existing products
|
provider.products.clear();
|
||||||
provider.isLoadingg = false;
|
provider.isLoadingg = false;
|
||||||
provider.hasMore = true;
|
provider.hasMore = true;
|
||||||
provider.page = 1; // Reset page for new category
|
provider.page = 1;
|
||||||
provider
|
provider.notifyListeners();
|
||||||
.notifyListeners(); // Notify listeners before fetching data
|
|
||||||
provider.gettAllProduct(
|
if (category.id == "all") {
|
||||||
context, "/category/${category.id}", true, '');
|
provider.gettAllProduct(context, "", true, '');
|
||||||
|
} else {
|
||||||
|
// Load filtered products
|
||||||
|
provider.gettAllProduct(
|
||||||
|
context, "/category/${category.id}", true, '');
|
||||||
|
}
|
||||||
|
|
||||||
activeIndexProvider.setActiveIndex(index);
|
activeIndexProvider.setActiveIndex(index);
|
||||||
// provider.isLoadingg = false;
|
|
||||||
// provider.hasMore = false;
|
|
||||||
// provider.gettAllProduct(context, "/category/${category.id}");
|
|
||||||
// activeIndexProvider.setActiveIndex(index);
|
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 150,
|
height: 150,
|
||||||
|
|||||||
Reference in New Issue
Block a user