diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 5353a84..5fe5472 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -268,6 +268,10 @@ "summaryOfInformation": "ملخص المعلومات", "totalPayAmount": "المبلغ الإجمالي للدفع", "paymentInformation": "معلومات الدفع", + "performance": "تقييم الاداء", + "performanceEvaluation": "تقييم الأداء في", + "performanceEvaluationIn": "تقييم أدائك في", + "valuationIn": "تقييم الأداء في", "amount": "مقدار", "correctCurrentDatails": "تعديل او اكمال التفاصيل الحالية", "selectType": " حدد نوع التغيير الذي تريد القيام به", @@ -313,7 +317,6 @@ "employeeDigitalID": "هويةالموظف الرقمية", "businessCard": "بطاقة العمل", "viewBusinessCard": "عرض بطاقة العمل", - "performanceEvaluation": "تقييم الأداء", "logout": "تسجيل خروج", "checkOut": "وقت الخروج", "regular": "منتظم", @@ -363,6 +366,27 @@ "numberDays": "عدد الأيام", "poweredBy": "مشغل بواسطة", "cloudSolutions": "حلول السحابة", + "selectTemplate": "حدد قالب", + "myPostedAds": "إعلاناتي المنشورة", + "browseCategories": "تصفح الفئات", + "searchItems": "عناصر البحث", + "offerAndDiscounts": "العروض والخصومات", + "offerValid": "العرض صالح", + "offerExpired": "انتهى العرض", + "whatAreYouOffering": "ما الذي تعرضه؟", + "selectCategory": "اختر الفئة", + "inProgress": "في تَقَدم", + "locked": "مقفل", + "addDetails": "أضف التفاصيل", + "reviewAndSell": "مراجعة وبيع", + "itemTitle": "عنوان البند", + "itemCondition": "حالة السلعة", + "used": "تستخدم", + "region": "منطقة", + "selectRegion": "اختر المنطقة", + "itemPrice": "سعر السلعة", + "itemPhotos": "صور البند", + "itemInfo": "معلومات العنصر", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 18bf326..5635c59 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -312,12 +312,15 @@ "wantToReject": "Are you sure want to reject?", "employeeDigitalID": "Employee Digital ID", "businessCard": "Business Card", - "viewBusinessCard": "View Business Card", - "performanceEvaluation": "Performance Evaluation", - "logout": "Logout", "checkOut": "Check Out", "regular": "Regular", "mark": "Mark", + "performance": "Performance Evaluation", + "performanceEvaluationIn": "Your performance Evaluation in", + "valuationIn": "Performance Evaluation in", + "viewBusinessCard": "View Business Card", + "performanceEvaluation": "Performance Evaluation", + "logout": "Logout", "selectMethodOfAttendance": "Select the method to mark the attendance", "comeNearHMGWifi": "Please come near to HMG wifi", "deliverNotificationToMeRegardless": "Deliver notifications to me regardless of any general rules", @@ -363,6 +366,27 @@ "cloudSolutions": "Cloud Solutions", "subordinateLeave": "Subordinate Leave", "numberDays": "Number of days", + "selectTemplate": "Select Template", + "myPostedAds": "My posted ads", + "browseCategories": "Browse Categories", + "searchItems": "Search Items", + "offerAndDiscounts": "Offer & Discounts", + "offerValid": "Offer Valid", + "offerExpired": "Offer Expired", + "whatAreYouOffering": "What are you offering?", + "selectCategory": "Select Category", + "inProgress": "InProgress", + "locked": "Locked", + "addDetails": "Add Details", + "reviewAndSell": "Review & Sell", + "itemTitle": "Item Title", + "itemCondition": "Item Condition", + "used": "Used", + "region": "Region", + "selectRegion": "Select Region", + "itemPrice": "Item Price", + "itemPhotos": "Item Photos", + "itemInfo": "Item Info", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/profile_api_client.dart b/lib/api/profile_api_client.dart index b332499..2d8b71e 100644 --- a/lib/api/profile_api_client.dart +++ b/lib/api/profile_api_client.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:mohem_flutter_app/api/api_client.dart'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; @@ -10,21 +11,18 @@ import 'package:mohem_flutter_app/models/get_employee_address_model.dart'; import 'package:mohem_flutter_app/models/get_employee_basic_details.model.dart'; import 'package:mohem_flutter_app/models/get_employee_contacts.model.dart'; import 'package:mohem_flutter_app/models/get_employee_phones_model.dart'; +import 'package:mohem_flutter_app/models/performance.dart'; +import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; +import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart'; +import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart'; import 'package:mohem_flutter_app/models/profile/get_countries_list_model.dart'; import 'package:mohem_flutter_app/models/profile/phone_number_types_model.dart'; import 'package:mohem_flutter_app/models/profile/start_address_approval_process_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_address_transaction.dart'; -import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; -import 'package:mohem_flutter_app/models/profile/get_contact_clos_structure_list.dart'; -import 'package:mohem_flutter_app/models/profile/get_contact_details_list.dart'; import 'package:mohem_flutter_app/models/profile/submit_basic_details_transaction_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart'; import 'package:mohem_flutter_app/models/start_phone_approval_process_model.dart'; -import 'package:mohem_flutter_app/models/profile/submit_contact_transaction_list_model.dart'; -import 'package:mohem_flutter_app/models/profile/submit_phone_transactions.dart'; -import 'package:mohem_flutter_app/models/start_eit_approval_process_model.dart'; -import 'package:mohem_flutter_app/api/api_client.dart'; class ProfileApiClient { static final ProfileApiClient _instance = ProfileApiClient._internal(); @@ -379,7 +377,7 @@ class ProfileApiClient { }, url, postParams); } - Future submetConatctTransactionAddAndUpdate(String actionType, int relationId, List> list) async { + Future submitContactTransactionAddAndUpdate(String actionType, int relationId, List> list) async { String url = "${ApiConsts.erpRest}SUBMIT_CONTACT_TRANSACTION"; Map postParams = { "P_MENU_TYPE": "E", @@ -395,4 +393,15 @@ class ProfileApiClient { return responseData.submitContactTransactionList; }, url, postParams); } + + Future> getPerformanceAppraisal() async { + String url = "${ApiConsts.erpRest}GET_Performance_Appraisal"; + Map postParams = {}; + + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getPerformanceAppraisalList ?? []; + }, url, postParams); + } } diff --git a/lib/classes/colors.dart b/lib/classes/colors.dart index bca7f5c..040d41c 100644 --- a/lib/classes/colors.dart +++ b/lib/classes/colors.dart @@ -18,6 +18,8 @@ class MyColors { static const Color grey98Color = Color(0xff989898); static const Color lightGreyEFColor = Color(0xffEFEFEF); static const Color lightGreyEDColor = Color(0xffEDEDED); + static const Color lightGreyDeColor = Color(0xffDEDEDE); + static const Color lightGreyE3Color = Color(0xffE3E3E3); static const Color lightGreyE6Color = Color(0xffE6E6E6); static const Color lightGreyEAColor = Color(0xffEAEAEA); static const Color darkWhiteColor = Color(0xffE0E0E0); @@ -28,7 +30,6 @@ class MyColors { static const Color backgroundBlackColor = Color(0xff202529); static const Color black = Color(0xff000000); static const Color white = Color(0xffffffff); - static const Color green = Color(0xffffffff); static const Color borderColor = Color(0xffE8E8E8); static const Color borderE3Color = Color(0xffE3E3E3); static const Color borderCEColor = Color(0xffCECECE); diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 4917314..5f78298 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -25,6 +25,7 @@ import 'package:mohem_flutter_app/ui/my_team/subordinate_leave.dart'; import 'package:mohem_flutter_app/ui/my_team/team_members.dart'; import 'package:mohem_flutter_app/ui/my_team/view_attendance.dart'; import 'package:mohem_flutter_app/ui/payslip/monthly_pay_slip_screen.dart'; +import 'package:mohem_flutter_app/ui/performance/performance_appraisal_screen.dart'; import 'package:mohem_flutter_app/ui/profile/add_update_family_member.dart'; import 'package:mohem_flutter_app/ui/profile/basic_details.dart'; import 'package:mohem_flutter_app/ui/profile/contact_details.dart'; @@ -144,6 +145,9 @@ class AppRoutes { //Pay slip static const String monthlyPaySlip = "/monthlyPaySlip"; + //performance evaluation + + static const String performanceEvaluation = "/performanceEvaluation"; //My Team static const String myTeam = "/myTeam"; static const String employeeDetails = "/employeeDetails"; @@ -153,7 +157,6 @@ class AppRoutes { static const String createRequest = "/createRequest"; static const String subordinateLeave = "/subordinateLeave"; - static final Map routes = { login: (context) => LoginScreen(), verifyLogin: (context) => VerifyLoginScreen(), @@ -234,6 +237,7 @@ class AppRoutes { //pay slip monthlyPaySlip: (context) => MonthlyPaySlipScreen(), + performanceEvaluation: (context) => PerformanceAppraisal(), //My Team myTeam: (context) => MyTeam(), @@ -243,9 +247,5 @@ class AppRoutes { teamMembers: (context) => TeamMembers(), createRequest: (context) => CreateRequest(), subordinateLeave: (context) => SubordinateLeave(), - - - - }; -} \ No newline at end of file +} diff --git a/lib/extensions/int_extensions.dart b/lib/extensions/int_extensions.dart index 215f8d9..f46d5bb 100644 --- a/lib/extensions/int_extensions.dart +++ b/lib/extensions/int_extensions.dart @@ -1,9 +1,13 @@ import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; extension IntExtensions on int { Widget get height => SizedBox(height: toDouble()); Widget get width => SizedBox(width: toDouble()); + Widget get divider => Divider(height: toDouble(), thickness: toDouble(), color: MyColors.lightGreyEFColor); + Widget get makeItSquare => SizedBox(width: toDouble(), height: toDouble()); } diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index f59dcf7..930c32c 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -15,7 +15,7 @@ extension CapExtension on String { extension EmailValidator on String { Widget get toWidget => Text(this); - Widget toText10({Color? color, bool isBold = false, int? maxLine}) => Text( + Widget toText10({Color? color, bool isBold = false, int? maxlines}) => Text( this, //maxLines: maxlines, style: TextStyle(fontSize: 10, fontWeight: isBold ? FontWeight.bold : FontWeight.w600, color: color ?? MyColors.darkTextColor, letterSpacing: -0.4), diff --git a/lib/extensions/widget_extensions.dart b/lib/extensions/widget_extensions.dart index c9a4b49..fc4d8f4 100644 --- a/lib/extensions/widget_extensions.dart +++ b/lib/extensions/widget_extensions.dart @@ -42,12 +42,12 @@ extension WidgetExtensions on Widget { child: this, ); - Widget objectContainerView({String title = "", String note = ""}) { + Widget objectContainerView({String title = "", String note = "", bool disablePadding = false,double radius =15}) { return Container( - padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + padding: disablePadding ? EdgeInsets.zero : const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(radius), boxShadow: [ BoxShadow( color: const Color(0xff000000).withOpacity(.05), diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 255e04e..96e1e09 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -284,6 +284,10 @@ class CodegenLoader extends AssetLoader{ "summaryOfInformation": "ملخص المعلومات", "totalPayAmount": "المبلغ الإجمالي للدفع", "paymentInformation": "معلومات الدفع", + "performance": "تقييم الاداء", + "performanceEvaluation": "تقييم الأداء في", + "performanceEvaluationIn": "تقييم أدائك في", + "valuationIn": "تقييم الأداء في", "amount": "مقدار", "correctCurrentDatails": "تعديل او اكمال التفاصيل الحالية", "selectType": " حدد نوع التغيير الذي تريد القيام به", @@ -329,7 +333,6 @@ class CodegenLoader extends AssetLoader{ "employeeDigitalID": "هويةالموظف الرقمية", "businessCard": "بطاقة العمل", "viewBusinessCard": "عرض بطاقة العمل", - "performanceEvaluation": "تقييم الأداء", "logout": "تسجيل خروج", "checkOut": "وقت الخروج", "regular": "منتظم", @@ -379,6 +382,27 @@ class CodegenLoader extends AssetLoader{ "numberDays": "عدد الأيام", "poweredBy": "مشغل بواسطة", "cloudSolutions": "حلول السحابة", + "selectTemplate": "حدد قالب", + "myPostedAds": "إعلاناتي المنشورة", + "browseCategories": "تصفح الفئات", + "searchItems": "عناصر البحث", + "offerAndDiscounts": "العروض والخصومات", + "offerValid": "العرض صالح", + "offerExpired": "انتهى العرض", + "whatAreYouOffering": "ما الذي تعرضه؟", + "selectCategory": "اختر الفئة", + "inProgress": "في تَقَدم", + "locked": "مقفل", + "addDetails": "أضف التفاصيل", + "reviewAndSell": "مراجعة وبيع", + "itemTitle": "عنوان البند", + "itemCondition": "حالة السلعة", + "used": "تستخدم", + "region": "منطقة", + "selectRegion": "اختر المنطقة", + "itemPrice": "سعر السلعة", + "itemPhotos": "صور البند", + "itemInfo": "معلومات العنصر", "profile": { "reset_password": { "label": "Reset Password", @@ -727,12 +751,15 @@ static const Map en_US = { "wantToReject": "Are you sure want to reject?", "employeeDigitalID": "Employee Digital ID", "businessCard": "Business Card", - "viewBusinessCard": "View Business Card", - "performanceEvaluation": "Performance Evaluation", - "logout": "Logout", "checkOut": "Check Out", "regular": "Regular", "mark": "Mark", + "performance": "Performance Evaluation", + "performanceEvaluationIn": "Your performance Evaluation in", + "valuationIn": "Performance Evaluation in", + "viewBusinessCard": "View Business Card", + "performanceEvaluation": "Performance Evaluation", + "logout": "Logout", "selectMethodOfAttendance": "Select the method to mark the attendance", "comeNearHMGWifi": "Please come near to HMG wifi", "deliverNotificationToMeRegardless": "Deliver notifications to me regardless of any general rules", @@ -774,10 +801,31 @@ static const Map en_US = { "hours": "Hours", "approvalStatus": "Approval Status", "absenceStatus": "Absence Status", - "subordinateLeave": "Subordinate Leave", - "numberDays": "Number of days", "poweredBy": "Powered By", "cloudSolutions": "Cloud Solutions", + "subordinateLeave": "Subordinate Leave", + "numberDays": "Number of days", + "selectTemplate": "Select Template", + "myPostedAds": "My posted ads", + "browseCategories": "Browse Categories", + "searchItems": "Search Items", + "offerAndDiscounts": "Offer & Discounts", + "offerValid": "Offer Valid", + "offerExpired": "Offer Expired", + "whatAreYouOffering": "What are you offering?", + "selectCategory": "Select Category", + "inProgress": "InProgress", + "locked": "Locked", + "addDetails": "Add Details", + "reviewAndSell": "Review & Sell", + "itemTitle": "Item Title", + "itemCondition": "Item Condition", + "used": "Used", + "region": "Region", + "selectRegion": "Select Region", + "itemPrice": "Item Price", + "itemPhotos": "Item Photos", + "itemInfo": "Item Info", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 8c6247b..b111cd2 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -269,6 +269,10 @@ abstract class LocaleKeys { static const summaryOfInformation = 'summaryOfInformation'; static const totalPayAmount = 'totalPayAmount'; static const paymentInformation = 'paymentInformation'; + static const performance = 'performance'; + static const performanceEvaluation = 'performanceEvaluation'; + static const performanceEvaluationIn = 'performanceEvaluationIn'; + static const valuationIn = 'valuationIn'; static const amount = 'amount'; static const correctCurrentDatails = 'correctCurrentDatails'; static const selectType = 'selectType'; @@ -314,7 +318,6 @@ abstract class LocaleKeys { static const employeeDigitalID = 'employeeDigitalID'; static const businessCard = 'businessCard'; static const viewBusinessCard = 'viewBusinessCard'; - static const performanceEvaluation = 'performanceEvaluation'; static const logout = 'logout'; static const checkOut = 'checkOut'; static const regular = 'regular'; @@ -360,10 +363,31 @@ abstract class LocaleKeys { static const hours = 'hours'; static const approvalStatus = 'approvalStatus'; static const absenceStatus = 'absenceStatus'; - static const poweredBy = 'poweredBy'; - static const cloudSolutions = 'cloudSolutions'; static const subordinateLeave = 'subordinateLeave'; static const numberDays = 'numberDays'; + static const poweredBy = 'poweredBy'; + static const cloudSolutions = 'cloudSolutions'; + static const selectTemplate = 'selectTemplate'; + static const myPostedAds = 'myPostedAds'; + static const browseCategories = 'browseCategories'; + static const searchItems = 'searchItems'; + static const offerAndDiscounts = 'offerAndDiscounts'; + static const offerValid = 'offerValid'; + static const offerExpired = 'offerExpired'; + static const whatAreYouOffering = 'whatAreYouOffering'; + static const selectCategory = 'selectCategory'; + static const inProgress = 'inProgress'; + static const locked = 'locked'; + static const addDetails = 'addDetails'; + static const reviewAndSell = 'reviewAndSell'; + static const itemTitle = 'itemTitle'; + static const itemCondition = 'itemCondition'; + static const used = 'used'; + static const region = 'region'; + static const selectRegion = 'selectRegion'; + static const itemPrice = 'itemPrice'; + static const itemPhotos = 'itemPhotos'; + static const itemInfo = 'itemInfo'; static const profile_reset_password_label = 'profile.reset_password.label'; static const profile_reset_password_username = 'profile.reset_password.username'; static const profile_reset_password_password = 'profile.reset_password.password'; diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index 11d7ec2..ccc53c1 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -66,6 +66,7 @@ import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_pending_transactions_details.dart'; import 'package:mohem_flutter_app/models/pending_transactions/get_req_functions.dart'; +import 'package:mohem_flutter_app/models/performance.dart'; import 'package:mohem_flutter_app/models/privilege_list_model.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_cols_structions.dart'; import 'package:mohem_flutter_app/models/profile/basic_details_dff_structure.dart'; @@ -206,7 +207,11 @@ class GenericResponseModel { List? getOrganizationsSalariesList; List? getPaymentInformationList; List? getPayslipList; - List? getPerformanceAppraisalList; + + // List? getPendingReqDetailsList; + // List? getPendingReqFunctionsList; + List? getPerformanceAppraisalList; + List? getPhonesNotificationBodyList; List? getPoItemHistoryList; GetPoNotificationBodyList? getPoNotificationBodyList; @@ -227,7 +232,7 @@ class GenericResponseModel { List? getCCPDFFStructureModel; List? getSubordinatesAttdStatusList; List? getSubordinatesLeavesList; - List?getSubordinatesLeavesTotalVacationsList; + List? getSubordinatesLeavesTotalVacationsList; List? getSummaryOfPaymentList; List? getSwipesList; List? getTermColsStructureList; @@ -940,7 +945,8 @@ class GenericResponseModel { } // getPendingReqDetailsList = json['GetPendingReqDetailsList']; // getPendingReqFunctionsList = json['GetPendingReqFunctionsList']; - getPerformanceAppraisalList = json['GetPerformanceAppraisalList']; + getPerformanceAppraisalList = + json['GetPerformanceAppraisalList'] == null ? null : List.from(json["GetPerformanceAppraisalList"].map((x) => GetPerformanceAppraisalList.fromJson(x))); getPhonesNotificationBodyList = json["GetPhonesNotificationBodyList"] == null ? null : List.from(json["GetPhonesNotificationBodyList"].map((x) => GetPhonesNotificationBodyList.fromJson(x))); if (json['GetPoItemHistoryList'] != null) { @@ -993,11 +999,9 @@ class GenericResponseModel { } if (json['GetSubordinatesLeavesTotalVacationsList'] != null) { - getSubordinatesLeavesTotalVacationsList = - []; + getSubordinatesLeavesTotalVacationsList = []; json['GetSubordinatesLeavesTotalVacationsList'].forEach((v) { - getSubordinatesLeavesTotalVacationsList! - .add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); + getSubordinatesLeavesTotalVacationsList!.add(new GetSubordinatesLeavesTotalVacationsList.fromJson(v)); }); } if (json['GetSummaryOfPaymentList'] != null) { @@ -1577,10 +1581,7 @@ class GenericResponseModel { } if (this.getSubordinatesLeavesTotalVacationsList != null) { - data['GetSubordinatesLeavesTotalVacationsList'] = this - .getSubordinatesLeavesTotalVacationsList! - .map((v) => v.toJson()) - .toList(); + data['GetSubordinatesLeavesTotalVacationsList'] = this.getSubordinatesLeavesTotalVacationsList!.map((v) => v.toJson()).toList(); } if (this.getSummaryOfPaymentList != null) { data['GetSummaryOfPaymentList'] = this.getSummaryOfPaymentList!.map((v) => v.toJson()).toList(); diff --git a/lib/models/performance.dart b/lib/models/performance.dart new file mode 100644 index 0000000..2fe8a5f --- /dev/null +++ b/lib/models/performance.dart @@ -0,0 +1,18 @@ +class GetPerformanceAppraisalList { + String? aPPRAISALSCORE; + int? aPPRAISALYEAR; + + GetPerformanceAppraisalList({this.aPPRAISALSCORE, this.aPPRAISALYEAR}); + + GetPerformanceAppraisalList.fromJson(Map json) { + aPPRAISALSCORE = json['APPRAISAL_SCORE']; + aPPRAISALYEAR = json['APPRAISAL_YEAR']; + } + + Map toJson() { + Map data = new Map(); + data['APPRAISAL_SCORE'] = this.aPPRAISALSCORE; + data['APPRAISAL_YEAR'] = this.aPPRAISALYEAR; + return data; + } +} diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index 5c4b20f..a98d091 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -148,7 +148,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List drawerMenuItemList = [ DrawerMenuItem("assets/images/drawer/my_profile.svg", LocaleKeys.myProfile.tr(), AppRoutes.profile), - DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), ""), + DrawerMenuItem("assets/images/drawer/performance_evaluation.svg", LocaleKeys.performanceEvaluation.tr(), AppRoutes.performanceEvaluation), DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.mowadhafhi.tr(), AppRoutes.mowadhafhi), DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), ""), @@ -159,7 +159,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { List menuList = await DashboardApiClient().getListMenu(); List findMyRequest = menuList.where((element) => element.menuName == "My Requests").toList(); if (findMyRequest.isNotEmpty) { - drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myTeam)); + drawerMenuItemList.insert(3, DrawerMenuItem("assets/images/drawer/my_requests.svg", LocaleKeys.myRequest.tr(), AppRoutes.myRequests)); } List findMyTeam = menuList.where((element) => element.menuName == "My Team").toList(); if (findMyTeam.isNotEmpty) { diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index ad5ba1d..3f4e5f2 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -240,7 +240,7 @@ class _DashboardScreenState extends State { ], ).paddingOnly(left: 21, right: 21, top: 7), ServicesWidget(), - 8.height, + // 8.height, Container( width: double.infinity, padding: const EdgeInsets.only(top: 31), @@ -277,11 +277,9 @@ class _DashboardScreenState extends State { ], ), ), - InkWell( - onTap: () { - Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); - }, - child: LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true)), + LocaleKeys.viewAllOffers.tr().toText12(isUnderLine: true).onPress(() { + Navigator.pushNamed(context, AppRoutes.offersAndDiscounts); + }) ], ).paddingOnly(left: 21, right: 21), Consumer( @@ -312,7 +310,7 @@ class _DashboardScreenState extends State { borderRadius: const BorderRadius.all( Radius.circular(100), ), - border: Border.all(color: MyColors.lightGreyEDColor, width: 1), + border: Border.all(color: MyColors.lightGreyE3Color, width: 1), ), child: ClipRRect( borderRadius: const BorderRadius.all( diff --git a/lib/ui/landing/widget/services_widget.dart b/lib/ui/landing/widget/services_widget.dart index 868ca5e..d2e9208 100644 --- a/lib/ui/landing/widget/services_widget.dart +++ b/lib/ui/landing/widget/services_widget.dart @@ -33,69 +33,68 @@ class ServicesWidget extends StatelessWidget { return data.isServicesMenusLoading ? whileLoading() : ListView.separated( + padding: const EdgeInsets.only(top: 21), itemBuilder: (context, parentIndex) { - return Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - data.homeMenus![parentIndex].menuEntry.prompt!.toSectionHeading().expanded, - LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true), - ], - ).paddingOnly(left: 21, right: 21), - SizedBox( - height: 105 + 26, - child: ListView.separated( - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), - scrollDirection: Axis.horizontal, - itemBuilder: (cxt, index) { - return AspectRatio( - aspectRatio: 105 / 105, - child: data.isServicesMenusLoading - ? ServicesMenuShimmer() - : Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SvgPicture.asset(iconT[index]), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), - ), - SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) - ], - ) - ], - ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), - ).onPress(() { - handleOnPress(context, data.homeMenus![parentIndex].menuEntiesList[index]); - }), - ); - }, - separatorBuilder: (cxt, index) => 9.width, - itemCount: data.homeMenus![parentIndex].menuEntiesList.length), - ), - ], - ), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + data.homeMenus![parentIndex].menuEntry.prompt!.toSectionHeading().expanded, + LocaleKeys.viewAllServices.tr().toText12(isUnderLine: true), + ], + ).paddingOnly(left: 21, right: 21), + SizedBox( + height: 105 + 26, + child: ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return AspectRatio( + aspectRatio: 105 / 105, + child: data.isServicesMenusLoading + ? ServicesMenuShimmer() + : Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SvgPicture.asset(iconT[index]), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: data.homeMenus![parentIndex].menuEntiesList[index].prompt!.toText11(isBold: true), + ), + SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4) + ], + ) + ], + ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), + ).onPress(() { + handleOnPress(context, data.homeMenus![parentIndex].menuEntiesList[index]); + }), + ); + }, + separatorBuilder: (cxt, index) => 9.width, + itemCount: data.homeMenus![parentIndex].menuEntiesList.length), + ), + ], ); }, separatorBuilder: (context, index) { @@ -116,6 +115,9 @@ class ServicesWidget extends StatelessWidget { } else if (menuEntry.requestType == "VACATION_RULE") { Navigator.pushNamed(context, AppRoutes.vacationRule); return; + } else if (menuEntry.menuName == "MBL_PERINFO_SS") { + Navigator.of(context).pushNamed(AppRoutes.profile); + return; } List menuList = pro.getMenuEntriesList?.where((element) => element.parentMenuName == menuEntry.menuName && element.menuEntryType == "FUNCTION").toList() ?? []; menuEntry.icon = ""; @@ -149,7 +151,7 @@ class ServicesWidget extends StatelessWidget { Widget whileLoading() { return Column( children: [ - ServicesHeaderShimmer().paddingOnly(left: 21, right: 21), + ServicesHeaderShimmer().paddingOnly(left: 21, right: 21, top: 21), SizedBox( height: 105 + 26, child: ListView.separated( diff --git a/lib/ui/performance/performance_appraisal_screen.dart b/lib/ui/performance/performance_appraisal_screen.dart new file mode 100644 index 0000000..9a684f9 --- /dev/null +++ b/lib/ui/performance/performance_appraisal_screen.dart @@ -0,0 +1,97 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/profile_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.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/performance.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; + +class PerformanceAppraisal extends StatelessWidget { + PerformanceAppraisal({Key? key}) : super(key: key); + + Future> getPerformanceAppraisal(context) async { + List performance = []; + try { + Utils.showLoading(context); + performance = await ProfileApiClient().getPerformanceAppraisal(); + Utils.hideLoading(context); + } catch (ex) { + performance = []; + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + return performance; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: MyColors.backgroundColor, + appBar: AppBarWidget(context, title: LocaleKeys.performance.tr()), + body: FutureBuilder( + future: getPerformanceAppraisal(context), + builder: (cxt, snapShot) { + if (snapShot.connectionState == ConnectionState.done) { + if (snapShot.hasData) { + List performance = snapShot.data as List; + if (performance.isNotEmpty) { + return ListView( + padding: const EdgeInsets.all(0), + children: [ + getPerformanceCard(performance.first).paddingOnly(left: 21, right: 21, top: 21), + GridView.count( + physics: const NeverScrollableScrollPhysics(), + crossAxisCount: 2, + mainAxisSpacing: 13, + crossAxisSpacing: 13, + shrinkWrap: true, + childAspectRatio: 160 / 125, + padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 14), + children: performance + .where((GetPerformanceAppraisalList el) => performance.indexOf(el) != 0) + .map( + (GetPerformanceAppraisalList item) => getPerformanceCard(item, isGrid: true), + ) + .toList(), + ), + ], + ); + } + } + return Utils.getNoDataWidget(context); + } + return const SizedBox(); + }, + ), + ); + } + + Widget getPerformanceCard(GetPerformanceAppraisalList performance, {bool isGrid = false}) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.only(left: 12, right: 12, top: 2, bottom: 2), + decoration: Utils.containerRadius(MyColors.greenColor, 5), + child: "Excellent".toText10(color: Colors.white), + ), + (isGrid ? 8 : 4).height, + isGrid ? "${LocaleKeys.performanceEvaluationIn.tr()} ${performance.aPPRAISALYEAR}".toText13() : "${LocaleKeys.performanceEvaluationIn.tr()} ${performance.aPPRAISALYEAR}".toText18(), + 4.height, + LinearProgressIndicator( + minHeight: 4, + backgroundColor: MyColors.lightGreyDeColor, + valueColor: const AlwaysStoppedAnimation(MyColors.greenColor), + value: double.parse(performance.aPPRAISALSCORE!) / 100, + ), + 4.height, + isGrid ? "${performance.aPPRAISALSCORE}%".toText13(color: MyColors.greenColor) : "${performance.aPPRAISALSCORE}%".toText20(color: MyColors.greenColor), + ], + ).objectContainerView(radius: 10); + } +} diff --git a/lib/ui/profile/add_update_family_member.dart b/lib/ui/profile/add_update_family_member.dart index 224bfce..78d99de 100644 --- a/lib/ui/profile/add_update_family_member.dart +++ b/lib/ui/profile/add_update_family_member.dart @@ -448,9 +448,9 @@ class _AddUpdateFamilyMemberState extends State { Utils.showLoading(context); if (args['actionType'] == "ADD") { var relationID = null; - submitContactTransactionList = await ProfileApiClient().submetConatctTransactionAddAndUpdate(args['actionType'], relationID, valuesFinal); + submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], relationID, valuesFinal); } else if (args['actionType'] == "UPDATE") { - submitContactTransactionList = await ProfileApiClient().submetConatctTransactionAddAndUpdate(args['actionType'], args['relationID'], valuesFinal); + submitContactTransactionList = await ProfileApiClient().submitContactTransactionAddAndUpdate(args['actionType'], args['relationID'], valuesFinal); } var transactionId = submitContactTransactionList!.pTRANSACTIONID; var itemKey = submitContactTransactionList!.pITEMKEY; diff --git a/lib/ui/profile/profile_screen.dart b/lib/ui/profile/profile_screen.dart index 8caf637..e72d3a9 100644 --- a/lib/ui/profile/profile_screen.dart +++ b/lib/ui/profile/profile_screen.dart @@ -17,7 +17,6 @@ import 'package:mohem_flutter_app/models/member_information_list_model.dart'; import 'package:mohem_flutter_app/ui/profile/widgets/profile_panel.dart'; import 'package:mohem_flutter_app/widgets/bottom_sheet.dart'; -// todo '@sultan' kindly follow structure of code written. use extension methods for widgets and dont hard code strings, use localizations class ProfileScreen extends StatefulWidget { const ProfileScreen({Key? key}) : super(key: key); diff --git a/lib/ui/screens/items_for_sale/add_new_item_for_sale.dart b/lib/ui/screens/items_for_sale/add_new_item_for_sale.dart index 307a834..aac9d13 100644 --- a/lib/ui/screens/items_for_sale/add_new_item_for_sale.dart +++ b/lib/ui/screens/items_for_sale/add_new_item_for_sale.dart @@ -1,8 +1,11 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/items_for_sale/items_for_sale_api_client.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.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/items_for_sale/get_sale_categories_list.dart'; import 'package:mohem_flutter_app/models/items_for_sale/item_review_model.dart'; import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/add_details_fragment.dart'; @@ -43,91 +46,52 @@ class _AddNewItemForSaleState extends State { getRequestID(); return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget( - context, - // title: LocaleKeys.mowadhafhiRequest.tr(), - title: "Items for sale", - showHomeButton: true, - ), + appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AspectRatio( - aspectRatio: 335 / 118, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], + Row( + children: [ + showProgress( + title: LocaleKeys.selectCategory.tr(), + status: _currentIndex == 0 ? LocaleKeys.inProgress.tr() : (_currentIndex > 0 ? LocaleKeys.completed.tr() : LocaleKeys.locked.tr()), + color: _currentIndex == 0 ? MyColors.orange : MyColors.greenColor, + pageIndex: 0, + ).expanded, + showProgress( + title: LocaleKeys.addDetails.tr(), + status: _currentIndex == 1 ? LocaleKeys.inProgress.tr() : (_currentIndex > 1 ? LocaleKeys.completed.tr() : LocaleKeys.locked.tr()), + color: _currentIndex == 1 ? MyColors.orange : (_currentIndex > 1 ? MyColors.greenColor : MyColors.lightGrayColor), + pageIndex: 1, + ).expanded, + showProgress( + title: LocaleKeys.reviewAndSell.tr(), + status: _currentIndex == 2 ? LocaleKeys.inProgress.tr() : LocaleKeys.locked.tr(), + color: _currentIndex == 2 + ? MyColors.orange + : _currentIndex > 3 + ? MyColors.greenColor + : MyColors.lightGrayColor, + isNeedBorder: false, + pageIndex: 2, ), - child: Row( - children: [ - Expanded( - child: showProgress( - title: "Select Category", - status: _currentIndex == 0 - ? "InProgress" - : _currentIndex > 0 - ? "Completed" - : "Locked", - color: _currentIndex == 0 ? MyColors.orange : MyColors.greenColor, - pageIndex: 0, - ), - ), - Expanded( - child: showProgress( - title: "Add Details", - status: _currentIndex == 1 - ? "InProgress" - : _currentIndex > 1 - ? "Completed" - : "Locked", - color: _currentIndex == 1 - ? MyColors.orange - : _currentIndex > 1 - ? MyColors.greenColor - : MyColors.lightGrayColor, - pageIndex: 1, - ), - ), - showProgress( - title: "Review & Sell", - status: _currentIndex == 2 ? "InProgress" : "Locked", - color: _currentIndex == 2 - ? MyColors.orange - : _currentIndex > 3 - ? MyColors.greenColor - : MyColors.lightGrayColor, - isNeedBorder: false, - pageIndex: 2, - ), - ], - ).paddingAll(21), - ).paddingOnly(left: 21, right: 21, top: 21), - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - getSaleCategoriesList.isNotEmpty ? SelectCategoryFragment(changePageViewIndex: changePageViewIndex, getSaleCategoriesList: getSaleCategoriesList) : Container(), - getSaleCategoriesList.isNotEmpty ? AddItemDetailsFragment(changePageViewIndex: changePageViewIndex, selectedSaleCategory: getSaleCategoriesList[0]) : Container(), - ItemReviewFragment(changePageViewIndex: changePageViewIndex), - ], - ), - ), + ], + ).paddingAll(21).objectContainerView(disablePadding: true).paddingAll(21), + PageView( + physics: const NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + getSaleCategoriesList.isNotEmpty ? SelectCategoryFragment(changePageViewIndex: changePageViewIndex, getSaleCategoriesList: getSaleCategoriesList) : Container(), + getSaleCategoriesList.isNotEmpty ? AddItemDetailsFragment(changePageViewIndex: changePageViewIndex, selectedSaleCategory: getSaleCategoriesList[0]) : Container(), + ItemReviewFragment(changePageViewIndex: changePageViewIndex), + ], + ).expanded, ], ), ); @@ -141,54 +105,43 @@ class _AddNewItemForSaleState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, + Row( children: [ - Row( - children: [ - Container( - width: 26, - height: 26, - decoration: Utils.containerRadius(color!, 200), - child: const Icon( - Icons.done, - color: Colors.white, - size: 16, - ), - ), - if (isNeedBorder) - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Utils.mDivider(Colors.grey), - )), - ], - ), - Utils.mHeight(8), - Text( - title!, - style: const TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - letterSpacing: -0.44, + Container( + width: 26, + height: 26, + decoration: Utils.containerRadius(color!, 200), + child: const Icon( + Icons.done, + color: Colors.white, + size: 16, ), ), - Utils.mHeight(2), - Container( - padding: EdgeInsets.all(5), - decoration: Utils.containerRadius(color.withOpacity(0.2), 4), - child: Text( - status!, - style: TextStyle( - fontSize: 8, - fontWeight: FontWeight.w600, - letterSpacing: -0.32, - color: color, + if (isNeedBorder) + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Utils.mDivider(Colors.grey), ), ), - ), ], - ) + ), + Utils.mHeight(8), + title!.toText11(), + Utils.mHeight(2), + Container( + padding: const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 4), + decoration: Utils.containerRadius(color.withOpacity(0.2), 4), + child: Text( + status!, + style: TextStyle( + fontSize: 8, + fontWeight: FontWeight.w600, + letterSpacing: -0.32, + color: color, + ), + ), + ), ], ), ); diff --git a/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart b/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart index 7919c0d..bfb5a5e 100644 --- a/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart +++ b/lib/ui/screens/items_for_sale/fragments/add_details_fragment.dart @@ -51,112 +51,116 @@ class _AddItemDetailsFragmentState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - "Add details".toText20(isBold: true).paddingOnly(top: 24, left: 21, right: 21), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - DynamicTextFieldWidget( - "Title", - itemTitle.isEmpty ? "Item title" : itemTitle, - isEnable: true, - suffixIconData: Icons.search, - isPopup: false, - lines: 1, - isInputTypeNum: false, - isReadOnly: false, - onChange: (String value) { - itemTitle = value; - }, - ).paddingOnly(), - DynamicTextFieldWidget( - "Description", - itemDescription.isEmpty ? "Item description" : itemDescription, - isEnable: true, - suffixIconData: Icons.search, - isPopup: false, - lines: 4, - isInputTypeNum: false, - isReadOnly: false, - onChange: (String value) { - itemDescription = value; - }, - ).paddingOnly(top: 12), - "Item Condition".toText14(isBold: true).paddingOnly(top: 21), - Row( - children: [ - ShowRadio(title: "New", value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { - selectedItemCondition = "new"; - setState(() {}); - }), - 12.width, - ShowRadio(title: "Used", value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { - selectedItemCondition = "used"; + return Column( + children: [ + ListView( + padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21), + children: [ + LocaleKeys.addDetails.tr().toText20(), + 12.height, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DynamicTextFieldWidget( + LocaleKeys.title.tr(), + itemTitle.isEmpty ? LocaleKeys.itemTitle.tr() : itemTitle, + isEnable: true, + suffixIconData: Icons.search, + isPopup: false, + lines: 1, + isInputTypeNum: false, + isReadOnly: false, + onChange: (String value) { + itemTitle = value; + }, + ), + DynamicTextFieldWidget( + LocaleKeys.description.tr(), + itemDescription.isEmpty ? LocaleKeys.itemDescription.tr() : itemDescription, + isEnable: true, + suffixIconData: Icons.search, + isPopup: false, + lines: 4, + isInputTypeNum: false, + isReadOnly: false, + onChange: (String value) { + itemDescription = value; + }, + ).paddingOnly(top: 12), + LocaleKeys.itemCondition.tr().toText14().paddingOnly(top: 21), + Row( + children: [ + ShowRadio(title: LocaleKeys.newString.tr(), value: "new", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { + selectedItemCondition = "new"; + setState(() {}); + }), + 12.width, + ShowRadio(title: LocaleKeys.used.tr(), value: "used", groupValue: selectedItemCondition, selectedColor: MyColors.gradiantStartColor).onPress(() { + selectedItemCondition = "used"; + setState(() {}); + }), + ], + ).paddingOnly(top: 12), + PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.region.tr(), + selectedRegion.regionName ?? LocaleKeys.selectRegion.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ), + itemBuilder: (_) => >[ + for (int i = 0; i < getRegionsList!.length; i++) PopupMenuItem(child: Text(getRegionsList[i].regionName!), value: i), + ], + onSelected: (int popupIndex) { + selectedRegion = getRegionsList![popupIndex]; setState(() {}); - }), - ], - ).paddingOnly(top: 12), - PopupMenuButton( - child: DynamicTextFieldWidget( - "Region", - selectedRegion.regionName ?? "Select Region", - isEnable: false, - isPopup: true, + }, + ).paddingOnly(top: 21), + DynamicTextFieldWidget( + LocaleKeys.itemPrice.tr(), + itemPrice == 0 ? LocaleKeys.price.tr() : itemPrice.toString(), + isEnable: true, + suffixIconData: Icons.search, + isPopup: false, + lines: 1, isInputTypeNum: true, isReadOnly: false, - ), - itemBuilder: (_) => >[ - for (int i = 0; i < getRegionsList!.length; i++) PopupMenuItem(child: Text(getRegionsList[i].regionName!), value: i), - ], - onSelected: (int popupIndex) { - selectedRegion = getRegionsList![popupIndex]; - setState(() {}); - }, - ).paddingOnly(top: 21), - DynamicTextFieldWidget( - "Item Price", - itemPrice == 0 ? "Price" : itemPrice.toString(), - isEnable: true, - suffixIconData: Icons.search, - isPopup: false, - lines: 1, - isInputTypeNum: true, - isReadOnly: false, - onChange: (String value) { - itemPrice = num.parse(value); - }, - ).paddingOnly(top: 12), - "Item Photos".toText14(isBold: true).paddingOnly(top: 16), - attachmentView("Attachments").paddingOnly(top: 12), - Row( - children: [ - DefaultButton( - LocaleKeys.cancel.tr(), - () async { - Navigator.of(context).pop(); + onChange: (String value) { + itemPrice = num.parse(value); + }, + ).paddingOnly(top: 12), + LocaleKeys.itemPhotos.tr().toText14().paddingOnly(top: 21), + attachmentView(LocaleKeys.attachments.tr()).paddingOnly(top: 12), + ], + ).objectContainerView(title: LocaleKeys.itemInfo.tr()), + ], + ).expanded, + 1.divider, + Row( + children: [ + DefaultButton( + LocaleKeys.cancel.tr(), + () async { + Navigator.of(context).pop(); + }, + colors: const [Color(0xffD02127), Color(0xffD02127)], + ).expanded, + 8.width, + DefaultButton( + LocaleKeys.next.tr(), + isButtonDisabled() + ? null + : () async { + AddItemDetailsFragment.itemReviewModel = getItemReviewObject(); + widget.changePageViewIndex(2); }, - colors: const [Color(0xffD02127), Color(0xffD02127)], - ).expanded, - 12.width, - DefaultButton( - LocaleKeys.next.tr(), - isButtonDisabled() - ? null - : () async { - AddItemDetailsFragment.itemReviewModel = getItemReviewObject(); - widget.changePageViewIndex(2); - }, - disabledColor: MyColors.lightGrayColor, - ).expanded - ], - ).paddingOnly(top: 21), - ], - ).objectContainerView(title: "Item Info").paddingAll(21), - ], - ), + disabledColor: MyColors.lightGrayColor, + ).expanded + ], + ).insideContainer + ], ); } @@ -174,82 +178,70 @@ class _AddItemDetailsFragmentState extends State { } Widget attachmentView(String title) { - return Container( - padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - title.toText16().expanded, - 6.width, - SimpleButton(LocaleKeys.add.tr(), () async { - ImageOptions.showImageOptions(context, (String image, File file) { - setState(() { - images.add(image); - }); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + title.toText16().expanded, + 6.width, + SimpleButton(LocaleKeys.add.tr(), () async { + ImageOptions.showImageOptions(context, (String image, File file) { + setState(() { + images.add(image); }); - }, fontSize: 14), - ], - ), - if (images.isNotEmpty) 12.height, - if (images.isNotEmpty) - ListView.separated( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - itemBuilder: (cxt, index) { - return Container( - margin: const EdgeInsets.all(10), - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Icon(Icons.attach_file_sharp), - const SizedBox( - width: 8, - ), - 'image ${index + 1}.png'.toText16(), - ], + }); + }, fontSize: 14), + ], + ), + if (images.isNotEmpty) 12.height, + if (images.isNotEmpty) + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) { + return Container( + margin: const EdgeInsets.all(10), + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon(Icons.attach_file_sharp), + const SizedBox( + width: 8, + ), + 'image ${index + 1}.png'.toText16(), + ], + ), + InkWell( + onTap: () { + setState(() { + images.remove(images[index]); + }); + }, + child: Icon( + Icons.delete_sharp, + color: Colors.red[300], ), - InkWell( - onTap: () { - setState(() { - images.remove(images[index]); - }); - }, - child: Icon( - Icons.delete_sharp, - color: Colors.red[300], - )) - ], - ), - ); - }, - separatorBuilder: (cxt, index) => 6.height, - itemCount: images.length), - ], - ), - ); + ) + ], + ), + ); + }, + separatorBuilder: (cxt, index) => 6.height, + itemCount: images.length), + ], + ).objectContainerView(); } - void getAdDetails() async { + Future getAdDetails() async { + // todo need to change this method later , its not a good approach to do it like this. String details = await Utils.getStringFromPrefs(SharedPrefsConsts.editItemForSale); var body = json.decode(details); @@ -274,17 +266,15 @@ class _AddItemDetailsFragmentState extends State { AddItemDetailsFragment.itemReviewModel = itemReviewModel; SelectCategoryFragment.selectedSaleCategory = selectedSaleCategoryAd; - - setState(() {}); } void getRegions() async { try { Utils.showLoading(context); getRegionsList = await ItemsForSaleApiClient().getRegions(); + await getAdDetails(); Utils.hideLoading(context); setState(() {}); - getAdDetails(); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart index 93ea8e9..89bf7ce 100644 --- a/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart +++ b/lib/ui/screens/items_for_sale/fragments/items_for_sale.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:mohem_flutter_app/api/items_for_sale/items_for_sale_api_client.dart'; @@ -9,9 +10,9 @@ 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/items_for_sale/get_items_for_sale_list.dart'; import 'package:mohem_flutter_app/models/items_for_sale/get_sale_categories_list.dart'; -import 'package:mohem_flutter_app/ui/screens/items_for_sale/items_for_sale_home.dart'; import 'package:mohem_flutter_app/widgets/dynamic_forms/dynamic_textfield_widget.dart'; class ItemsForSaleFragment extends StatefulWidget { @@ -35,7 +36,7 @@ class _ItemsForSaleFragmentState extends State { gridScrollController.addListener(() { if (gridScrollController.position.atEdge) { bool isTop = gridScrollController.position.pixels == 0; - if (!isTop) { + if (!isTop && getItemsForSaleList.length == currentPageNo * 10) { print('At the bottom'); currentPageNo++; getItemsForSale(currentPageNo, currentCategoryID); @@ -47,103 +48,87 @@ class _ItemsForSaleFragmentState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( + return ListView( controller: gridScrollController, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - DynamicTextFieldWidget( - "Search", - "Search Items", - isEnable: true, - suffixIconData: Icons.search, - isPopup: false, - lines: 1, - isInputTypeNum: false, - isReadOnly: false, - onChange: (String value) { - // _runFilter(value); - }, - ).paddingOnly(left: 21, right: 21, top: 21, bottom: 18), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - "Browse Categories".toText17(), - IconButton( - icon: const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0), - onPressed: () => Navigator.pop(context), - ), - ], - ).paddingOnly(left: 21, right: 21), - SizedBox( - height: 105.0, - child: getSaleCategoriesList.isNotEmpty - ? ListView.separated( - shrinkWrap: true, - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), - scrollDirection: Axis.horizontal, - itemBuilder: (cxt, index) { - return AspectRatio( - aspectRatio: 1 / 1, - child: InkWell( - onTap: () { - setState(() { - currentCategoryID = getSaleCategoriesList[index].categoryID!; - getItemsForSaleList.clear(); - currentPageNo = 1; - getItemsForSale(currentPageNo, currentCategoryID); - }); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( + children: [ + DynamicTextFieldWidget( + LocaleKeys.search.tr(), + LocaleKeys.searchItems.tr(), + isEnable: true, + suffixIconData: Icons.search, + isPopup: false, + lines: 1, + isInputTypeNum: false, + isReadOnly: false, + onChange: (String value) { + // _runFilter(value); + }, + ).paddingOnly(left: 21, right: 21, top: 21), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + LocaleKeys.browseCategories.tr().toText17(), + // todo @haroon define the purpose of this icon button + IconButton( + icon: const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0), + onPressed: () => Navigator.pop(context), + ), + ], + ).paddingOnly(left: 21, right: 21), + SizedBox( + height: 105.0, + child: getSaleCategoriesList.isNotEmpty + ? ListView.separated( + shrinkWrap: true, + physics: const BouncingScrollPhysics(), + padding: const EdgeInsets.only(left: 21, right: 21, top: 13, bottom: 13), + scrollDirection: Axis.horizontal, + itemBuilder: (cxt, index) { + return AspectRatio( + aspectRatio: 1 / 1, + child: InkWell( + onTap: () { + setState(() { + currentCategoryID = getSaleCategoriesList[index].categoryID!; + getItemsForSaleList.clear(); + currentPageNo = 1; + getItemsForSale(currentPageNo, currentCategoryID); + }); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SvgPicture.string(getSaleCategoriesList[index].content!, fit: BoxFit.contain), - currentCategoryID == getSaleCategoriesList[index].categoryID ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(), - ], - ).expanded, - getSaleCategoriesList[index].title!.toText10() + SvgPicture.string(getSaleCategoriesList[index].content!, fit: BoxFit.contain), + currentCategoryID == getSaleCategoriesList[index].categoryID ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(), ], - ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), - ), - ), - ); - }, - separatorBuilder: (cxt, index) => 12.width, - itemCount: getSaleCategoriesList.length) - : Container(), - ), - getItemsForSaleList.isNotEmpty - ? GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 162 / 266, crossAxisSpacing: 12, mainAxisSpacing: 12), - padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 21), - shrinkWrap: true, - primary: false, - physics: const ScrollPhysics(), - children: getItemsForSaleWidgets(), - ) - : Utils.getNoDataWidget(context).paddingOnly(top: 50), - // 32.height, - ], - ), + ).expanded, + getSaleCategoriesList[index].title!.toText10() + ], + ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12).expanded.objectContainerView(disablePadding: true), + ), + ); + }, + separatorBuilder: (cxt, index) => 12.width, + itemCount: getSaleCategoriesList.length) + : Container(), + ), + getItemsForSaleList.isNotEmpty + ? GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 162 / 266, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 12), + shrinkWrap: true, + primary: false, + physics: const ScrollPhysics(), + children: getItemsForSaleWidgets(), + ) + : Utils.getNoDataWidget(context).paddingOnly(top: 50), + // 32.height, + ], ); } @@ -162,49 +147,36 @@ class _ItemsForSaleFragmentState extends State { onTap: () { Navigator.pushNamed(context, AppRoutes.itemsForSaleDetail, arguments: getItemsForSaleList); }, - child: Container( - padding: const EdgeInsets.all(10.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Hero( - tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(), - transitionOnUserGestures: true, - child: AspectRatio( - aspectRatio: 148 / 127, - child: ClipRRect( - borderRadius: BorderRadius.circular(6), - child: Image.memory( - base64Decode(getItemsForSaleList.itemAttachments![0].content!), - fit: BoxFit.cover, - ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + children: [ + Hero( + tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(), + transitionOnUserGestures: true, + child: AspectRatio( + aspectRatio: 148 / 127, + child: ClipRRect( + borderRadius: BorderRadius.circular(6), + child: Image.memory( + base64Decode(getItemsForSaleList.itemAttachments![0].content!), + fit: BoxFit.cover, ), ), ), - 10.height, - getItemsForSaleList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1), - getItemsForSaleList.description!.toText12(maxLine: 2, color: const Color(0xff535353)), - 16.height, - getItemsForSaleList.status!.toText14(isBold: true, color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: ["${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText14(isBold: true), SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)], - ), - ], - ), - ), + ), + 10.height, + getItemsForSaleList.title!.toText16(maxlines: 1), + getItemsForSaleList.description!.toText12(maxLine: 3, color: MyColors.grey57Color).expanded, + // 8.height, + getItemsForSaleList.status!.toText14(color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: ["${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText16(isBold: true), SvgPicture.asset("assets/images/arrow_next.svg").paddingOnly(bottom: 4)], + ), + 6.height + ], + ).paddingAll(8).expanded.objectContainerView(disablePadding: true), ); } diff --git a/lib/ui/screens/items_for_sale/fragments/select_category_fragment.dart b/lib/ui/screens/items_for_sale/fragments/select_category_fragment.dart index 6255302..04d6b2d 100644 --- a/lib/ui/screens/items_for_sale/fragments/select_category_fragment.dart +++ b/lib/ui/screens/items_for_sale/fragments/select_category_fragment.dart @@ -1,7 +1,9 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.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/items_for_sale/get_sale_categories_list.dart'; class SelectCategoryFragment extends StatelessWidget { @@ -18,11 +20,11 @@ class SelectCategoryFragment extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - "What are you offering".toText20(isBold: true).paddingOnly(top: 24, left: 21, right: 21), + LocaleKeys.whatAreYouOffering.tr().toText20().paddingOnly(top: 0, left: 21, right: 21), getSaleCategoriesList.isNotEmpty ? GridView( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 105 / 105, crossAxisSpacing: 12, mainAxisSpacing: 12), - padding: const EdgeInsets.only(top: 15, bottom: 15, left: 21, right: 21), + padding: const EdgeInsets.only(top: 15, bottom: 21, left: 21, right: 21), shrinkWrap: true, primary: false, physics: const ScrollPhysics(), @@ -37,41 +39,32 @@ class SelectCategoryFragment extends StatelessWidget { List getItemsForSaleWidgets() { List itemsList = []; - getSaleCategoriesList.forEach((element) { - itemsList.add(InkWell( - onTap: () { - selectedSaleCategory = element; - changePageViewIndex(1); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], + getSaleCategoriesList.forEach( + (element) { + itemsList.add( + InkWell( + onTap: () { + selectedSaleCategory = element; + changePageViewIndex(1); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SvgPicture.string(element.content!, fit: BoxFit.contain, width: 32, height: 32), + ], + ).expanded, + element.title!.toText12() + ], + ).paddingOnly(left: 10, right: 10, bottom: 10, top: 16).expanded.objectContainerView(disablePadding: true), ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SvgPicture.string(element.content!, fit: BoxFit.contain, width: 32, height: 32), - ], - ).expanded, - element.title!.toText12() - ], - ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), - ), - )); - }); + ); + }, + ); return itemsList; } diff --git a/lib/ui/screens/items_for_sale/item_for_sale_detail.dart b/lib/ui/screens/items_for_sale/item_for_sale_detail.dart index c85f4e0..ee76943 100644 --- a/lib/ui/screens/items_for_sale/item_for_sale_detail.dart +++ b/lib/ui/screens/items_for_sale/item_for_sale_detail.dart @@ -1,14 +1,18 @@ import 'dart:convert'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/date_uitl.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/items_for_sale/get_items_for_sale_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; +import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart'; import 'package:url_launcher/url_launcher.dart'; class ItemForSaleDetailPage extends StatefulWidget { @@ -24,116 +28,86 @@ class _ItemForSaleDetailPageState extends State { @override Widget build(BuildContext context) { getItemsForSaleList = ModalRoute.of(context)?.settings.arguments as GetItemsForSaleList; + return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget(context, - // title: LocaleKeys.mowadhafhiRequest.tr(), - title: "Items for sale", - showHomeButton: true,), - body: SingleChildScrollView( - child: Column( - children: [ - AspectRatio( - aspectRatio: 336 / 554, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), + appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true), + body: Column( + children: [ + ListView( + padding: const EdgeInsets.all(21), + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Hero( + tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(), + transitionOnUserGestures: true, + child: AspectRatio( + aspectRatio: 322 / 261, + child: ClipRRect( + borderRadius: BorderRadius.circular(6), + child: Image.memory( + base64Decode(getItemsForSaleList.itemAttachments![0].content!), + fit: BoxFit.cover, + ), + ), ), - ], - ), - // color: Colors.red, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: const Color(0xffEBEBEB).withOpacity(1.0), - blurRadius: 26, - offset: const Offset(0, -3), + ).paddingAll(8), + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + getItemsForSaleList.title!.toText20(), + getItemsForSaleList.description!.toText12(maxLine: 5, color: MyColors.grey57Color), + 21.height, + getItemsForSaleList.status!.toText16(color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor), + "${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText20(isBold: true), + 1.divider.paddingOnly(top: 16, bottom: 16), + Row( + children: [ + CircularAvatar( + url: getItemsForSaleList.profilePicture, + height: 34, + width: 34, ), + 7.width, + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [getItemsForSaleList.fullName!.toText14(), ItemDetailView("Posted on", DateUtil.formatDateToDate(DateTime.parse(getItemsForSaleList.created!), false))], + ).expanded, ], ), - child: Hero( - tag: "ItemImage" + getItemsForSaleList.itemSaleID.toString(), - transitionOnUserGestures: true, - child: AspectRatio( - aspectRatio: 148 / 127, - child: ClipRRect( - borderRadius: BorderRadius.circular(6), - child: Image.memory( - base64Decode(getItemsForSaleList.itemAttachments![0].content!), - fit: BoxFit.cover, - ), - ), - ).paddingAll(8), - ), - ), - getItemsForSaleList.title!.toText20(isBold: true, color: const Color(0xff2B353E)).paddingOnly(left: 21, right: 21), - getItemsForSaleList.description!.toText12(maxLine: 5, color: const Color(0xff535353)).paddingOnly(left: 21, right: 21, bottom: 21), - getItemsForSaleList.status!.toText16(isBold: true, color: getItemsForSaleList.status == 'Approved' ? MyColors.greenColor : MyColors.yellowColor).paddingOnly(left: 21, right: 21), - "${getItemsForSaleList.quotePrice} ${getItemsForSaleList.currencyCode!}".toText20(isBold: true).paddingOnly(left: 21, right: 21, bottom: 15), - const Divider().paddingOnly(left: 21, right: 21), - Row( - children: [ - CircularAvatar( - height: 40, - width: 40, - ).paddingOnly(left: 21, top: 21), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - getItemsForSaleList.fullName!.toText14(isBold: true).paddingOnly(left: 7, right: 7), - "Posted on: ${DateUtil.formatDateToDate(DateTime.parse(getItemsForSaleList.created!), false)}".toText12().paddingOnly(left: 7, right: 7), - ], - ).paddingOnly(top: 18), - ], - ), - ], - ), - ).paddingAll(21), - ), - Container( - decoration: const BoxDecoration( - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 1), - ], - ), - child: Row( - children: [ - DefaultButton("Email", () async { - Uri emailLaunchUri = Uri( - scheme: 'mailto', - path: getItemsForSaleList.emailAddress, - ); - launchUrl(emailLaunchUri); - }, iconData: Icons.email_sharp, isTextExpanded: false) - .insideContainer - .expanded, - DefaultButton("Call", () async { - Uri callLaunchUri = Uri( - scheme: 'tel', - path: getItemsForSaleList.mobileNumber, - ); - launchUrl(callLaunchUri); - }, iconData: Icons.call_sharp, isTextExpanded: false) - .insideContainer - .expanded, + ], + ).paddingOnly(right: 16, left: 16, top: 6, bottom: 16) ], - ), - ), - ], - ), + ).objectContainerView(disablePadding: true), + ], + ).expanded, + Row( + children: [ + DefaultButton("Email", () async { + Uri emailLaunchUri = Uri( + scheme: 'mailto', + path: getItemsForSaleList.emailAddress, + ); + launchUrl(emailLaunchUri); + }, iconData: Icons.email_sharp, isTextExpanded: false) + .expanded, + 8.width, + DefaultButton("Call", () async { + Uri callLaunchUri = Uri( + scheme: 'tel', + path: getItemsForSaleList.mobileNumber, + ); + launchUrl(callLaunchUri); + }, iconData: Icons.call_sharp, isTextExpanded: false) + .expanded, + ], + ).insideContainer, + ], ), ); } diff --git a/lib/ui/screens/items_for_sale/items_for_sale_home.dart b/lib/ui/screens/items_for_sale/items_for_sale_home.dart index 360c0ae..437b400 100644 --- a/lib/ui/screens/items_for_sale/items_for_sale_home.dart +++ b/lib/ui/screens/items_for_sale/items_for_sale_home.dart @@ -1,10 +1,11 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.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/models/items_for_sale/get_sale_categories_list.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/items_for_sale.dart'; import 'package:mohem_flutter_app/ui/screens/items_for_sale/fragments/my_posted_ads_fragment.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; @@ -24,10 +25,7 @@ class _ItemsForSaleState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget(context, - // title: LocaleKeys.mowadhafhiRequest.tr(), - title: "Items for sale", - showHomeButton: true), + appBar: AppBarWidget(context, title: LocaleKeys.itemsForSale.tr(), showHomeButton: true), body: Column( children: [ Container( @@ -48,7 +46,7 @@ class _ItemsForSaleState extends State { ), ), child: Row( - children: [myTab("Items for sale", 0), myTab("My posted ads", 1)], + children: [myTab(LocaleKeys.itemsForSale.tr(), 0), myTab(LocaleKeys.myPostedAds.tr(), 1)], ), ), PageView( @@ -59,10 +57,7 @@ class _ItemsForSaleState extends State { tabIndex = pageIndex; }); }, - children: [ - ItemsForSaleFragment(), - MyPostedAdsFragment() - ], + children: [ItemsForSaleFragment(), MyPostedAdsFragment()], ).expanded, ], ), @@ -77,9 +72,11 @@ class _ItemsForSaleState extends State { ]), ), child: const Icon(Icons.add, color: Colors.white, size: 30), - ).onPress(() { - Navigator.pushNamed(context, AppRoutes.addNewItemForSale); - }) + ).onPress( + () { + Navigator.pushNamed(context, AppRoutes.addNewItemForSale); + }, + ), ); } diff --git a/lib/ui/screens/my_requests/my_requests.dart b/lib/ui/screens/my_requests/my_requests.dart index ebeff43..65aa534 100644 --- a/lib/ui/screens/my_requests/my_requests.dart +++ b/lib/ui/screens/my_requests/my_requests.dart @@ -49,45 +49,36 @@ class _MyRequestsState extends State { context, title: "Concurrent Reports", ), - body: Container( - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], - ), - child: Column( - children: [ - 12.height, - Container( - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0), - margin: const EdgeInsets.only(left: 12, right: 12, top: 0, bottom: 0), - child: PopupMenuButton( - child: DynamicTextFieldWidget( - "Template Name", - selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? "", - isEnable: false, - isPopup: true, - isInputTypeNum: true, - isReadOnly: false, - ).paddingOnly(bottom: 12), - itemBuilder: (_) => >[ - for (int i = 0; i < getConcurrentProgramsList!.length; i++) PopupMenuItem(child: Text(getConcurrentProgramsList![i].uSERCONCURRENTPROGRAMNAME!), value: i), - ], - onSelected: (int popupIndex) { - selectedConcurrentProgramList = getConcurrentProgramsList![popupIndex]; - getCCPTransactions(selectedConcurrentProgramList?.cONCURRENTPROGRAMNAME); - setState(() {}); - }), - ), - 12.height, - Expanded( + body: Column( + children: [ + ListView( + physics: const BouncingScrollPhysics(), + children: [ + Container( + padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0), + margin: const EdgeInsets.only(left: 12, right: 12, top: 0, bottom: 0), + child: PopupMenuButton( + child: DynamicTextFieldWidget( + LocaleKeys.templateName.tr(), + selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? LocaleKeys.selectTemplate.tr(), + isEnable: false, + isPopup: true, + isInputTypeNum: true, + isReadOnly: false, + ).paddingOnly(bottom: 12), + itemBuilder: (_) => >[ + for (int i = 0; i < getConcurrentProgramsList!.length; i++) PopupMenuItem(child: Text(getConcurrentProgramsList![i].uSERCONCURRENTPROGRAMNAME!), value: i), + ], + onSelected: (int popupIndex) { + selectedConcurrentProgramList = getConcurrentProgramsList![popupIndex]; + getCCPTransactions(selectedConcurrentProgramList?.cONCURRENTPROGRAMNAME); + setState(() {}); + }), + ), + 12.height, + Expanded( + // todo list don't have data, need to confirm later , because have issues, need fixes + child: ListView.separated( physics: const BouncingScrollPhysics(), shrinkWrap: true, @@ -149,21 +140,15 @@ class _MyRequestsState extends State { ); }, separatorBuilder: (BuildContext context, int index) => 12.height, - itemCount: getCCPTransactionsList.length ?? 0)), - 80.height, - Container( - decoration: const BoxDecoration( - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), - ], + itemCount: getCCPTransactionsList.length), ), - child: DefaultButton(LocaleKeys.createRequest.tr(), () async { - openNewRequest(); - }).insideContainer, - ) - ], - ), + ], + ).expanded, + 1.divider, + DefaultButton(LocaleKeys.createRequest.tr(), () async { + openNewRequest(); + }).insideContainer, + ], ), ); } diff --git a/lib/ui/screens/my_requests/new_request.dart b/lib/ui/screens/my_requests/new_request.dart index 4cc2b20..b476ecc 100644 --- a/lib/ui/screens/my_requests/new_request.dart +++ b/lib/ui/screens/my_requests/new_request.dart @@ -4,7 +4,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/my_requests_api_client.dart'; -import 'package:mohem_flutter_app/classes/colors.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; @@ -27,7 +26,7 @@ class _NewRequestState extends State { List getConcurrentProgramsList = []; GetConcurrentProgramsModel? selectedConcurrentProgramList; - List getCCPDFFStructureModelList = []; + List? getCCPDFFStructureModelList; DateTime selectedDate = DateTime.now(); @@ -45,17 +44,16 @@ class _NewRequestState extends State { context, title: "Concurrent Reports", ), - body: Container( - child: Column( - children: [ - 12.height, - Container( - padding: const EdgeInsets.only(left: 12, right: 12, top: 10, bottom: 0), - margin: const EdgeInsets.only(left: 12, right: 12, top: 0, bottom: 0), - child: PopupMenuButton( + body: Column( + children: [ + ListView( + padding: const EdgeInsets.all(21), + physics: const BouncingScrollPhysics(), + children: [ + PopupMenuButton( child: DynamicTextFieldWidget( - "Template Name", - selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? "", + LocaleKeys.templateName.tr(), + selectedConcurrentProgramList?.uSERCONCURRENTPROGRAMNAME ?? LocaleKeys.selectTemplate.tr(), isEnable: false, isPopup: true, isInputTypeNum: true, @@ -69,32 +67,28 @@ class _NewRequestState extends State { getCCPDFFStructure(selectedConcurrentProgramList?.cONCURRENTPROGRAMNAME); setState(() {}); }), - ), - (getCCPDFFStructureModelList.isEmpty - ? LocaleKeys.noDataAvailable.tr().toText16().center - : ListView.separated( - physics: const BouncingScrollPhysics(), - padding: const EdgeInsets.all(21), - itemBuilder: (cxt, int parentIndex) => parseDynamicFormatType(getCCPDFFStructureModelList[parentIndex], parentIndex), - separatorBuilder: (cxt, index) => 0.height, - itemCount: getCCPDFFStructureModelList.length)) - .expanded, - Container( - decoration: const BoxDecoration( - color: MyColors.white, - boxShadow: [ - BoxShadow(color: MyColors.lightGreyEFColor, spreadRadius: 3), - ], - ), - child: DefaultButton(LocaleKeys.submit.tr(), () async { - // openNewRequest(); - }) - .insideContainer, - ) - ], - ), + getCCPDFFStructureModelList == null + ? const SizedBox() + : (getCCPDFFStructureModelList!.isEmpty + ? LocaleKeys.noDataAvailable.tr().toText16().center + : ListView.separated( + physics: const NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: const EdgeInsets.all(0), + itemBuilder: (cxt, int parentIndex) => parseDynamicFormatType(getCCPDFFStructureModelList![parentIndex], parentIndex), + separatorBuilder: (cxt, index) => 0.height, + itemCount: getCCPDFFStructureModelList!.length, + )), + ], + ).expanded, + 1.divider, + DefaultButton(LocaleKeys.submit.tr(), () { + // todo need to add submit method + // openNewRequest(); + }) + .insideContainer, + ], ), - // bottomSheet: ); } @@ -132,9 +126,7 @@ class _NewRequestState extends State { isReadOnly: model.rEADONLY == "Y", onChange: (text) { model.fieldAnswer = text; - if (model.eSERVICESDV == null) { - model.eSERVICESDV = ESERVICESDV(); - } + model.eSERVICESDV ??= ESERVICESDV(); model.eSERVICESDV!.pIDCOLUMNNAME = text; }, ).paddingOnly(bottom: 12); @@ -146,9 +138,7 @@ class _NewRequestState extends State { isInputTypeNum: true, onChange: (text) { model.fieldAnswer = text; - if (model.eSERVICESDV == null) { - model.eSERVICESDV = ESERVICESDV(); - } + model.eSERVICESDV ??= ESERVICESDV(); model.eSERVICESDV!.pIDCOLUMNNAME = text; }, ).paddingOnly(bottom: 12); @@ -164,7 +154,7 @@ class _NewRequestState extends State { } return DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - displayText, + displayText.isEmpty ? LocaleKeys.pleaseSelectDate.tr() : displayText, suffixIconData: Icons.calendar_today, isEnable: false, onTap: () async { @@ -331,7 +321,7 @@ class _NewRequestState extends State { } return DynamicTextFieldWidget( (model.sEGMENTPROMPT ?? "") + (model.rEQUIREDFLAG == "Y" ? "*" : ""), - displayText, + displayText.isEmpty ? LocaleKeys.pleaseSelectDate.tr() : displayText, suffixIconData: Icons.calendar_today, isEnable: false, onTap: () async { diff --git a/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart b/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart index e1e216d..9a308ba 100644 --- a/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart +++ b/lib/ui/screens/offers_and_discounts/offers_and_discounts_details.dart @@ -50,86 +50,69 @@ class _OffersAndDiscountsDetailsState extends State { title: "Offers & Discounts", showHomeButton: true, ), - body: SingleChildScrollView( + body: ListView( controller: _scrollController, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(10), - boxShadow: [ - BoxShadow( - color: const Color(0xff000000).withOpacity(.05), - blurRadius: 26, - offset: const Offset(0, -3), - ), - ], + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Hero( + tag: "ItemImage" + getOffersList[0].rowID!, + // transitionOnUserGestures: true, + child: RepaintBoundary( + key: _globalKey, + child: ClipRRect( + borderRadius: BorderRadius.circular(6), + child: Image.network( + getOffersList[0].bannerImage!, + fit: BoxFit.contain, + ), + ).paddingAll(12), + ), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + 8.height, + AppState().isArabic(context) + ? getOffersList[0].titleAR!.toText22(isBold: true, color: const Color(0xff2B353E)).center + : getOffersList[0].title!.toText22(isBold: true, color: const Color(0xff2B353E)).center, + Html( + data: AppState().isArabic(context) ? getOffersList[0].descriptionAR! : getOffersList[0].description ?? "", + onLinkTap: (String? url, RenderContext context, Map attributes, _) { + launchUrl(Uri.parse(url!)); + }, + ), + checkDate(getOffersList[0].endDate!).paddingOnly(left: 8), + 10.height, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Hero( - tag: "ItemImage" + getOffersList[0].rowID!, - // transitionOnUserGestures: true, - child: RepaintBoundary( - key: _globalKey, - child: ClipRRect( - borderRadius: BorderRadius.circular(6), - child: Image.network( - getOffersList[0].bannerImage!, - fit: BoxFit.contain, - ), - ).paddingAll(12), - ), - ), - 8.height, - AppState().isArabic(context) - ? getOffersList[0].titleAR!.toText22(isBold: true, color: const Color(0xff2B353E)).center - : getOffersList[0].title!.toText22(isBold: true, color: const Color(0xff2B353E)).center, - Html( - data: AppState().isArabic(context) ? getOffersList[0].descriptionAR! : getOffersList[0].description ?? "", - onLinkTap: (String? url, RenderContext context, Map attributes, _) { - launchUrl(Uri.parse(url!)); - }, - ), - checkDate(getOffersList[0].endDate!).paddingOnly(left: 8), - 10.height, - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - getOffersList[0].discount!.toText16(isBold: true), - InkWell( - onTap: () { - _shareOfferAsImage(); - }, - child: const Icon(Icons.share, color: MyColors.darkIconColor).paddingOnly(bottom: 4)) - ], - ).paddingOnly(left: 8, right: 8), - getOffersList[0].isHasLocation == "true" - ? InkWell( - onTap: () {}, - child: Row( - children: [const Icon(Icons.map_sharp, color: MyColors.darkIconColor).paddingOnly(bottom: 4), "Offer Location".toText16(isUnderLine: true).paddingOnly(left: 8)], - ).paddingOnly(left: 8, right: 8, top: 8), - ) - : 12.height, + getOffersList[0].discount!.toText16(isBold: true), + InkWell( + onTap: () { + _shareOfferAsImage(); + }, + child: const Icon(Icons.share, color: MyColors.darkIconColor).paddingOnly(bottom: 4)) ], - ), - ).paddingOnly(left: 21, right: 21, top: 21), - "Related Offers".toText22(isBold: true, color: const Color(0xff2B353E)).paddingAll(21.0), - GridView( - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 162 / 266, crossAxisSpacing: 12, mainAxisSpacing: 12), - padding: const EdgeInsets.only(left: 21, right: 21, bottom: 21, top: 21), - shrinkWrap: true, - primary: false, - physics: const ScrollPhysics(), - children: getItemsForSaleWidgets(), - ), - 50.height, - ], - ), + ).paddingOnly(left: 8, right: 8), + getOffersList[0].isHasLocation == "true" + ? InkWell( + onTap: () {}, + child: Row( + children: [const Icon(Icons.map_sharp, color: MyColors.darkIconColor).paddingOnly(bottom: 4), "Offer Location".toText16(isUnderLine: true).paddingOnly(left: 8)], + ).paddingOnly(left: 8, right: 8, top: 8), + ) + : 12.height, + ], + ).objectContainerView().paddingOnly(left: 21, right: 21, top: 21), + "Related Offers".toText22(isBold: true, color: const Color(0xff2B353E)).paddingOnly(left: 21, right: 21, top: 21), + GridView( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 162 / 266, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: const EdgeInsets.all(21), + shrinkWrap: true, + primary: false, + physics: const ScrollPhysics(), + children: getItemsForSaleWidgets(), + ), + ], ), ); } diff --git a/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart b/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart index bdf6ed5..fed4583 100644 --- a/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart +++ b/lib/ui/screens/offers_and_discounts/offers_and_discounts_home.dart @@ -9,6 +9,7 @@ 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_categories_list.dart'; import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; @@ -37,20 +38,15 @@ class _OffersAndDiscountsHomeState extends State { Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - appBar: AppBarWidget( - context, - // title: LocaleKeys.mowadhafhiRequest.tr(), - title: "Offers & Discounts", - showHomeButton: true, - ), + appBar: AppBarWidget(context, title: LocaleKeys.offerAndDiscounts.tr(), showHomeButton: true), body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ DynamicTextFieldWidget( - "Search", - "Search Items", + LocaleKeys.search.tr(), + LocaleKeys.searchItems.tr(), isEnable: true, suffixIconData: Icons.search, isPopup: false, @@ -60,17 +56,16 @@ class _OffersAndDiscountsHomeState extends State { onChange: (String value) { // _runFilter(value); }, - ).paddingOnly(left: 21, right: 21, top: 21, bottom: 18), + ).paddingOnly(left: 21, right: 21, top: 21), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Browse Categories".toText17(), - IconButton( - icon: const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0), - onPressed: () => Navigator.pop(context), - ), + LocaleKeys.browseCategories.tr().toText17(), + const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0).onPress(() { + Navigator.pop(context); + }), ], - ).paddingOnly(left: 21, right: 21), + ).paddingOnly(left: 21, right: 21, top: 21), SizedBox( height: 110.0, child: getCategoriesList.isNotEmpty @@ -120,7 +115,7 @@ class _OffersAndDiscountsHomeState extends State { currentCategoryID == getCategoriesList[index].id ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(), ], ).expanded, - AppState().isArabic(context) ? getCategoriesList[index].categoryNameAr!.toText10(maxLine: 1) : getCategoriesList[index].categoryNameEn!.toText10(maxLine: 1) + AppState().isArabic(context) ? getCategoriesList[index].categoryNameAr!.toText10(maxlines: 1) : getCategoriesList[index].categoryNameEn!.toText10(maxlines: 1) ], ).paddingOnly(left: 10, right: 10, bottom: 10, top: 12), ), @@ -195,7 +190,9 @@ class _OffersAndDiscountsHomeState extends State { ), ), 10.height, - AppState().isArabic(context) ? getOffersList.titleAR!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1) : getOffersList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1), + AppState().isArabic(context) + ? getOffersList.titleAR!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1) + : getOffersList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1), // Html( // data: AppState().isArabic(context) ? getOffersList.descriptionAR! : getOffersList.description ?? "", // // onLinkTap: (String? url, RenderContext context, Map attributes, _) { @@ -224,8 +221,8 @@ class _OffersAndDiscountsHomeState extends State { getOffersDetailList.add(offersListModelObj); getOffersList.forEach((element) { - if(counter <= 4) { - if(element.rowID != offersListModelObj.rowID) { + if (counter <= 4) { + if (element.rowID != offersListModelObj.rowID) { getOffersDetailList.add(element); counter++; } @@ -238,9 +235,9 @@ class _OffersAndDiscountsHomeState extends State { Widget checkDate(String endDate) { DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate); if (endDateObj.isAfter(DateTime.now())) { - return "Offer Valid".toText14(isBold: true, color: MyColors.greenColor); + return LocaleKeys.offerValid.tr().toText14(isBold: true, color: MyColors.greenColor); } else { - return "Offer Expired".toText14(isBold: true, color: MyColors.redColor); + return LocaleKeys.offerExpired.tr().toText14(isBold: true, color: MyColors.redColor); } } diff --git a/lib/widgets/radio/show_radio.dart b/lib/widgets/radio/show_radio.dart index 6138fa3..9a5a4b8 100644 --- a/lib/widgets/radio/show_radio.dart +++ b/lib/widgets/radio/show_radio.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/classes/colors.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/int_extensions.dart'; class ShowRadio extends StatelessWidget { String title, value, groupValue; @@ -39,7 +38,7 @@ class ShowRadio extends StatelessWidget { ), ), 12.width, - title.toText12(isBold: true, maxLine: 2) + title.toText12(maxLine: 2) ], ); }