diff --git a/lib/api/api_client.dart b/lib/api/api_client.dart index 8518cd7..c966452 100644 --- a/lib/api/api_client.dart +++ b/lib/api/api_client.dart @@ -77,11 +77,11 @@ class ApiClient { if (headers != null && headers.isNotEmpty) { _headers.addAll(headers); } - if (!kReleaseMode) { + print("Url:$url"); var bodyJson = json.encode(jsonObject); print("body:$bodyJson"); - } + var response = await postJsonForResponse(url, jsonObject, token: token, queryParameters: queryParameters, headers: _headers, retryTimes: retryTimes, isFormData: isFormData); try { if (!kReleaseMode) { diff --git a/lib/api/login_api_client.dart b/lib/api/login_api_client.dart index 7da7754..0d12d72 100644 --- a/lib/api/login_api_client.dart +++ b/lib/api/login_api_client.dart @@ -88,7 +88,9 @@ class LoginApiClient { AppState().postParamsObject?.pEmailAddress = responseData.basicMemberInformation!.pEMAILADDRESS; AppState().postParamsObject?.pSessionId = responseData.pSESSIONID; AppState().postParamsObject?.pUserName = AppState().getUserName; - AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName; + //TODO: employee id changed in SRCA instead of username + // AppState().postParamsObject?.pSelectedEmployeeNumber = AppState().getUserName; + AppState().postParamsObject?.pSelectedEmployeeNumber = responseData.memberInformationList!.first.aSSIGNMENTNUMBER; AppState().postParamsObject?.setPLegislationCode = responseData.basicMemberInformation!.pLEGISLATIONCODE; AppState().postParamsObject?.setPayrollCodeStr = responseData.memberInformationList!.first.pAYROLLCODE; AppState().setBusinessCardPrivilege = responseData.businessCardPrivilege ?? false; diff --git a/lib/config/env.dart b/lib/config/env.dart new file mode 100644 index 0000000..b78c5e4 --- /dev/null +++ b/lib/config/env.dart @@ -0,0 +1,35 @@ +// ignore_for_file: prefer_single_quotes, lines_longer_than_80_chars final +Map env = { + "appConfig": "lib/config/config_en.json", + + // Worklist (Dynamic ListView, Dynamic Forms, Dynamic Submission) + + "login": { + "verification": true, + "verificationMethod": { + "whatsapp": false, + }, + "forgetPassword": false + }, + "bottomBar": false, + "dashboard": { + "attendance": false, + "worklist": true, + "ticketBalance": false, + "leaveBalance": true, + "missingSwipe": false, + "monthlyAttendance": false, + "vocationRules": false, + }, + "marathon": false, + "offersDiscount": false, + "myTeams": false, + "modifiy": false, + "myRequest": false, + "pendingTransactions": false, + "myProfile": false, + "itemsForSale": false, + "chat": false, + "monthlyAttendance": false, + "vocationRules": false, +}; diff --git a/lib/main.dart b/lib/main.dart index 8624525..d7b9646 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -20,11 +20,9 @@ import 'package:provider/single_child_widget.dart'; import 'package:sizer/sizer.dart'; Logger logger = Logger( - // filter: null, // Use the default LogFilter (-> only log in debug mode) printer: PrettyPrinter( lineLength: 0, - ), // Use the PrettyPrinter to format and print log - // output: null, // U + ), ); @@ -262,3 +260,4 @@ class MyApp extends StatelessWidget { // } // } + diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 5899699..1ca89ec 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -5,6 +5,7 @@ import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; import 'package:mohem_flutter_app/api/offers_and_discounts_api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/env.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/main.dart'; @@ -228,9 +229,14 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { GenericResponseModel? genericResponseModel = await DashboardApiClient().getGetMenuEntries(); getMenuEntriesList = genericResponseModel!.getMenuEntriesList; homeMenus = parseMenus(getMenuEntriesList ?? []); + if (homeMenus!.isNotEmpty) { - homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr())); - homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr())); + if(env["dashboard"]["monthlyAttendance"]) { + homeMenus!.first.menuEntiesList.insert(0, GetMenuEntriesList(requestType: "MONTHLY_ATTENDANCE", prompt: LocaleKeys.monthlyAttendance.tr())); + } + if(env["dashboard"]["vocationRules"]) { + homeMenus!.first.menuEntiesList.add(GetMenuEntriesList(requestType: "VACATION_RULE", prompt: LocaleKeys.vacationRule.tr())); + } } isServicesMenusLoading = false; notifyListeners(); diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index db1f1fc..5ecfdf2 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -11,6 +11,7 @@ import 'package:mohem_flutter_app/api/dashboard_api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/env.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -60,8 +61,12 @@ class _DashboardScreenState extends State with WidgetsBindingOb super.initState(); scheduleMicrotask(() { data = Provider.of(context, listen: false); - marathonProvider = Provider.of(context, listen: false); - cProvider = Provider.of(context, listen: false); + if (env["marathon"]) { + marathonProvider = Provider.of(context, listen: false); + } + if (env["chat"]) { + cProvider = Provider.of(context, listen: false); + } _bHubCon(); _onRefresh(true); }); @@ -132,13 +137,20 @@ class _DashboardScreenState extends State with WidgetsBindingOb // print(value.result!.data!.notificationTitle); // }); data.fetchListMenu(); - data.fetchAttendanceTracking(context); + if (env["dashboard"]["attendance"]) { + data.fetchAttendanceTracking(context); + } data.fetchWorkListCounter(context); - data.fetchMissingSwipe(context); + if (env["dashboard"]["missingSwipe"]) { + data.fetchMissingSwipe(context); + } data.fetchLeaveTicketBalance(context, DateTime.now()); data.fetchMenuEntries(); data.getCategoryOffersListAPI(context); - marathonProvider.getMarathonDetailsFromApi(); + if (env["marathon"]) { + marathonProvider.getMarathonDetailsFromApi(); + } + if (!isFromInit) checkHubCon(); _refreshController.refreshCompleted(); } @@ -253,6 +265,7 @@ class _DashboardScreenState extends State with WidgetsBindingOb 16.height, Row( children: [ + if (env["dashboard"]["attendance"]) Expanded( child: AspectRatio( aspectRatio: 159 / 159, @@ -364,7 +377,7 @@ class _DashboardScreenState extends State with WidgetsBindingOb ), ), ), - 9.width, + if (env["dashboard"]["attendance"]) 9.width, Expanded( child: MenusWidget(), ), @@ -480,8 +493,10 @@ class _DashboardScreenState extends State with WidgetsBindingOb child: Column( mainAxisSize: MainAxisSize.min, children: [ - ServicesWidget(), + + if (env["marathon"]) context.watch().isLoading ? const MarathonBannerShimmer().paddingAll(20) : const MarathonBanner().paddingOnly(left: 21, right: 21, bottom: 21, top: 8), + ServicesWidget(), ], ), ), @@ -495,7 +510,9 @@ class _DashboardScreenState extends State with WidgetsBindingOb drawer: SafeArea( child: AppDrawer(onLanguageChange: _onRefresh), ), - bottomNavigationBar: SizedBox( + bottomNavigationBar:!env["bottomBar"] + ? null + : SizedBox( height: Platform.isAndroid ? 70 : 100, child: BottomNavigationBar( items: [ diff --git a/lib/ui/landing/dashboard_screen2.dart b/lib/ui/landing/dashboard_screen2.dart new file mode 100644 index 0000000..0a339e6 --- /dev/null +++ b/lib/ui/landing/dashboard_screen2.dart @@ -0,0 +1,594 @@ +// import 'dart:async'; +// import 'dart:io'; +// +// import 'dart:ui' as ui; +// import 'package:easy_localization/easy_localization.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_countdown_timer/flutter_countdown_timer.dart'; +// import 'package:flutter_svg/flutter_svg.dart'; +// import 'package:mohem_flutter_app/app_state/app_state.dart'; +// import 'package:mohem_flutter_app/classes/colors.dart'; +// import 'package:mohem_flutter_app/classes/utils.dart'; +// import 'package:mohem_flutter_app/config/env.dart'; +// import 'package:mohem_flutter_app/config/routes.dart'; +// import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +// import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +// import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +// import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +// import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; +// import 'package:mohem_flutter_app/provider/chat_provider_model.dart'; +// import 'package:mohem_flutter_app/provider/dashboard_provider_model.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/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'; +// import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; +// import 'package:mohem_flutter_app/widgets/mark_attendance_widget.dart'; +// import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart'; +// import 'package:mohem_flutter_app/widgets/shimmer/offers_shimmer_widget.dart'; +// import 'package:provider/provider.dart'; +// import 'package:pull_to_refresh/pull_to_refresh.dart'; +// import 'package:signalr_netcore/signalr_client.dart'; +// +// late HubConnection chatHubConnection; +// +// class DashboardScreen extends StatefulWidget { +// DashboardScreen({Key? key}) : super(key: key); +// +// @override +// _DashboardScreenState createState() { +// return _DashboardScreenState(); +// } +// } +// +// class _DashboardScreenState extends State { +// late DashboardProviderModel data; +// late MarathonProvider marathonProvider; +// late ChatProviderModel cProvider; +// final GlobalKey _scaffoldState = GlobalKey(); +// +// final RefreshController _refreshController = RefreshController(initialRefresh: false); +// +// int currentIndex = 0; +// +// @override +// void initState() { +// super.initState(); +// scheduleMicrotask(() { +// data = Provider.of(context, listen: false); +// if (env["marathon"]) { +// marathonProvider = Provider.of(context, listen: false); +// } +// if (env["chat"]) { +// cProvider = Provider.of(context, listen: false); +// } +// _onRefresh(); +// }); +// } +// +// @override +// void dispose() { +// super.dispose(); +// chatHubConnection.stop(); +// } +// +// void _bHubCon() { +// cProvider.getUserAutoLoginToken().whenComplete(() { +// cProvider.buildHubConnection(); +// Future.delayed(const Duration(seconds: 2), () { +// cProvider.invokeChatCounter(userId: AppState().chatDetails!.response!.id!); +// }); +// }); +// } +// +// void _onRefresh() async { +// data.initProvider(); +// if (env["chat"]) { +// _bHubCon(); +// } +// // data.getITGNotification().then((value) { +// // print("--------------------detail_1-----------------"); +// // print(value!.result!.data!.notificationMasterId); +// // print(value.result!.data!.notificationTitle); +// // }); +// data.fetchListMenu(); +// if (env["dashboard"]["attendance"]) { +// data.fetchAttendanceTracking(context); +// } +// data.fetchWorkListCounter(context); +// if (env["dashboard"]["missingSwipe"]) { +// data.fetchMissingSwipe(context); +// } +// data.fetchLeaveTicketBalance(context, DateTime.now()); +// data.fetchMenuEntries(); +// data.getCategoryOffersListAPI(context); +// if (env["marathon"]) { +// marathonProvider.getMarathonDetailsFromApi(); +// } +// _refreshController.refreshCompleted(); +// } +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// key: _scaffoldState, +// // appBar: AppBar( +// // actions: [ +// // IconButton( +// // onPressed: () { +// // data.getITGNotification().then((val) { +// // if (val!.result!.data != null) { +// // print("-------------------- Survey ----------------------------"); +// // if (val.result!.data!.notificationType == "Survey") { +// // Navigator.pushNamed(context, AppRoutes.survey, arguments: val.result!.data); +// // } else { +// // print("------------------------------------------- Ads --------------------"); +// // DashboardApiClient().getAdvertisementDetail(val.result!.data!.notificationMasterId ?? "").then( +// // (value) { +// // if (value!.mohemmItgResponseItem!.statusCode == 200) { +// // if (value.mohemmItgResponseItem!.result!.data != null) { +// // Navigator.pushNamed(context, AppRoutes.advertisement, arguments: { +// // "masterId": val.result!.data!.notificationMasterId, +// // "advertisement": value.mohemmItgResponseItem!.result!.data!.advertisement, +// // }); +// // +// // // Navigator.push( +// // // context, +// // // MaterialPageRoute( +// // // builder: (BuildContext context) => ITGAdsScreen( +// // // addMasterId: val.result!.data!.notificationMasterId!, +// // // advertisement: value.mohemmItgResponseItem!.result!.data!.advertisement!, +// // // ), +// // // ), +// // // ); +// // } +// // } +// // }, +// // ); +// // } +// // } +// // }); +// // }, +// // icon: Icon(Icons.add)) +// // ], +// // ), +// body: Column( +// children: [ +// Row( +// children: [ +// Builder(builder: (BuildContext context) { +// return Row( +// mainAxisSize: MainAxisSize.min, +// children: [ +// Image.memory( +// Utils.dataFromBase64String( +// AppState().memberInformationList!.eMPLOYEEIMAGE ?? "", +// ), +// errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) { +// return SvgPicture.asset( +// "assets/images/user.svg", +// height: 34, +// width: 34, +// ); +// }, +// width: 34, +// height: 34, +// fit: BoxFit.cover, +// ).circle(50), +// // CircularAvatar( +// // width: 34, +// // height: 34, +// // url: "https://cdn4.iconfinder.com/data/icons/professions-2-2/151/89-512.png", +// // ), +// 8.width, +// SvgPicture.asset("assets/images/side_nav.svg"), +// ], +// ).onPress(() { +// _scaffoldState.currentState!.openDrawer(); +// }); +// }), +// 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); +// }, +// ) +// ], +// ).paddingOnly(left: 21, right: 21, top: 48, bottom: 7), +// Expanded( +// child: SmartRefresher( +// enablePullDown: true, +// enablePullUp: false, +// header: const MaterialClassicHeader( +// color: MyColors.gradiantEndColor, +// ), +// controller: _refreshController, +// onRefresh: _onRefresh, +// child: SingleChildScrollView( +// child: Column( +// children: [ +// Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// LocaleKeys.welcomeBack.tr().toText14(color: MyColors.grey77Color), +// (AppState().memberInformationList!.eMPLOYEENAME ?? "").toText24(isBold: true), +// 16.height, +// Row( +// children: [ +// if (env["dashboard"]["attendance"]) +// Expanded( +// child: AspectRatio( +// aspectRatio: 159 / 159, +// child: Consumer( +// builder: (BuildContext context, DashboardProviderModel model, Widget? child) { +// return (model.isAttendanceTrackingLoading +// ? GetAttendanceTrackingShimmer() +// : Container( +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(15), +// gradient: const LinearGradient( +// transform: GradientRotation(.46), +// begin: Alignment.topRight, +// end: Alignment.bottomLeft, +// colors: [ +// MyColors.gradiantEndColor, +// MyColors.gradiantStartColor, +// ], +// ), +// ), +// child: Stack( +// alignment: Alignment.center, +// children: [ +// if (model.isTimeRemainingInSeconds == 0) SvgPicture.asset("assets/images/thumb.svg"), +// Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Expanded( +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// LocaleKeys.markAttendance.tr().toText14(color: Colors.white, isBold: true), +// if (model.isTimeRemainingInSeconds == 0) DateTime.now().toString().split(" ")[0].toText12(color: Colors.white), +// if (model.isTimeRemainingInSeconds != 0) +// Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// 9.height, +// Directionality( +// textDirection: ui.TextDirection.ltr, +// child: CountdownTimer( +// endTime: model.endTime, +// onEnd: null, +// endWidget: "00:00:00".toText14(color: Colors.white, isBold: true), +// textStyle: const TextStyle(color: Colors.white, fontSize: 14, letterSpacing: -0.48, fontWeight: FontWeight.bold), +// ), +// ), +// LocaleKeys.timeLeftToday.tr().toText12(color: Colors.white), +// 9.height, +// ClipRRect( +// borderRadius: const BorderRadius.all(Radius.circular(20)), +// child: LinearProgressIndicator( +// value: model.progress, +// minHeight: 8, +// valueColor: const AlwaysStoppedAnimation(Colors.white), +// backgroundColor: const Color(0xff196D73), +// ), +// ), +// ], +// ), +// ], +// ).paddingOnly(top: 12, right: 15, left: 12), +// ), +// Row( +// children: [ +// Expanded( +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// LocaleKeys.checkIn.tr().toText12(color: Colors.white), +// (model.attendanceTracking!.pSwipeIn == null ? "--:--" : model.attendanceTracking!.pSwipeIn) +// .toString() +// .toText14(color: Colors.white, isBold: true), +// 4.height, +// ], +// ).paddingOnly(left: 12, right: 12), +// ), +// Container( +// margin: EdgeInsets.only(top: AppState().isArabic(context) ? 6 : 0), +// width: 45, +// height: 45, +// padding: const EdgeInsets.only(left: 10, right: 10), +// decoration: BoxDecoration( +// color: Color(0xff259EA4), +// borderRadius: BorderRadius.only( +// bottomRight: AppState().isArabic(context) ? Radius.circular(0) : Radius.circular(15), +// bottomLeft: AppState().isArabic(context) ? Radius.circular(15) : Radius.circular(0), +// ), +// ), +// child: SvgPicture.asset(model.isTimeRemainingInSeconds == 0 ? "assets/images/attendance.svg" : "assets/images/attendance.svg"), +// ).onPress(() { +// showMyBottomSheet( +// context, +// callBackFunc: () {}, +// child: MarkAttendanceWidget(model, isFromDashboard: true), +// ); +// }), +// ], +// ), +// ], +// ), +// ], +// ), +// ).onPress( +// () { +// Navigator.pushNamed(context, AppRoutes.todayAttendance); +// }, +// )) +// .animatedSwither(); +// }, +// ), +// ), +// ), +// if (env["dashboard"]["attendance"]) 9.width, +// Expanded( +// child: MenusWidget(), +// ), +// ], +// ), +// ], +// ).paddingOnly(left: 21, right: 21, top: 7), +// if (env["marathon"]) +// context.watch().isLoading +// ? const MarathonBannerShimmer().paddingAll(20) +// : MarathonBanner(isMarathonUpcoming: context.watch().isUpComingMarathon).paddingAll(20), +// ServicesWidget(), +// 8.height, +// if (env["offersDiscount"]) +// Container( +// width: double.infinity, +// padding: const EdgeInsets.only(top: 31), +// decoration: BoxDecoration( +// color: Colors.white, +// borderRadius: const BorderRadius.only(topRight: Radius.circular(50), topLeft: Radius.circular(50)), +// border: Border.all(color: MyColors.lightGreyEDColor, width: 1), +// ), +// child: 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( +// 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( +// 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].rowID!, +// transitionOnUserGestures: true, +// child: Image.network( +// data.getOffersList[index].bannerImage!, +// fit: BoxFit.contain, +// ), +// ), +// ), +// ), +// 4.height, +// Expanded( +// child: AppState().isArabic(context) +// ? data.getOffersList[index].titleAR!.toText12(isCenter: true, maxLine: 1) +// : data.getOffersList[index].title!.toText12(isCenter: true, maxLine: 1), +// ), +// ], +// ), +// ), +// ); +// }, +// separatorBuilder: (BuildContext cxt, int index) => 8.width, +// itemCount: 6), +// ); +// }, +// ), +// ], +// ), +// ) +// ], +// ), +// ), +// ), +// ) +// ], +// ), +// drawer: SafeArea( +// child: AppDrawer(onLanguageChange: _onRefresh), +// ), +// bottomNavigationBar: !env["bottomBar"] +// ? null +// : SizedBox( +// height: Platform.isAndroid ? 70 : 100, +// child: BottomNavigationBar( +// items: [ +// BottomNavigationBarItem( +// icon: SvgPicture.asset( +// "assets/icons/home.svg", +// color: currentIndex == 0 ? MyColors.grey3AColor : MyColors.grey98Color, +// ).paddingAll(4), +// label: LocaleKeys.home.tr(), +// ), +// BottomNavigationBarItem( +// icon: SvgPicture.asset( +// "assets/icons/create_req.svg", +// color: currentIndex == 1 ? MyColors.grey3AColor : MyColors.grey98Color, +// ).paddingAll(4), +// label: LocaleKeys.createRequest.tr(), +// ), +// BottomNavigationBarItem( +// icon: Stack( +// alignment: Alignment.centerLeft, +// children: [ +// SvgPicture.asset( +// "assets/icons/work_list.svg", +// color: currentIndex == 2 ? MyColors.grey3AColor : MyColors.grey98Color, +// ).paddingAll(4), +// Consumer( +// builder: (BuildContext cxt, DashboardProviderModel data, Widget? child) { +// if (data.workListCounter == 0) { +// return const SizedBox(); +// } +// return Positioned( +// right: 0, +// top: 0, +// child: Container( +// padding: const EdgeInsets.only(left: 4, right: 4), +// alignment: Alignment.center, +// decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), +// child: data.workListCounter.toString().toText10(color: Colors.white), +// ), +// ); +// }, +// ), +// ], +// ), +// 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(), +// ), +// BottomNavigationBarItem( +// icon: Stack( +// alignment: Alignment.centerLeft, +// children: [ +// SvgPicture.asset( +// "assets/icons/chat/chat.svg", +// color: currentIndex == 4 ? MyColors.grey3AColor : MyColors.grey98Color, +// ).paddingAll(4), +// Consumer( +// builder: (BuildContext cxt, ChatProviderModel data, Widget? child) { +// return Positioned( +// right: 0, +// top: 0, +// child: Container( +// padding: const EdgeInsets.only(left: 4, right: 4), +// alignment: Alignment.center, +// decoration: BoxDecoration(color: MyColors.redColor, borderRadius: BorderRadius.circular(17)), +// child: data.chatUConvCounter.toString().toText10(color: Colors.white), +// ), +// ); +// }, +// ), +// ], +// ), +// label: LocaleKeys.chat.tr(), +// ), +// ], +// currentIndex: currentIndex, +// selectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey3AColor, fontWeight: FontWeight.w600), +// unselectedLabelStyle: const TextStyle(fontSize: 10, color: MyColors.grey98Color, fontWeight: FontWeight.w600), +// type: BottomNavigationBarType.fixed, +// selectedItemColor: MyColors.grey3AColor, +// backgroundColor: MyColors.backgroundColor, +// selectedIconTheme: const IconThemeData(color: MyColors.grey3AColor, size: 28), +// unselectedIconTheme: const IconThemeData(color: MyColors.grey98Color, size: 28), +// onTap: (int index) { +// if (index == 1) { +// Navigator.pushNamed(context, AppRoutes.mowadhafhi); +// } else if (index == 2) { +// Navigator.pushNamed(context, AppRoutes.workList); +// } else if (index == 3) { +// Navigator.pushNamed(context, AppRoutes.itemsForSale); +// } else if (index == 4) { +// Navigator.pushNamed(context, AppRoutes.chat); +// } +// }, +// ), +// ), +// ); +// } +// +// void navigateToDetails(OffersListModel offersListModelObj) { +// List getOffersDetailList = []; +// getOffersDetailList.clear(); +// int counter = 1; +// +// getOffersDetailList.add(offersListModelObj); +// +// for (OffersListModel element in data.getOffersList) { +// if (counter <= 4) { +// if (element.rowID != offersListModelObj.rowID) { +// getOffersDetailList.add(element); +// counter++; +// } +// } +// } +// +// Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList); +// } +// } \ No newline at end of file diff --git a/lib/ui/landing/widget/menus_widget.dart b/lib/ui/landing/widget/menus_widget.dart index 64855ee..51cb3c7 100644 --- a/lib/ui/landing/widget/menus_widget.dart +++ b/lib/ui/landing/widget/menus_widget.dart @@ -2,6 +2,7 @@ import 'package:easy_localization/src/public_ext.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; +import 'package:mohem_flutter_app/config/env.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; @@ -52,6 +53,7 @@ class MenusWidget extends StatelessWidget { ).onPress(() { Navigator.pushNamed(context, AppRoutes.workList); }), + if(env["dashboard"]["missingSwipe"]) data.isMissingSwipeLoading ? MenuShimmer().onPress(() { data.fetchWorkListCounter(context); @@ -106,6 +108,7 @@ class MenusWidget extends StatelessWidget { ).onPress(() { Navigator.pushNamed(context, AppRoutes.leaveBalance); }), + if(env["dashboard"]["ticketBalance"]) data.isLeaveTicketBalanceLoading ? MenuShimmer().onPress(() { data.fetchWorkListCounter(context); diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index 2333c18..cf79e70 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -30,7 +30,7 @@ class ServicesWidget extends StatelessWidget { ]; return Consumer( - builder: (context, data, child) { + builder: (BuildContext context, DashboardProviderModel data, Widget? child) { return data.isServicesMenusLoading ? whileLoading() : ListView.separated( diff --git a/lib/ui/login/login_screen.dart b/lib/ui/login/login_screen.dart index 69750fa..d513868 100644 --- a/lib/ui/login/login_screen.dart +++ b/lib/ui/login/login_screen.dart @@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/notifications.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/env.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -173,13 +174,14 @@ class _LoginScreenState extends State { if (!kReleaseMode) { // username.text = "15444"; // Maha User // username.text = "15153"; // Tamer User - // password.text = "Abcd@12345"; + // password.text = "Abcd@1234"; - // username.text = "206535"; // Hashim User - // password.text = "Namira786"; - // 13777 - // Ab12345cd + username.text = "SRCA4779T"; // Hashim User + password.text = "a12345"; + + username.text = "SRCA04101"; // Hashim User + password.text = "a123456"; } if (isAppOpenBySystem!) checkFirebaseToken(); } @@ -230,12 +232,13 @@ class _LoginScreenState extends State { 12.height, InputWidget(LocaleKeys.password.tr(), "xxxxxx", password, isTextIsPassword: true), 9.height, - Align( - alignment: Alignment.centerRight, - child: LocaleKeys.forgotPassword.tr().toText12(isUnderLine: true, color: MyColors.textMixColor).onPress(() { - Navigator.pushNamed(context, AppRoutes.forgotPassword); - }), - ), + if (env["login"]["forgetPassword"]) + Align( + alignment: Alignment.centerRight, + child: LocaleKeys.forgotPassword.tr().toText12(isUnderLine: true, color: MyColors.textMixColor).onPress(() { + Navigator.pushNamed(context, AppRoutes.forgotPassword); + }), + ), 20.height, // DefaultButton( // "Connect HMG Network", diff --git a/lib/ui/login/verify_login_screen.dart b/lib/ui/login/verify_login_screen.dart index 0ba486b..6cce7c1 100644 --- a/lib/ui/login/verify_login_screen.dart +++ b/lib/ui/login/verify_login_screen.dart @@ -11,6 +11,7 @@ import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/env.dart'; import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/dialogs/otp_dialog.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; @@ -78,7 +79,7 @@ class _VerifyLoginScreenState extends State { children: [ if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(3), if (!isNeedVerifyWithFaceIDAndBiometrics) getButton(4), - getButton(2), + if (env["login"]["verificationMethod"]["whatsapp"]) getButton(2), getButton(1), ], ) @@ -572,7 +573,7 @@ class _VerifyLoginScreenState extends State { width: 38, color: isDisable ? MyColors.darkTextColor.withOpacity(0.7) : null, ), - _title.toText16(height: 20/16) + _title.toText16(height: 20 / 16) ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 367db22..f4c751a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,7 +69,7 @@ dependencies: open_file: ^3.2.1 wifi_iot: ^0.3.18 flutter_html: ^3.0.0-alpha.6 -# flutter_barcode_scanner: ^2.0.0 + # flutter_barcode_scanner: ^2.0.0 qr_code_scanner: ^1.0.0 qr_flutter: ^4.0.0 url_launcher: ^6.0.15 @@ -77,13 +77,13 @@ dependencies: flutter_rating_bar: ^4.0.1 auto_size_text: ^3.0.0 pull_to_refresh: ^2.0.0 -# lottie json animations + # lottie json animations lottie: any -# Marathon Card Swipe + # Marathon Card Swipe appinio_swiper: ^1.1.1 expandable: ^5.0.1 -# networkImage + # networkImage cached_network_image: ^3.2.2 #Chat