|
|
|
|
@ -23,6 +23,7 @@ import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/landing/event_activity_banner.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/landing/widget/app_drawer.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/landing/widget/menus_widget.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/landing/widget/services_widget.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/ui/marathon/widgets/marathon_banner.dart';
|
|
|
|
|
@ -154,15 +155,15 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
|
|
|
|
|
data.fetchLeaveTicketBalance(context, DateTime.now());
|
|
|
|
|
data.fetchMenuEntries();
|
|
|
|
|
data.fetchEventActivity();
|
|
|
|
|
data.getCategoryOffersListAPI(context);
|
|
|
|
|
// data.fetchEventActivity();
|
|
|
|
|
// data.getCategoryOffersListAPI(context);
|
|
|
|
|
data.fetchGreetingCards();
|
|
|
|
|
// marathonProvider.getMarathonDetailsFromApi();
|
|
|
|
|
// marathonProvider.getMarathonTutorial();
|
|
|
|
|
if (isFromInit) {
|
|
|
|
|
checkERMChannel();
|
|
|
|
|
}
|
|
|
|
|
if (!cProvider.disbaleChatForThisUser && !isFromInit) checkHubCon();
|
|
|
|
|
// if (!cProvider.disbaleChatForThisUser && !isFromInit) checkHubCon();
|
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
|
|
|
|
|
|
await data.fetchTicketBooking();
|
|
|
|
|
@ -293,9 +294,9 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
Image
|
|
|
|
|
.asset("assets/images/logos/main_mohemm_logo.png", width: 134, height: 28)
|
|
|
|
|
.expanded,
|
|
|
|
|
SvgPicture.asset("assets/images/announcements.svg", matchTextDirection: true).onPress(() async {
|
|
|
|
|
await Navigator.pushNamed(context, AppRoutes.announcements);
|
|
|
|
|
}),
|
|
|
|
|
// SvgPicture.asset("assets/images/announcements.svg", matchTextDirection: true).onPress(() async {
|
|
|
|
|
// await Navigator.pushNamed(context, AppRoutes.announcements);
|
|
|
|
|
// }),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 48, bottom: 7),
|
|
|
|
|
Expanded(
|
|
|
|
|
@ -588,96 +589,96 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
(data != null && data.getOffersList.isNotEmpty) ? Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.offers.tr().toText12(),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.discounts.tr().toText24(isBold: true),
|
|
|
|
|
6.width,
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8, right: 8),
|
|
|
|
|
decoration: BoxDecoration(color: MyColors.yellowColor, borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
child: LocaleKeys.newString.tr().toText10(isBold: true),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.offersAndDiscounts);
|
|
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
|
Consumer<DashboardProviderModel>(
|
|
|
|
|
builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: 103 + 33,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 13),
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
itemBuilder: (BuildContext cxt, int index) {
|
|
|
|
|
return model.isOffersLoading
|
|
|
|
|
? const OffersShimmerWidget()
|
|
|
|
|
: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
navigateToDetails(data.getOffersList[index]);
|
|
|
|
|
},
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: 73,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 73,
|
|
|
|
|
height: 73,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
|
|
|
|
border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
|
|
|
|
|
),
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius: const BorderRadius.all(Radius.circular(50)),
|
|
|
|
|
child: Hero(
|
|
|
|
|
tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString()!,
|
|
|
|
|
transitionOnUserGestures: true,
|
|
|
|
|
child: Image.network(data.getOffersList[index].logo ?? "", fit: BoxFit.contain),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
4.height,
|
|
|
|
|
Expanded(
|
|
|
|
|
child:
|
|
|
|
|
AppState().isArabic(context)
|
|
|
|
|
? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1)
|
|
|
|
|
: data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (BuildContext cxt, int index) => 8.width,
|
|
|
|
|
itemCount: 9,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
) : const SizedBox(),
|
|
|
|
|
// (data != null && data.getOffersList.isNotEmpty) ? Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Row(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// LocaleKeys.offers.tr().toText12(),
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// LocaleKeys.discounts.tr().toText24(isBold: true),
|
|
|
|
|
// 6.width,
|
|
|
|
|
// Container(
|
|
|
|
|
// padding: const EdgeInsets.only(left: 8, right: 8),
|
|
|
|
|
// decoration: BoxDecoration(color: MyColors.yellowColor, borderRadius: BorderRadius.circular(10)),
|
|
|
|
|
// child: LocaleKeys.newString.tr().toText10(isBold: true),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() {
|
|
|
|
|
// Navigator.pushNamed(context, AppRoutes.offersAndDiscounts);
|
|
|
|
|
// }),
|
|
|
|
|
// ],
|
|
|
|
|
// ).paddingOnly(left: 21, right: 21),
|
|
|
|
|
// Consumer<DashboardProviderModel>(
|
|
|
|
|
// builder: (BuildContext context, DashboardProviderModel model, Widget? child) {
|
|
|
|
|
// return SizedBox(
|
|
|
|
|
// height: 103 + 33,
|
|
|
|
|
// child: ListView.separated(
|
|
|
|
|
// shrinkWrap: true,
|
|
|
|
|
// physics: const BouncingScrollPhysics(),
|
|
|
|
|
// padding: const EdgeInsets.only(left: 21, right: 21, top: 13),
|
|
|
|
|
// scrollDirection: Axis.horizontal,
|
|
|
|
|
// itemBuilder: (BuildContext cxt, int index) {
|
|
|
|
|
// return model.isOffersLoading
|
|
|
|
|
// ? const OffersShimmerWidget()
|
|
|
|
|
// : InkWell(
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// navigateToDetails(data.getOffersList[index]);
|
|
|
|
|
// },
|
|
|
|
|
// child: SizedBox(
|
|
|
|
|
// width: 73,
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
// children: [
|
|
|
|
|
// Container(
|
|
|
|
|
// width: 73,
|
|
|
|
|
// height: 73,
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: Colors.white,
|
|
|
|
|
// borderRadius: const BorderRadius.all(Radius.circular(100)),
|
|
|
|
|
// border: Border.all(color: MyColors.lightGreyE3Color, width: 1),
|
|
|
|
|
// ),
|
|
|
|
|
// child: ClipRRect(
|
|
|
|
|
// borderRadius: const BorderRadius.all(Radius.circular(50)),
|
|
|
|
|
// child: Hero(
|
|
|
|
|
// tag: "ItemImage" + data.getOffersList[index].offersDiscountId.toString()!,
|
|
|
|
|
// transitionOnUserGestures: true,
|
|
|
|
|
// child: Image.network(data.getOffersList[index].logo ?? "", fit: BoxFit.contain),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// 4.height,
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child:
|
|
|
|
|
// AppState().isArabic(context)
|
|
|
|
|
// ? data.getOffersList[index].titleAr!.toText12(isCenter: true, maxLine: 1)
|
|
|
|
|
// : data.getOffersList[index].titleEn!.toText12(isCenter: true, maxLine: 1),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// separatorBuilder: (BuildContext cxt, int index) => 8.width,
|
|
|
|
|
// itemCount: 9,
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ) : const SizedBox(),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
@ -757,8 +758,8 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
label: LocaleKeys.home.tr(),
|
|
|
|
|
),
|
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
|
icon: SvgPicture.asset("assets/icons/create_req.svg", color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color).paddingAll(4),
|
|
|
|
|
label: LocaleKeys.mowadhafhiRequest.tr(),
|
|
|
|
|
icon: SvgPicture.asset("assets/images/drawer/my_requests.svg", color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color).paddingAll(4),
|
|
|
|
|
label: LocaleKeys.myRequest.tr(),
|
|
|
|
|
),
|
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
|
icon: Stack(
|
|
|
|
|
@ -787,43 +788,12 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
label: LocaleKeys.workList.tr(),
|
|
|
|
|
),
|
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
|
icon: SvgPicture.asset("assets/icons/item_for_sale.svg", color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color).paddingAll(4),
|
|
|
|
|
label: LocaleKeys.itemsForSale.tr(),
|
|
|
|
|
icon: SvgPicture.asset("assets/images/ticket_bal.svg", color: currentIndex == 3 ? MyColors.grey3AColor : MyColors.grey98Color, height: 22, width: 22).paddingAll(4),
|
|
|
|
|
label: LocaleKeys.ticketBalance.tr(),
|
|
|
|
|
),
|
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
|
icon: Stack(
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset(
|
|
|
|
|
"assets/icons/chat/chat.svg",
|
|
|
|
|
color:
|
|
|
|
|
!checkIfPrivilegedForChat()
|
|
|
|
|
? MyColors.lightGreyE3Color
|
|
|
|
|
: currentIndex == 4
|
|
|
|
|
? MyColors.grey3AColor
|
|
|
|
|
: cProvider.disbaleChatForThisUser
|
|
|
|
|
? MyColors.lightGreyE3Color
|
|
|
|
|
: MyColors.grey98Color,
|
|
|
|
|
).paddingAll(4),
|
|
|
|
|
Consumer<ChatProviderModel>(
|
|
|
|
|
builder: (BuildContext cxt, ChatProviderModel data, Widget? child) {
|
|
|
|
|
return !checkIfPrivilegedForChat()
|
|
|
|
|
? const SizedBox()
|
|
|
|
|
: Positioned(
|
|
|
|
|
right: 0,
|
|
|
|
|
top: 0,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 4, right: 4),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(color: cProvider.disbaleChatForThisUser ? MyColors.pinkDarkColor : MyColors.redColor, borderRadius: BorderRadius.circular(17)),
|
|
|
|
|
child: data.chatUConvCounter.toString().toText10(color: Colors.white),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
label: LocaleKeys.chat.tr(),
|
|
|
|
|
icon: SvgPicture.asset("assets/images/drawer/my_profile.svg", color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color, height: 20, width: 20).paddingAll(4),
|
|
|
|
|
label: LocaleKeys.myProfile.tr(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
currentIndex: currentIndex,
|
|
|
|
|
@ -836,15 +806,13 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28),
|
|
|
|
|
onTap: (int index) {
|
|
|
|
|
if (index == 1) {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.mowadhafhi);
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.myRequests);
|
|
|
|
|
} else if (index == 2) {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.workList);
|
|
|
|
|
} else if (index == 3) {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.itemsForSale);
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
|
|
|
|
|
} else if (index == 4) {
|
|
|
|
|
if (!cProvider.disbaleChatForThisUser && checkIfPrivilegedForChat()) {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.chat);
|
|
|
|
|
}
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.profile);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -867,24 +835,24 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
|
|
|
|
|
? const EventActivityBanner().paddingOnly(left: 21, right: 21, bottom: 21, top: 0)
|
|
|
|
|
: const SizedBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void navigateToDetails(OffersListModel offersListModelObj) {
|
|
|
|
|
List<OffersListModel> getOffersDetailList = [];
|
|
|
|
|
getOffersDetailList.clear();
|
|
|
|
|
int counter = 1;
|
|
|
|
|
|
|
|
|
|
getOffersDetailList.add(offersListModelObj);
|
|
|
|
|
|
|
|
|
|
data.getOffersList.forEach((OffersListModel element) {
|
|
|
|
|
if (counter <= 4) {
|
|
|
|
|
if (element.offersDiscountId != offersListModelObj.offersDiscountId) {
|
|
|
|
|
getOffersDetailList.add(element);
|
|
|
|
|
counter++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList);
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// void navigateToDetails(OffersListModel offersListModelObj) {
|
|
|
|
|
// List<OffersListModel> getOffersDetailList = [];
|
|
|
|
|
// getOffersDetailList.clear();
|
|
|
|
|
// int counter = 1;
|
|
|
|
|
//
|
|
|
|
|
// getOffersDetailList.add(offersListModelObj);
|
|
|
|
|
//
|
|
|
|
|
// data.getOffersList.forEach((OffersListModel element) {
|
|
|
|
|
// if (counter <= 4) {
|
|
|
|
|
// if (element.offersDiscountId != offersListModelObj.offersDiscountId) {
|
|
|
|
|
// getOffersDetailList.add(element);
|
|
|
|
|
// counter++;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
bool checkIfPrivilegedForChat() {
|
|
|
|
|
for (PrivilegeListModel element in AppState().privilegeListModel!) {
|
|
|
|
|
|