|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/app_state.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
|
@ -60,7 +61,11 @@ class MyServicesCategoriesWidget extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
category.isCustom ? category.iconUrl.buildNetworkImage(height: 32, width: 32, fit: BoxFit.fill) : category.iconUrl.buildNetworkImage(height: 32, width: 32, fit: BoxFit.fill),
|
|
|
|
|
// Special handling for Special Requests service (displays local SVG icon)
|
|
|
|
|
if (category.id == -1)
|
|
|
|
|
SvgPicture.asset(category.iconUrl, height: 32, width: 32, fit: BoxFit.fill)
|
|
|
|
|
else
|
|
|
|
|
category.iconUrl.buildNetworkImage(height: 32, width: 32, fit: BoxFit.fill),
|
|
|
|
|
10.height,
|
|
|
|
|
Flexible(
|
|
|
|
|
child: (isArabic ? category.titleN : category.title).toText(
|
|
|
|
|
@ -91,13 +96,20 @@ class MyServicesCategoriesWidget extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
final appointmentVM = context.read<AppointmentsVM>();
|
|
|
|
|
final dashboardCustomerVM = context.read<DashboardVmCustomer>();
|
|
|
|
|
context.read<DashboardVmCustomer>().onNavbarTapped(0);
|
|
|
|
|
dashboardCustomerVM.onNavbarTapped(0);
|
|
|
|
|
// Use the original index from homeCategories for filtering
|
|
|
|
|
int originalIndex = homeCategories.indexOf(category);
|
|
|
|
|
appointmentVM.applyFilterOnBranches(index: originalIndex);
|
|
|
|
|
|
|
|
|
|
// Check if this is the Special Requests service
|
|
|
|
|
if (category.id == -1) {
|
|
|
|
|
// Navigate to Requests tab (index 4)
|
|
|
|
|
dashboardCustomerVM.onNavbarTapped(4);
|
|
|
|
|
} else {
|
|
|
|
|
// Original behavior for other services
|
|
|
|
|
final appointmentVM = context.read<AppointmentsVM>();
|
|
|
|
|
dashboardCustomerVM.onNavbarTapped(0);
|
|
|
|
|
// Adjust index: subtract 1 because Special Requests was added at index 0
|
|
|
|
|
int originalIndex = homeCategories.indexOf(category) - 1;
|
|
|
|
|
appointmentVM.applyFilterOnBranches(index: originalIndex);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|