From bdaccf133c2273324b5f5c398ebc2712658e9dfd Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 15 Mar 2026 16:04:06 +0300 Subject: [PATCH 1/6] updates --- assets/images/eid_banner.svg | 606 +++++++++++++++++++++ lib/provider/dashboard_provider_model.dart | 2 +- lib/ui/landing/dashboard_screen.dart | 6 +- 3 files changed, 610 insertions(+), 4 deletions(-) create mode 100644 assets/images/eid_banner.svg diff --git a/assets/images/eid_banner.svg b/assets/images/eid_banner.svg new file mode 100644 index 0000000..f8e4adb --- /dev/null +++ b/assets/images/eid_banner.svg @@ -0,0 +1,606 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/provider/dashboard_provider_model.dart b/lib/provider/dashboard_provider_model.dart index e9c6678..2b7a2bb 100644 --- a/lib/provider/dashboard_provider_model.dart +++ b/lib/provider/dashboard_provider_model.dart @@ -137,7 +137,7 @@ class DashboardProviderModel with ChangeNotifier, DiagnosticableTreeMixin { DrawerMenuItem("assets/images/drawer/mowadhafi.svg", LocaleKeys.keen.tr(), AppRoutes.etqanOvr), // DrawerMenuItem("assets/images/drawer/car_parking_icon.svg", LocaleKeys.parkingQr.tr(), AppRoutes.parkingQr), DrawerMenuItem("assets/images/drawer/pending_trasactions.svg", LocaleKeys.pendingTransactions.tr(), AppRoutes.pendingTransactions), - DrawerMenuItem("assets/images/drawer/courses.svg", "courses".tr(), AppRoutes.courses), + // DrawerMenuItem("assets/images/drawer/courses.svg", "courses".tr(), AppRoutes.courses), // DrawerMenuItem("assets/images/drawer/drawer_marathon.svg", LocaleKeys.brainMarathon.tr(), AppRoutes.marathonIntroScreen), DrawerMenuItem("assets/images/drawer/change_password.svg", LocaleKeys.changePassword.tr(), AppRoutes.changePassword), ]; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 0ff22ae..eac7890 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -450,8 +450,8 @@ class _DashboardScreenState extends State with WidgetsBindingOb flipX: !AppState().isArabic(context), child: SvgPicture.network( AppState().isArabic(context) - ? (card.backgroundImageUrlAr ?? "http://meena-health-care-1.s3.eu-north-1.amazonaws.com/eid_banner.svg") - : (card.backgroundImageUrlEn ?? "http://meena-health-care-1.s3.eu-north-1.amazonaws.com/eid_banner.svg"), + ? (card.backgroundImageUrlAr ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg") + : (card.backgroundImageUrlEn ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg"), fit: BoxFit.contain, placeholderBuilder: (context) => ClipRRect(borderRadius: BorderRadius.circular(18), child: Container(height: 80, color: Colors.white).toShimmer()), ), @@ -460,7 +460,7 @@ class _DashboardScreenState extends State with WidgetsBindingOb mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(width: AppState().isArabic(context) ? 10 : 40), + SizedBox(width: AppState().isArabic(context) ? 20 : 50), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, From 057e71e3c0fc811118fdd67cd4fdfec387bb3c85 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 16 Mar 2026 01:47:39 +0300 Subject: [PATCH 2/6] Etqan fixes, Update to Stores VersionID 9.6 --- lib/app_state/app_state.dart | 2 +- lib/classes/consts.dart | 4 ++-- lib/ui/etqan_ovr/etqan_create_request.dart | 11 ++++++++--- pubspec.yaml | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 799bcb5..703a8b0 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -90,7 +90,7 @@ class AppState { String get getHuaweiPushToken => _huaweiPushToken; - final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 9.5, mobileType: Platform.isAndroid ? "android" : "ios"); + final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 9.6, mobileType: Platform.isAndroid ? "android" : "ios"); void setPostParamsInitConfig() { isAuthenticated = false; diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index d8efe5d..88ebf73 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -4,12 +4,12 @@ class ApiConsts { // static String baseUrl = "http://10.200.204.11"; // Local server // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server - static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver // static String baseUrl = "http://10.201.204.101:2024"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://hmgwebservices.com"; // Live server - // static String baseUrl = "https://mohemm.hmg.com"; // New Live server + static String baseUrl = "https://mohemm.hmg.com"; // New Live server // // static String baseUrl = "http://10.20.200.111:1010/"; diff --git a/lib/ui/etqan_ovr/etqan_create_request.dart b/lib/ui/etqan_ovr/etqan_create_request.dart index a1d64af..ba3c504 100644 --- a/lib/ui/etqan_ovr/etqan_create_request.dart +++ b/lib/ui/etqan_ovr/etqan_create_request.dart @@ -110,15 +110,20 @@ class _EtqanOvrCreateRequestState extends State { if (ticketInfo != null) { String ticketNumber = ticketInfo['ticketNumber'] ?? ''; String ticketId = ticketInfo['id'] ?? ''; - String successMessage = '${LocaleKeys.requestCreatedSuccessfully.tr()}\n\n${LocaleKeys.ticketNumber.tr()}: $ticketNumber\n${LocaleKeys.ticketId.tr()}: $ticketId'; + // String successMessage = '${LocaleKeys.requestCreatedSuccessfully.tr()}\n\n${LocaleKeys.ticketNumber.tr()}: $ticketNumber\n${LocaleKeys.ticketId.tr()}: $ticketId'; + String successMessage = '${LocaleKeys.requestCreatedSuccessfully.tr()}\n\n${LocaleKeys.ticketNumber.tr()}: $ticketNumber'; Utils.showErrorDialog( context: context, message: successMessage, onOkTapped: () { - Navigator.popAndPushNamed(context, AppRoutes.etqanOvr); + Navigator.pop(context); + Navigator.pop(context); + // Navigator.popAndPushNamed(context, AppRoutes.etqanOvr); }, onCloseTap: () { - Navigator.popAndPushNamed(context, AppRoutes.etqanOvr); + Navigator.pop(context); + Navigator.pop(context); + // Navigator.popAndPushNamed(context, AppRoutes.etqanOvr); }, ); } diff --git a/pubspec.yaml b/pubspec.yaml index 49dec60..7e5a29a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 3.7.1+300081 +version: 3.7.2+300082 #version: 3.9.3+1 environment: From 3391cf49ef304d3e5b6e6b7e5743a58f82197634 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 16 Mar 2026 14:56:04 +0300 Subject: [PATCH 3/6] updates --- lib/ui/landing/dashboard_screen.dart | 89 ++++------------------------ 1 file changed, 13 insertions(+), 76 deletions(-) diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index eac7890..793712c 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -431,86 +431,24 @@ class _DashboardScreenState extends State with WidgetsBindingOb return const GreetingCardShimmer(); } else if (model.isDisplayEidGreetings && model.greetingCardsList != null && model.greetingCardsList!.isNotEmpty) { return SizedBox( - height: 120, + height: 140, child: ListView.separated( shrinkWrap: true, scrollDirection: Axis.horizontal, - padding: const EdgeInsets.symmetric(horizontal: 21), + padding: const EdgeInsets.symmetric(horizontal: 24), itemCount: model.greetingCardsList!.length, - separatorBuilder: (context, index) => const SizedBox(width: 12), + separatorBuilder: (context, index) => const SizedBox(width: 24), itemBuilder: (context, index) { var card = model.greetingCardsList![index]; - return SizedBox( - width: MediaQuery.of(context).size.width - 42, - child: Directionality( - textDirection: AppState().isArabic(context) ? ui.TextDirection.rtl : ui.TextDirection.ltr, - child: Stack( - children: [ - Transform.flip( - flipX: !AppState().isArabic(context), - child: SvgPicture.network( - AppState().isArabic(context) - ? (card.backgroundImageUrlAr ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg") - : (card.backgroundImageUrlEn ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg"), - fit: BoxFit.contain, - placeholderBuilder: (context) => ClipRRect(borderRadius: BorderRadius.circular(18), child: Container(height: 80, color: Colors.white).toShimmer()), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(width: AppState().isArabic(context) ? 20 : 50), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AppState().isArabic(context) ? card.titleAr ?? '' : card.titleEn ?? '', - style: TextStyle( - fontSize: AppState().isArabic(context) ? 20 : 18, - letterSpacing: -0.2, - fontFamily: AppState().isArabic(context) ? 'Cairo' : 'Poppins', - fontWeight: FontWeight.w700, - height: 24 / 16, - color: const Color(0xFF3B3E4F), - ), - ), - const SizedBox(height: 4), - Text( - AppState().isArabic(context) ? card.descriptionAr ?? '' : card.descriptionEn ?? '', - style: TextStyle( - fontSize: AppState().isArabic(context) ? 16 : 14, - letterSpacing: -0.2, - fontFamily: AppState().isArabic(context) ? 'Cairo' : 'Poppins', - fontWeight: FontWeight.w500, - color: const Color(0xFF3B3E4F), - ), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ], - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - (AppState().isArabic(context) - ? card.buttonTextN!.toText12(isUnderLine: true, color: const Color(0xFF3B3D4A)) - : card.buttonText!.toText12(isUnderLine: true, color: const Color(0xFF3B3D4A))) - .onPress(() { - launchUrl(Uri.parse(AppState().isArabic(context) ? card.urlAr! : card.urlEn!)); - }), - ], - ).paddingOnly(bottom: 10, right: 15, left: 15), - ], - ).paddingOnly(left: AppState().isArabic(context) ? 10 : 36, right: AppState().isArabic(context) ? 66 : 10, top: 6, bottom: 40), - ], - ), - ), - ); + return SvgPicture.network( + AppState().isArabic(context) + ? (card.backgroundImageUrlAr ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg") + : (card.backgroundImageUrlEn ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg"), + fit: BoxFit.fill, + placeholderBuilder: (context) => ClipRRect(borderRadius: BorderRadius.circular(18), child: Container(height: 80, color: Colors.white).toShimmer()), + ).onPress(() { + launchUrl(Uri.parse(AppState().isArabic(context) ? card.urlAr! : card.urlEn!)); + }); }, ), ).paddingOnly(bottom: 0); @@ -518,8 +456,7 @@ class _DashboardScreenState extends State with WidgetsBindingOb return const SizedBox(); } }, - ), - + ).paddingOnly(bottom: 24), // eventActivityWidget(context), if (isDisplayMazaya) ...[ Column( From 5ad012d60245501c702ec4ef2e4912c53e2a9e69 Mon Sep 17 00:00:00 2001 From: Haroon Amjad <> Date: Thu, 19 Mar 2026 17:09:37 -0400 Subject: [PATCH 4/6] Banner updates, VersionID 9.7 sent to stores --- assets/images/EID_ARABIC_3.svg | 9 +++++++++ assets/images/EID_Englsih_04.svg | 4 ++++ assets/images/asddasd.svg | 14 ++++++++++++++ lib/app_state/app_state.dart | 2 +- lib/ui/landing/dashboard_screen.dart | 4 ++-- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 assets/images/EID_ARABIC_3.svg create mode 100644 assets/images/EID_Englsih_04.svg create mode 100644 assets/images/asddasd.svg diff --git a/assets/images/EID_ARABIC_3.svg b/assets/images/EID_ARABIC_3.svg new file mode 100644 index 0000000..483a836 --- /dev/null +++ b/assets/images/EID_ARABIC_3.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/images/EID_Englsih_04.svg b/assets/images/EID_Englsih_04.svg new file mode 100644 index 0000000..c2a75b5 --- /dev/null +++ b/assets/images/EID_Englsih_04.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/images/asddasd.svg b/assets/images/asddasd.svg new file mode 100644 index 0000000..b91a675 --- /dev/null +++ b/assets/images/asddasd.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index 703a8b0..5ce6861 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -90,7 +90,7 @@ class AppState { String get getHuaweiPushToken => _huaweiPushToken; - final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 9.6, mobileType: Platform.isAndroid ? "android" : "ios"); + final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 9.7, mobileType: Platform.isAndroid ? "android" : "ios"); void setPostParamsInitConfig() { isAuthenticated = false; diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 793712c..a89c7f6 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -435,7 +435,7 @@ class _DashboardScreenState extends State with WidgetsBindingOb child: ListView.separated( shrinkWrap: true, scrollDirection: Axis.horizontal, - padding: const EdgeInsets.symmetric(horizontal: 24), + padding: const EdgeInsets.symmetric(horizontal: 0), itemCount: model.greetingCardsList!.length, separatorBuilder: (context, index) => const SizedBox(width: 24), itemBuilder: (context, index) { @@ -444,7 +444,7 @@ class _DashboardScreenState extends State with WidgetsBindingOb AppState().isArabic(context) ? (card.backgroundImageUrlAr ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg") : (card.backgroundImageUrlEn ?? "https://www.hmg.com/Lists/CS_Greeting_Cards/Attachments/5/CS_Ramadan_26.jpg"), - fit: BoxFit.fill, + fit: BoxFit.contain, placeholderBuilder: (context) => ClipRRect(borderRadius: BorderRadius.circular(18), child: Container(height: 80, color: Colors.white).toShimmer()), ).onPress(() { launchUrl(Uri.parse(AppState().isArabic(context) ? card.urlAr! : card.urlEn!)); From 9f4e9943cf994933f8d80927b0e3816e3c5f53ed Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Tue, 31 Mar 2026 14:43:40 +0300 Subject: [PATCH 5/6] VHR-279 --- lib/classes/consts.dart | 4 +-- .../mowadhafhi/mowadhafhi_hr_request.dart | 31 +++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lib/classes/consts.dart b/lib/classes/consts.dart index 88ebf73..d8efe5d 100644 --- a/lib/classes/consts.dart +++ b/lib/classes/consts.dart @@ -4,12 +4,12 @@ class ApiConsts { // static String baseUrl = "http://10.200.204.11"; // Local server // static String baseUrl = "https://erptstapp.srca.org.sa"; // SRCA server - // static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver + static String baseUrl = "https://uat.hmgwebservices.com"; // UAT ser343622ver // static String baseUrl = "http://10.201.204.101:2024"; // static String baseUrl = "https://webservices.hmg.com"; // PreProd // static String baseUrl = "https://hmgwebservices.com"; // Live server - static String baseUrl = "https://mohemm.hmg.com"; // New Live server + // static String baseUrl = "https://mohemm.hmg.com"; // New Live server // // static String baseUrl = "http://10.20.200.111:1010/"; diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart index e7d2fde..ec12c51 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart @@ -194,8 +194,35 @@ class _MowadhafhiHRRequestState extends State { SimpleButton(LocaleKeys.add.tr(), () async { FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); if (result != null) { - attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); - attachmentFiles = attachmentFiles.toSet().toList(); + // Maximum file size: 2 MB (in bytes) + const int maxFileSizeInBytes = 2 * 1024 * 1024; // 2 MB + List newFiles = []; + List oversizedFiles = []; + + for (String? path in result.paths) { + if (path != null) { + File file = File(path); + int fileSize = await file.length(); + + if (fileSize <= maxFileSizeInBytes) { + newFiles.add(file); + } else { + String fileName = path.split('/').last; + oversizedFiles.add(fileName); + } + } + } + + if (newFiles.isNotEmpty) { + attachmentFiles = attachmentFiles + newFiles; + attachmentFiles = attachmentFiles.toSet().toList(); + } + + if (oversizedFiles.isNotEmpty) { + // String fileList = oversizedFiles.join(', '); + Utils.showToast('File exceeds 2 MB limit'); + } + setState(() {}); } }, fontSize: 14), From a131179c7108d0cc23e88e31b7347a4535bfd1b8 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Wed, 1 Apr 2026 14:33:16 +0300 Subject: [PATCH 6/6] VHR-279 --- .../mowadhafhi/mowadhafhi_hr_request.dart | 63 +++++++++++++++---- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart index ec12c51..b358843 100644 --- a/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart +++ b/lib/ui/screens/mowadhafhi/mowadhafhi_hr_request.dart @@ -192,35 +192,76 @@ class _MowadhafhiHRRequestState extends State { title.toText16().expanded, 6.width, SimpleButton(LocaleKeys.add.tr(), () async { - FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); + FilePickerResult? result = await FilePicker.platform.pickFiles( + allowMultiple: true, + ); if (result != null) { // Maximum file size: 2 MB (in bytes) - const int maxFileSizeInBytes = 2 * 1024 * 1024; // 2 MB + const int maxFileSizeInBytes = 2 * 1024 * 1024; // 2 MB = 2097152 bytes List newFiles = []; List oversizedFiles = []; - for (String? path in result.paths) { - if (path != null) { - File file = File(path); - int fileSize = await file.length(); + for (PlatformFile platformFile in result.files) { + if (platformFile.path != null) { + File file = File(platformFile.path!); - if (fileSize <= maxFileSizeInBytes) { + // Get file size - check multiple sources for iOS compatibility + int fileSize = 0; + + // Method 1: Check platformFile.size first + if (platformFile.size > 0) { + fileSize = platformFile.size; + debugPrint('Using platformFile.size: $fileSize bytes'); + } + + // Method 2: Always verify with file.length() as well + try { + int fileLengthSize = await file.length(); + debugPrint('Using file.length(): $fileLengthSize bytes'); + // Use the maximum of both to ensure we catch the real size + if (fileLengthSize > fileSize) { + fileSize = fileLengthSize; + debugPrint('Using larger value from file.length()'); + } + } catch (e) { + debugPrint('Error getting file.length(): $e'); + // If file.length() fails, rely on platformFile.size + if (fileSize == 0) { + debugPrint('Cannot determine file size, rejecting file: ${platformFile.name}'); + oversizedFiles.add('${platformFile.name} (unknown size)'); + continue; + } + } + + double fileSizeMB = fileSize / (1024 * 1024); + debugPrint('Final file size - ${platformFile.name}: $fileSize bytes (${fileSizeMB.toStringAsFixed(2)} MB)'); + + // STRICT validation: Only accept files that are 2 MB or less + if (fileSize > 0 && fileSize <= maxFileSizeInBytes) { + debugPrint('✓ File accepted: ${platformFile.name}'); newFiles.add(file); + } else if (fileSize > maxFileSizeInBytes) { + debugPrint('✗ File REJECTED (too large): ${platformFile.name} - ${fileSizeMB.toStringAsFixed(2)} MB'); + oversizedFiles.add('${platformFile.name} (${fileSizeMB.toStringAsFixed(2)} MB)'); } else { - String fileName = path.split('/').last; - oversizedFiles.add(fileName); + debugPrint('✗ File REJECTED (invalid size): ${platformFile.name}'); + oversizedFiles.add('${platformFile.name} (invalid)'); } } } + // Only add valid files if (newFiles.isNotEmpty) { attachmentFiles = attachmentFiles + newFiles; attachmentFiles = attachmentFiles.toSet().toList(); + debugPrint('Total files attached: ${attachmentFiles.length}'); } + // Show error message for rejected files if (oversizedFiles.isNotEmpty) { - // String fileList = oversizedFiles.join(', '); - Utils.showToast('File exceeds 2 MB limit'); + String fileList = oversizedFiles.join('\n'); + Utils.showToast('Max 2MB File allowed.'); + debugPrint('Total rejected files: ${oversizedFiles.length}'); } setState(() {});