fixed category issue
This commit is contained in:
@@ -998,7 +998,7 @@
|
||||
"languageVersion": "3.4"
|
||||
}
|
||||
],
|
||||
"generated": "2025-03-03T13:34:10.761161Z",
|
||||
"generated": "2025-03-04T11:22:10.239881Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "3.4.4",
|
||||
"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 {
|
||||
firstController.text = APPSTRING.userName;
|
||||
lastController.text = APPSTRING.userLastName;
|
||||
firstController.text =
|
||||
APPSTRING.userName == "user_name" ? "" : APPSTRING.userName;
|
||||
lastController.text =
|
||||
APPSTRING.userLastName == "user_name" ? "" : APPSTRING.userLastName;
|
||||
profile = APPSTRING.userProfile;
|
||||
|
||||
print("jshdgjkdhfg ${profile}");
|
||||
@@ -121,8 +123,6 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
||||
lastController.text);
|
||||
|
||||
if (status) {
|
||||
print('dksfjghdkfgh');
|
||||
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: imageProvider.isImageLoading
|
||||
? APPCOLOR.lightGreen
|
||||
: APPCOLOR.grey666666,
|
||||
: Colors.grey.withOpacity(0.7),
|
||||
borderRadius: BorderRadius.circular(10)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
@@ -170,13 +170,12 @@ class _EditProfileScreenState extends State<EditProfileScreen> {
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.grey,
|
||||
backgroundColor: Colors.grey.withOpacity(0.2),
|
||||
backgroundImage: _image != null
|
||||
? FileImage(_image!)
|
||||
: (profile != null && profile!.isNotEmpty
|
||||
? NetworkImage(profile!)
|
||||
: const AssetImage(
|
||||
"assets/default_profile.png")),
|
||||
: const AssetImage(APPASSETS.placeHolder)),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
|
||||
@@ -6,6 +6,8 @@ import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:go_router/go_router.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/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';
|
||||
@@ -456,8 +458,111 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
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() {
|
||||
final activeIndexProvider = Provider.of<ProductProvider>(context);
|
||||
|
||||
return Consumer<ProductProvider>(builder: (context, provider, child) {
|
||||
if (provider.iscategroyloading) {
|
||||
return Center(
|
||||
@@ -470,38 +575,45 @@ class _FruitVeggieDetailState extends State<FruitVeggieDetail> {
|
||||
border: Border.all(
|
||||
color: APPCOLOR.bgGrey,
|
||||
width: 1,
|
||||
)),
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: CupertinoActivityIndicator(),
|
||||
),
|
||||
));
|
||||
} else if (provider.categoryList.isEmpty) {
|
||||
return SizedBox.shrink();
|
||||
),
|
||||
);
|
||||
} 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,
|
||||
child: ListView.builder(
|
||||
itemCount: provider.categoryList.length,
|
||||
itemCount: categories.length,
|
||||
scrollDirection: Axis.vertical,
|
||||
itemBuilder: (context, index) {
|
||||
var category = provider.categoryList[index];
|
||||
var category = categories[index];
|
||||
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
provider.iscroll = true;
|
||||
provider.products.clear(); // Clear existing products
|
||||
provider.products.clear();
|
||||
provider.isLoadingg = false;
|
||||
provider.hasMore = true;
|
||||
provider.page = 1; // Reset page for new category
|
||||
provider
|
||||
.notifyListeners(); // Notify listeners before fetching data
|
||||
provider.page = 1;
|
||||
provider.notifyListeners();
|
||||
|
||||
if (category.id == "all") {
|
||||
provider.gettAllProduct(context, "", true, '');
|
||||
} else {
|
||||
// Load filtered products
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user