Filters Fix

wala_plus_with_dialog_removal
FaizHashmi 2 weeks ago
parent 49d46dada2
commit ca9c7f7e5d

@ -4,12 +4,12 @@ class ApiConsts {
// static String baseUrl = "http://10.201.214.101:2027"; // Local server // 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://erptstapp.srca.org.sa"; // SRCA server
static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT server
// static String baseUrl = "http://10.201.204.101:2024"; // static String baseUrl = "http://10.201.204.101:2024";
// static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://webservices.hmg.com"; // PreProd
// static String baseUrl = "https://hmgwebservices.com"; // Live server // 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 ssoBaseUrl = "https://sso.hmg.com"; // New Live server
// //
// static String baseUrl = "https://uat.hmgwebservices.com"; // // static String baseUrl = "https://uat.hmgwebservices.com"; //

@ -53,8 +53,8 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
// WP_Radius (null when "any"), _filterMinDiscount drives WP_Min_Discount (null when "any"). // WP_Radius (null when "any"), _filterMinDiscount drives WP_Min_Discount (null when "any").
// Committed on "Apply filters"/"Reset"; persisted here so reopening the sheet shows the // Committed on "Apply filters"/"Reset"; persisted here so reopening the sheet shows the
// last-applied selection (availability's source of truth is selectedTypeFilter itself). // last-applied selection (availability's source of truth is selectedTypeFilter itself).
String _filterSortBy = 'nearest'; String _filterSortBy = 'newest';
String _filterDistance = '5km'; String _filterDistance = 'any';
String _filterMinDiscount = 'any'; String _filterMinDiscount = 'any';
bool isNearestOffers = true; bool isNearestOffers = true;
bool isFavoriteOnly = false; bool isFavoriteOnly = false;
@ -894,16 +894,31 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
// Replaces the old All/In Store/Online chip row: a fixed "Filters" chip (opens the filters // Replaces the old All/In Store/Online chip row: a fixed "Filters" chip (opens the filters
// bottom sheet) + a divider, then a horizontally scrollable row of subcategory chips fetched // bottom sheet) + a divider, then a horizontally scrollable row of subcategory chips fetched
// from the API for whichever main category is currently selected (see fetchSubcategories). // from the API for whichever main category is currently selected (see fetchSubcategories).
// How many of the 4 filter sections are away from their default value
// (Availability: all, Sort by: newest, Distance: any, Minimum discount: any).
int _activeFilterCount() {
int count = 0;
if (selectedTypeFilter != 'all') count++;
if (_filterSortBy != 'newest') count++;
if (_filterDistance != 'any') count++;
if (_filterMinDiscount != 'any') count++;
return count;
}
Widget _buildFiltersRow(bool isAr) { Widget _buildFiltersRow(bool isAr) {
// "All Categories" (or nothing selected) has no subcategories to show at all - only a // "All Categories" (or nothing selected) has no subcategories to show at all - only a
// specific main category, once it has actually loaded some, gets the divider + chip row. // specific main category, once it has actually loaded some, gets the divider + chip row.
bool showSubcategoriesRow = currentCategoryId.isNotEmpty && currentCategoryId != "all" && (isSubcategoriesLoading || subcategoriesList.isNotEmpty); bool showSubcategoriesRow = currentCategoryId.isNotEmpty && currentCategoryId != "all" && (isSubcategoriesLoading || subcategoriesList.isNotEmpty);
int activeFilterCount = _activeFilterCount();
return Padding( return Padding(
padding: const EdgeInsets.only(top: 14, bottom: 2), padding: const EdgeInsets.only(top: 14, bottom: 2),
child: SizedBox( child: SizedBox(
height: 38, height: 38,
child: Row( child: Row(
children: <Widget>[
Stack(
clipBehavior: Clip.none,
children: <Widget>[ children: <Widget>[
InkWell( InkWell(
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
@ -922,6 +937,20 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
), ),
), ),
), ),
if (activeFilterCount > 0)
PositionedDirectional(
top: -6,
end: -6,
child: Container(
width: 18,
height: 18,
alignment: Alignment.center,
decoration: const BoxDecoration(color: MyColors.darkIconColor, shape: BoxShape.circle),
child: '$activeFilterCount'.toText10(isBold: true, color: Colors.white),
),
),
],
),
if (showSubcategoriesRow) ...<Widget>[ if (showSubcategoriesRow) ...<Widget>[
Container(margin: const EdgeInsets.symmetric(horizontal: 10), width: 1, height: 20, color: const Color(0xFFE2E8F0)), Container(margin: const EdgeInsets.symmetric(horizontal: 10), width: 1, height: 20, color: const Color(0xFFE2E8F0)),
Expanded( Expanded(

Loading…
Cancel
Save