From d6fdcb214d1e188c868e2276337236cefe3b1162 Mon Sep 17 00:00:00 2001 From: FaizHashmi Date: Sun, 18 Oct 2026 17:45:48 +0300 Subject: [PATCH] chip color change --- lib/api/offers_and_discounts_api_client.dart | 33 +++++-------------- lib/classes/consts.dart | 6 ++-- .../dashboard_screen_for_dependet.dart | 17 +++++++--- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/lib/api/offers_and_discounts_api_client.dart b/lib/api/offers_and_discounts_api_client.dart index 95e5029..79ec90f 100644 --- a/lib/api/offers_and_discounts_api_client.dart +++ b/lib/api/offers_and_discounts_api_client.dart @@ -292,10 +292,10 @@ class OffersAndDiscountsApiClient { if (sortBy != null && sortBy.trim().isNotEmpty) { postParams["WP_Sort_By"] = sortBy.trim(); } - // null (radius/minDiscount unset) means "Any"/"All" was selected - _cleanWalaPlusParams - // strips null entries below so the param is simply omitted from the request. - postParams["WP_Radius"] = radius; - postParams["WP_Min_Discount"] = minDiscount; + // Backend contract declares these as non-nullable int DataMembers, so "Any"/"All" (null + // here) must be sent as a concrete 0, not omitted. + postParams["WP_Radius"] = radius ?? 0; + postParams["WP_Min_Discount"] = minDiscount ?? 0; if (geoLocation != null && geoLocation.isNotEmpty) { postParams["WP_Geo_Location"] = geoLocation; @@ -318,6 +318,8 @@ class OffersAndDiscountsApiClient { postParams["WP_User_Reference"] = null; } + log("postParams: ${postParams.toString()}"); + return await ApiClient().postJsonForObject( (response) { if (response != null) { @@ -352,12 +354,7 @@ class OffersAndDiscountsApiClient { ); } - Future getWalaPlusRetailerById({ - required String retailerId, - BuildContext? context, - String? mobileNumber, - String? userReference, - }) async { + Future getWalaPlusRetailerById({required String retailerId, BuildContext? context, String? mobileNumber, String? userReference}) async { String url = ApiConsts.walaPlusRetailersByID; String pUserName = _resolveUserName(); String pMobileNumber = _resolveMobileNumber(overrideMobile: mobileNumber); @@ -557,13 +554,7 @@ class OffersAndDiscountsApiClient { ); } - Future addWalaPlusFavorite({ - Object? retailerId, - List? retailerIds, - BuildContext? context, - String? mobileNumber, - String? userReference, - }) async { + Future addWalaPlusFavorite({Object? retailerId, List? retailerIds, BuildContext? context, String? mobileNumber, String? userReference}) async { String url = ApiConsts.walaPlusFavoritesAdd; String pUserName = _resolveUserName(); String pMobileNumber = _resolveMobileNumber(overrideMobile: mobileNumber); @@ -622,13 +613,7 @@ class OffersAndDiscountsApiClient { ); } - Future removeWalaPlusFavorite({ - Object? retailerId, - List? retailerIds, - BuildContext? context, - String? mobileNumber, - String? userReference, - }) async { + Future removeWalaPlusFavorite({Object? retailerId, List? retailerIds, BuildContext? context, String? mobileNumber, String? userReference}) async { String url = ApiConsts.walaPlusFavoritesRemove; String pUserName = _resolveUserName(); String pMobileNumber = _resolveMobileNumber(overrideMobile: mobileNumber); diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 4fc7544..6635d82 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -4,16 +4,16 @@ class ApiConsts { // static String baseUrl = "http://10.201.214.101:2027"; // Local server // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server - // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server // static String baseUrl = "http://10.201.204.101:2024"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://hmgwebservices.com"; // Live server - static String baseUrl = "https://mohemm.hmg.com"; // New Live server + // static String baseUrl = "https://mohemm.hmg.com"; // New Live server static String ssoBaseUrl = "https://sso.hmg.com"; // New Live server // // static String baseUrl = "https://uat.hmgwebservices.com"; // - // UAT ser343622ver + // UAT server // static String baseUrl = "http://10.20.200.111:1010/"; // static String baseUrl = "https://mohemm.hmg.com"; // New Live server //static String eLearningBaseUrl = "https://elearning.hmg.com/moodle_dev/api/"; // Elearning server UAT diff --git a/lib/ui/landing/dashboard_screen_for_dependet.dart b/lib/ui/landing/dashboard_screen_for_dependet.dart index 6b17e68..395ff3e 100644 --- a/lib/ui/landing/dashboard_screen_for_dependet.dart +++ b/lib/ui/landing/dashboard_screen_for_dependet.dart @@ -326,7 +326,10 @@ class _DashboardScreenForDependetState extends State sortBy: isFavoriteOnly ? null : _filterSortBy, radius: radiusParam, minDiscount: minDiscountParam, - context: (!isFavoriteOnly && wantsNearest) ? context : null, + // Same as getWalaPlusRetailerById: always pass context whenever we have one so + // WP_Geo_Location is attempted - don't gate it on wantsNearest, that only matters for + // whether we block the fetch to prompt for permission first (see the gate above). + context: isFavoriteOnly ? null : context, userReference: userRef, ); @@ -386,7 +389,7 @@ class _DashboardScreenForDependetState extends State sortBy: isFavoriteOnly ? null : _filterSortBy, radius: radiusParam, minDiscount: minDiscountParam, - context: (!isFavoriteOnly && wantsNearest) ? context : null, + context: isFavoriteOnly ? null : context, userReference: userRef, ); @@ -1002,12 +1005,16 @@ class _DashboardScreenForDependetState extends State child: Container( height: 44, alignment: Alignment.center, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(8), color: isSelected ? darkBg : Colors.white, border: Border.all(color: isSelected ? darkBg : borderColor)), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: isSelected ? darkBg : MyColors.lightGreyEAColor, + border: Border.all(color: isSelected ? darkBg : MyColors.lightGreyEAColor), + ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - if (icon != null) ...[Icon(icon, size: 14, color: isSelected ? Colors.white : const Color(0xFF64748B)), const SizedBox(width: 5)], - Flexible(child: label.toText13(isBold: true, color: isSelected ? Colors.white : darkBg, maxlines: 1)), + if (icon != null) ...[Icon(icon, size: 14, color: isSelected ? Colors.white : MyColors.black), const SizedBox(width: 5)], + Flexible(child: label.toText13(isBold: true, color: isSelected ? Colors.white : MyColors.black, maxlines: 1)), if (isSelected) ...[const SizedBox(width: 5), const Icon(Icons.check, size: 14, color: Colors.white)], ], ),