From 780159f380dc17a25d3403ce2be64ceba61db20a Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Tue, 7 Apr 2026 10:31:19 +0530 Subject: [PATCH] FIX_Grid View --- .flutter-plugins-dependencies | 2 +- lib/core/services/api_service.dart | 14 +- lib/presentation/screens/Grid/gridView.dart | 370 +++++++------------- 3 files changed, 125 insertions(+), 261 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 8a6b4f8..ac80154 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.4/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.2.1/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_ios","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/open_file_ios-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"syncfusion_flutter_pdfviewer","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-31.1.19/","native_build":true,"dependencies":["device_info_plus"],"dev_dependency":false},{"name":"url_launcher_ios","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.4/","native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"connectivity_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"firebase_auth","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.4/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_plugin_android_lifecycle","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.31/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_android","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/google_sign_in_android-7.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_android","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/local_auth_android-1.0.52/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"open_file_android","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/open_file_android-1.0.6/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/path_provider_android-2.2.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.13/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"syncfusion_flutter_pdfviewer","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-31.1.19/","native_build":true,"dependencies":["device_info_plus"],"dev_dependency":false},{"name":"url_launcher_android","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"connectivity_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.4/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage_macos","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.2.1/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_mac","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/open_file_mac-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"syncfusion_pdfviewer_macos","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_macos-31.1.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_macos","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.3/","native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"connectivity_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_linux","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_linux","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/open_file_linux-0.0.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false},{"name":"syncfusion_pdfviewer_linux","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_linux-31.1.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_linux","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.2/","native_build":true,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"connectivity_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.11/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/open_file_windows-0.0.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false},{"name":"syncfusion_pdfviewer_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_windows-31.1.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_windows","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.5/","native_build":true,"dependencies":[],"dev_dependency":false}],"web":[{"name":"connectivity_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","dependencies":[],"dev_dependency":false},{"name":"firebase_auth_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_auth_web-6.1.0/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"firebase_core_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_core_web-3.3.0/","dependencies":[],"dev_dependency":false},{"name":"firebase_messaging_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/firebase_messaging_web-4.1.0/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"flutter_secure_storage_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","dependencies":[],"dev_dependency":false},{"name":"google_sign_in_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/google_sign_in_web-1.1.0/","dependencies":[],"dev_dependency":false},{"name":"open_file_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/open_file_web-0.0.4/","dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","dependencies":[],"dev_dependency":false},{"name":"shared_preferences_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.3/","dependencies":[],"dev_dependency":false},{"name":"syncfusion_pdfviewer_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_web-31.1.19/","dependencies":[],"dev_dependency":false},{"name":"url_launcher_web","path":"/Users/venbateam/.pub-cache/hosted/pub.dev/url_launcher_web-2.4.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"device_info_plus","dependencies":[]},{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"fluttertoast","dependencies":[]},{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]},{"name":"local_auth","dependencies":["local_auth_android","local_auth_darwin","local_auth_windows"]},{"name":"local_auth_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"local_auth_darwin","dependencies":[]},{"name":"local_auth_windows","dependencies":[]},{"name":"open_file","dependencies":["open_file_android","open_file_web","open_file_ios","open_file_mac","open_file_windows","open_file_linux"]},{"name":"open_file_android","dependencies":[]},{"name":"open_file_ios","dependencies":[]},{"name":"open_file_linux","dependencies":[]},{"name":"open_file_mac","dependencies":[]},{"name":"open_file_web","dependencies":[]},{"name":"open_file_windows","dependencies":[]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"pdf_render","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"syncfusion_flutter_pdfviewer","dependencies":["url_launcher","device_info_plus","syncfusion_pdfviewer_web","syncfusion_pdfviewer_macos","syncfusion_pdfviewer_windows","syncfusion_pdfviewer_linux"]},{"name":"syncfusion_pdfviewer_linux","dependencies":[]},{"name":"syncfusion_pdfviewer_macos","dependencies":[]},{"name":"syncfusion_pdfviewer_web","dependencies":[]},{"name":"syncfusion_pdfviewer_windows","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2026-04-06 15:58:42.611708","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}} +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.4/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.2.1/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_ios-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/home/venba/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"syncfusion_flutter_pdfviewer","path":"/home/venba/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-31.1.19/","native_build":true,"dependencies":["device_info_plus"],"dev_dependency":false},{"name":"url_launcher_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.4/","native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.4/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_plugin_android_lifecycle","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.31/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_android","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_android-7.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_android","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_android-1.0.52/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"],"dev_dependency":false},{"name":"open_file_android","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_android-1.0.6/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_android-2.2.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/home/venba/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.13/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"syncfusion_flutter_pdfviewer","path":"/home/venba/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-31.1.19/","native_build":true,"dependencies":["device_info_plus"],"dev_dependency":false},{"name":"url_launcher_android","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"firebase_messaging","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging-16.0.4/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"flutter_secure_storage_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"google_sign_in_ios","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_ios-6.2.1/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_darwin","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_darwin-1.6.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_mac","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_mac-1.0.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/home/venba/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"syncfusion_pdfviewer_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_macos-31.1.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_macos","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.3/","native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_linux-0.0.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false},{"name":"syncfusion_pdfviewer_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_linux-31.1.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_linux","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.2/","native_build":true,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"firebase_auth","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth-6.1.2/","native_build":true,"dependencies":["firebase_core"],"dev_dependency":false},{"name":"firebase_core","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core-4.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_secure_storage_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"local_auth_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/local_auth_windows-1.0.11/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"open_file_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_windows-0.0.3/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false},{"name":"syncfusion_pdfviewer_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_windows-31.1.19/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"url_launcher_windows","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.5/","native_build":true,"dependencies":[],"dev_dependency":false}],"web":[{"name":"connectivity_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.5/","dependencies":[],"dev_dependency":false},{"name":"device_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/device_info_plus-11.5.0/","dependencies":[],"dev_dependency":false},{"name":"file_picker","path":"/home/venba/.pub-cache/hosted/pub.dev/file_picker-10.3.7/","dependencies":[],"dev_dependency":false},{"name":"firebase_auth_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_auth_web-6.1.0/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"firebase_core_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_core_web-3.3.0/","dependencies":[],"dev_dependency":false},{"name":"firebase_messaging_web","path":"/home/venba/.pub-cache/hosted/pub.dev/firebase_messaging_web-4.1.0/","dependencies":["firebase_core_web"],"dev_dependency":false},{"name":"flutter_secure_storage_web","path":"/home/venba/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false},{"name":"fluttertoast","path":"/home/venba/.pub-cache/hosted/pub.dev/fluttertoast-9.0.0/","dependencies":[],"dev_dependency":false},{"name":"google_sign_in_web","path":"/home/venba/.pub-cache/hosted/pub.dev/google_sign_in_web-1.1.0/","dependencies":[],"dev_dependency":false},{"name":"open_file_web","path":"/home/venba/.pub-cache/hosted/pub.dev/open_file_web-0.0.4/","dependencies":[],"dev_dependency":false},{"name":"package_info_plus","path":"/home/venba/.pub-cache/hosted/pub.dev/package_info_plus-8.3.1/","dependencies":[],"dev_dependency":false},{"name":"pdf_render","path":"/home/venba/.pub-cache/hosted/pub.dev/pdf_render-1.4.12/","dependencies":[],"dev_dependency":false},{"name":"shared_preferences_web","path":"/home/venba/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.3/","dependencies":[],"dev_dependency":false},{"name":"syncfusion_pdfviewer_web","path":"/home/venba/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_web-31.1.19/","dependencies":[],"dev_dependency":false},{"name":"url_launcher_web","path":"/home/venba/.pub-cache/hosted/pub.dev/url_launcher_web-2.4.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"device_info_plus","dependencies":[]},{"name":"file_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_messaging","dependencies":["firebase_core","firebase_messaging_web"]},{"name":"firebase_messaging_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"fluttertoast","dependencies":[]},{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]},{"name":"local_auth","dependencies":["local_auth_android","local_auth_darwin","local_auth_windows"]},{"name":"local_auth_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"local_auth_darwin","dependencies":[]},{"name":"local_auth_windows","dependencies":[]},{"name":"open_file","dependencies":["open_file_android","open_file_web","open_file_ios","open_file_mac","open_file_windows","open_file_linux"]},{"name":"open_file_android","dependencies":[]},{"name":"open_file_ios","dependencies":[]},{"name":"open_file_linux","dependencies":[]},{"name":"open_file_mac","dependencies":[]},{"name":"open_file_web","dependencies":[]},{"name":"open_file_windows","dependencies":[]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"pdf_render","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"syncfusion_flutter_pdfviewer","dependencies":["url_launcher","device_info_plus","syncfusion_pdfviewer_web","syncfusion_pdfviewer_macos","syncfusion_pdfviewer_windows","syncfusion_pdfviewer_linux"]},{"name":"syncfusion_pdfviewer_linux","dependencies":[]},{"name":"syncfusion_pdfviewer_macos","dependencies":[]},{"name":"syncfusion_pdfviewer_web","dependencies":[]},{"name":"syncfusion_pdfviewer_windows","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2026-04-07 09:46:11.211850","version":"3.41.4","swift_package_manager_enabled":{"ios":false,"macos":false}} \ No newline at end of file diff --git a/lib/core/services/api_service.dart b/lib/core/services/api_service.dart index 16d2ed6..b72c4c2 100644 --- a/lib/core/services/api_service.dart +++ b/lib/core/services/api_service.dart @@ -922,7 +922,6 @@ class ApiService { String? vehicleType, String? segment, String? rto, - String? planType, String? search, String? loggedId, }) async { @@ -936,7 +935,6 @@ class ApiService { final vehicleTypeTrimmed = vehicleType?.trim(); final segmentTrimmed = segment?.trim(); final rtoTrimmed = rto?.trim(); - final planTypeTrimmed = planType?.trim(); final searchTrimmed = search?.trim(); final loggedIdTrimmed = loggedId?.trim(); final endpoint = Uri.parse('${Env.apiUrl}grid'); @@ -963,9 +961,6 @@ class ApiService { if (rtoTrimmed != null && rtoTrimmed.isNotEmpty) { queryParameters['rto'] = rtoTrimmed; } - if (planTypeTrimmed != null && planTypeTrimmed.isNotEmpty) { - queryParameters['plan_type'] = planTypeTrimmed; - } if (searchTrimmed != null && searchTrimmed.isNotEmpty) { queryParameters['search'] = searchTrimmed; } @@ -988,7 +983,6 @@ class ApiService { String? vehicleType, String? segment, String? rto, - String? planType, String? search, String? loggedId, }) async { @@ -1007,13 +1001,17 @@ class ApiService { } } + final downloadRoleLc = role?.trim().toLowerCase(); + addQuery('role', role); - addQuery('file_id', fileId); + // Manager / Accounts use file_id; Agent uses logged_id only (same as loadPayoutGrid). + if (downloadRoleLc != 'agent') { + addQuery('file_id', fileId); + } addQuery('insurer', insurer); addQuery('vehicle_type', vehicleType); addQuery('segment', segment); addQuery('rto', rto); - addQuery('plan_type', planType); addQuery('search', search); addQuery('logged_id', loggedId); diff --git a/lib/presentation/screens/Grid/gridView.dart b/lib/presentation/screens/Grid/gridView.dart index da51f71..4aac403 100644 --- a/lib/presentation/screens/Grid/gridView.dart +++ b/lib/presentation/screens/Grid/gridView.dart @@ -33,9 +33,14 @@ class gridViewScreen extends ConsumerStatefulWidget { } class _gridViewScreenState extends ConsumerState { + static const String _defaultVehicleTypeLabel = 'TWO WHEELER NEW'; + final ApiService _apiService = ApiService(); String? _loggedId; + /// `file_id` from the last successful Manager/Accounts grid load (export matches this). + String? _gridFileIdUsed; + bool _isLoading = false; // API response @@ -43,7 +48,6 @@ class _gridViewScreenState extends ConsumerState { List> _filteredGrid = []; List _insurers = []; - List> _planTypes = []; List _rtos = []; List _vehicleTypes = []; List _segments = []; @@ -53,7 +57,6 @@ class _gridViewScreenState extends ConsumerState { String? _selectedRto; String? _selectedVehicleType; String? _selectedSegment; - String? _selectedPlanTypeValue; // comp/tp/od final TextEditingController _searchController = TextEditingController(); final TextEditingController _editVehicleTypeController = @@ -267,32 +270,63 @@ class _gridViewScreenState extends ConsumerState { final queryFileId = queryParams['file_id']?.trim(); final effectiveRole = (queryRole != null && queryRole.isNotEmpty) ? queryRole : apiRole; - String? effectiveFileId = - (queryFileId != null && queryFileId.isNotEmpty) ? queryFileId : null; + final roleLc = (effectiveRole ?? '').toLowerCase(); - if (effectiveFileId == null && - (effectiveRole?.toLowerCase() == 'manager' || - effectiveRole?.toLowerCase() == 'agent' || - effectiveRole?.toLowerCase() == 'accounts')) { - final fileListRes = await _apiService.fetchGridFileList(); - if ((fileListRes['status'] ?? '').toString().toLowerCase() == - 'success') { - final files = List>.from( - fileListRes['data'] ?? const [], - ); - if (files.isNotEmpty) { - files.sort((a, b) { - final left = int.tryParse(a['id']?.toString() ?? '') ?? 0; - final right = int.tryParse(b['id']?.toString() ?? '') ?? 0; - return right.compareTo(left); - }); - effectiveFileId = files.first['id']?.toString(); + // Manager / Accounts: require file_id (URL or latest from file list). + // Agent: never send file_id; require logged-in user id for retention. + String? effectiveFileId; + if (roleLc == 'agent') { + effectiveFileId = null; + } else { + effectiveFileId = + (queryFileId != null && queryFileId.isNotEmpty) ? queryFileId : null; + + if (effectiveFileId == null && + (roleLc == 'manager' || roleLc == 'accounts')) { + final fileListRes = await _apiService.fetchGridFileList(); + if ((fileListRes['status'] ?? '').toString().toLowerCase() == + 'success') { + final files = List>.from( + fileListRes['data'] ?? const [], + ); + if (files.isNotEmpty) { + files.sort((a, b) { + final left = int.tryParse(a['id']?.toString() ?? '') ?? 0; + final right = int.tryParse(b['id']?.toString() ?? '') ?? 0; + return right.compareTo(left); + }); + effectiveFileId = files.first['id']?.toString(); + } + } + } + + if (roleLc == 'manager' || roleLc == 'accounts') { + if (effectiveFileId == null || effectiveFileId.trim().isEmpty) { + if (mounted) { + ToastHelper.showErrorToast( + context, + 'No grid file found. Open grid from a file or upload a payout grid first.', + ); + } + return; } } } - final loggedIdForGrid = - (effectiveRole ?? '').toLowerCase() == 'agent' ? _loggedId : null; + if (roleLc == 'agent') { + final lid = _loggedId?.trim(); + if (lid == null || lid.isEmpty) { + if (mounted) { + ToastHelper.showErrorToast( + context, + 'Unable to load grid: missing logged-in user id.', + ); + } + return; + } + } + + final loggedIdForGrid = roleLc == 'agent' ? _loggedId?.trim() : null; final res = await _apiService.loadPayoutGrid( role: effectiveRole, @@ -300,6 +334,9 @@ class _gridViewScreenState extends ConsumerState { loggedId: loggedIdForGrid, ); if ((res['status'] ?? '').toString().toLowerCase() != 'success') { + if (mounted) { + setState(() => _gridFileIdUsed = null); + } ToastHelper.showErrorToast( context, res['data']?.toString() ?? 'Failed to load payout grid', @@ -310,7 +347,6 @@ class _gridViewScreenState extends ConsumerState { final payload = _extractPayload(res); final grid = payload['grid']; final insurers = payload['insurers']; - final planTypes = payload['plan_types']; final rtos = payload['rtos']; final vehicleTypes = payload['vehicle_types']; final segments = payload['segments']; @@ -325,13 +361,19 @@ class _gridViewScreenState extends ConsumerState { _filteredGrid = List>.from(_grid); _insurers = _toStringList(insurers); - _planTypes = _toPlanTypeList(planTypes); _rtos = _toStringList(rtos); _vehicleTypes = _toStringList(vehicleTypes); _segments = _toStringList(segments); + _gridFileIdUsed = + (roleLc == 'manager' || roleLc == 'accounts') ? effectiveFileId : null; + + _applyDefaultVehicleTypeSelection(); _applyFilters(); } catch (e) { + if (mounted) { + setState(() => _gridFileIdUsed = null); + } ToastHelper.showErrorToast(context, e.toString()); } finally { if (mounted) setState(() => _isLoading = false); @@ -381,25 +423,18 @@ class _gridViewScreenState extends ConsumerState { .toList(); } - List> _toPlanTypeList(dynamic raw) { - if (raw is! List) return >[]; - return raw.map>((item) { - if (item is Map) { - final map = item.cast(); - final value = map['value']?.toString() ?? - map['id']?.toString() ?? - map['key']?.toString() ?? - ''; - final label = map['label']?.toString() ?? - map['name']?.toString() ?? - map['title']?.toString() ?? - map['value']?.toString() ?? - value; - return {'value': value, 'label': label}; + /// Sets [_selectedVehicleType] to the dropdown spelling that matches + /// [_defaultVehicleTypeLabel], or prepends that label if the API omits it. + void _applyDefaultVehicleTypeSelection() { + final desiredLower = _defaultVehicleTypeLabel.toLowerCase(); + for (final v in _vehicleTypes) { + if (v.trim().toLowerCase() == desiredLower) { + _selectedVehicleType = v; + return; } - final v = item?.toString() ?? ''; - return {'value': v, 'label': v.toUpperCase()}; - }).where((e) => (e['value']?.toString().trim().isNotEmpty ?? false)).toList(); + } + _vehicleTypes = [_defaultVehicleTypeLabel, ..._vehicleTypes]; + _selectedVehicleType = _defaultVehicleTypeLabel; } void _applyFilters() { @@ -411,20 +446,6 @@ class _gridViewScreenState extends ConsumerState { return raw?.toString().toLowerCase() == selected.toLowerCase(); } - bool matchesPlanType() { - if (_selectedPlanTypeValue == null) return true; - final raw = row[_selectedPlanTypeValue]; - if (raw == null) return false; - final s = raw.toString().trim().toLowerCase(); - if (s.isEmpty || s == 'null' || s == '-') return false; - - // Treat 0 payout as "not configured" so it doesn't match plan filters. - final n = num.tryParse(s); - if (n != null) return n != 0; - - return s != '0'; - } - bool matchesSearch() { if (q.isEmpty) return true; final values = [ @@ -447,7 +468,6 @@ class _gridViewScreenState extends ConsumerState { equalsOrAll(_selectedVehicleType, row['vehicle_type']) && equalsOrAll(_selectedSegment, row['segment']) && equalsOrAll(_selectedRto, row['rto']) && - matchesPlanType() && matchesSearch(); }).toList(); @@ -591,24 +611,13 @@ class _gridViewScreenState extends ConsumerState { bool get _showPartnerRetentionValues => _showAddButton || _accountsAgentPreview; - bool get _showCompColumnForAgent => - !_showAddButton || - _selectedPlanTypeValue == 'comp'; - bool get _showTpColumnForAgent => - !_showAddButton || - _selectedPlanTypeValue == 'tp'; - bool get _showOdColumnForAgent => - !_showAddButton || - _selectedPlanTypeValue == 'od'; bool get _hasAnyFilterSelection { return (_selectedInsurer != null && _selectedInsurer!.trim().isNotEmpty) || (_selectedRto != null && _selectedRto!.trim().isNotEmpty) || (_selectedVehicleType != null && _selectedVehicleType!.trim().isNotEmpty) || - (_selectedSegment != null && _selectedSegment!.trim().isNotEmpty) || - (_selectedPlanTypeValue != null && - _selectedPlanTypeValue!.trim().isNotEmpty); + (_selectedSegment != null && _selectedSegment!.trim().isNotEmpty); } String _toEditText(dynamic value) { @@ -766,17 +775,6 @@ class _gridViewScreenState extends ConsumerState { Widget _buildFilterBar(BuildContext context) { final isMobile = ResponsiveLayout.isMobile(context); - final planTypeItems = List>.from(_planTypes); - Map? selectedPlanType; - if (_selectedPlanTypeValue != null) { - for (final e in planTypeItems) { - if ((e['value'] as String?) == _selectedPlanTypeValue) { - selectedPlanType = e; - break; - } - } - } - Widget dropdownInsurer() { return SizedBox( width: isMobile ? double.infinity : 200, @@ -811,46 +809,6 @@ class _gridViewScreenState extends ConsumerState { ); } - Widget dropdownPlanType() { - return SizedBox( - width: isMobile ? double.infinity : 220, - height: 40, - child: DropdownSearch>( - items: (filter, infiniteScrollProps) { - final items = planTypeItems; - if (filter.isEmpty) return items; - return items - .where((e) => - (e['label']?.toString() ?? '') - .toLowerCase() - .contains(filter.toLowerCase())) - .toList(); - }, - selectedItem: selectedPlanType, - itemAsString: (item) => item['label']?.toString() ?? '', - compareFn: (a, b) => (a['value'] == b['value']), - popupProps: const PopupProps.menu( - showSearchBox: true, - fit: FlexFit.loose, - ), - dropdownBuilder: (context, selectedItem) => Padding( - padding: const EdgeInsets.only(left: 10), - child: Text( - selectedItem?['label']?.toString() ?? '', - style: GoogleFonts.poppins(fontSize: 12, color: Colors.black), - overflow: TextOverflow.ellipsis, - ), - ), - onChanged: (val) => _setFilter(() { - _selectedPlanTypeValue = val?['value'] as String?; - }), - decoratorProps: DropDownDecoratorProps( - decoration: _dropdownDecoration('Plan Type'), - ), - ), - ); - } - Widget dropdownRto() { return SizedBox( width: isMobile ? double.infinity : 180, @@ -974,11 +932,10 @@ class _gridViewScreenState extends ConsumerState { onTap: () { setState(() { _selectedInsurer = null; - _selectedPlanTypeValue = null; _selectedRto = null; - _selectedVehicleType = null; _selectedSegment = null; _searchController.clear(); + _applyDefaultVehicleTypeSelection(); }); _applyFilters(); }, @@ -996,12 +953,10 @@ class _gridViewScreenState extends ConsumerState { child: isMobile ? Column( children: [ - dropdownInsurer(), - const SizedBox(height: 10), - dropdownPlanType(), - const SizedBox(height: 10), dropdownVehicleType(), const SizedBox(height: 10), + dropdownInsurer(), + const SizedBox(height: 10), dropdownSegment(), const SizedBox(height: 10), dropdownRto(), @@ -1018,12 +973,10 @@ class _gridViewScreenState extends ConsumerState { scrollDirection: Axis.horizontal, child: Row( children: [ - dropdownInsurer(), - const SizedBox(width: 12), - dropdownPlanType(), - const SizedBox(width: 12), dropdownVehicleType(), const SizedBox(width: 12), + dropdownInsurer(), + const SizedBox(width: 12), dropdownSegment(), const SizedBox(width: 12), dropdownRto(), @@ -1107,13 +1060,8 @@ class _gridViewScreenState extends ConsumerState { padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8), itemCount: _paginatedGrid.length, separatorBuilder: (context, index) => const SizedBox(height: 10), - itemBuilder: (context, index) => _gridViewCard( - row: _paginatedGrid[index], - showCompColumn: _showCompColumnForAgent, - showTpColumn: _showTpColumnForAgent, - showOdColumn: _showOdColumnForAgent, - showPartnerCompValue: _showPartnerRetentionValues, - ), + itemBuilder: (context, index) => + _gridViewCard(row: _paginatedGrid[index]), ); } @@ -1139,12 +1087,9 @@ class _gridViewScreenState extends ConsumerState { Expanded(flex: 2, child: Text('Vehicle', style: _headerStyle)), Expanded(flex: 3, child: Text('Segment', style: _headerStyle)), Expanded(flex: 2, child: Text('RTO', style: _headerStyle)), - if (_showCompColumnForAgent) - Expanded(flex: 2, child: Text('Comp', style: _headerStyle)), - if (_showTpColumnForAgent) - Expanded(flex: 2, child: Text('TP', style: _headerStyle)), - if (_showOdColumnForAgent) - Expanded(flex: 2, child: Text('OD', style: _headerStyle)), + Expanded(flex: 2, child: Text('Comp', style: _headerStyle)), + Expanded(flex: 2, child: Text('TP', style: _headerStyle)), + Expanded(flex: 2, child: Text('OD', style: _headerStyle)), Expanded(flex: 3, child: Text('Remarks', style: _headerStyle)), ], ), @@ -1181,48 +1126,18 @@ class _gridViewScreenState extends ConsumerState { ), ), Expanded(flex: 2, child: Text(_nullableString(row['rto']), style: _dataBold)), - if (_showCompColumnForAgent) - Expanded( - flex: 2, - child: Text( - _showPartnerRetentionValues - ? _nullableString(row['partner_comp']) - : _nullableString(row['comp']), - style: _dataBold, - ), - ), - if (_showTpColumnForAgent) - Expanded(flex: 2, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('${_nullableString(row['tp'])}', style: _dataBold), - if (_showPartnerRetentionValues) ...[ - const SizedBox(height: 2), - Text( - '${_nullableString(row['partner_tp'])}', - style: _dataBold, - ), - ], - ], - ), - ), - if (_showOdColumnForAgent) - Expanded( - flex: 2, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('${_nullableString(row['od'])}', style: _dataBold), - if (_showPartnerRetentionValues) ...[ - const SizedBox(height: 2), - Text( - '${_nullableString(row['partner_od'])}', - style: _dataBold, - ), - ], - ], - ), - ), + Expanded( + flex: 2, + child: Text(_nullableString(row['comp']), style: _dataBold), + ), + Expanded( + flex: 2, + child: Text(_nullableString(row['tp']), style: _dataBold), + ), + Expanded( + flex: 2, + child: Text(_nullableString(row['od']), style: _dataBold), + ), Expanded( flex: 3, child: Text( @@ -1287,15 +1202,23 @@ class _gridViewScreenState extends ConsumerState { } try { final queryParams = Uri.base.queryParameters; - final fileIdFromQuery = queryParams['file_id']?.trim(); final role = _apiRoleFromAppRole(ref.read(userRoleProvider)); final roleLc = (role ?? '').toLowerCase(); + final fileIdFromQuery = queryParams['file_id']?.trim(); final fileIdToSend = (roleLc == 'manager' || roleLc == 'accounts') - ? fileIdFromQuery + ? (_gridFileIdUsed ?? + (fileIdFromQuery != null && fileIdFromQuery.isNotEmpty + ? fileIdFromQuery + : null)) : null; final previewAgentId = queryParams['agent_id']?.trim(); + final loggedIdForExport = roleLc == 'agent' + ? _loggedId?.trim() + : (previewAgentId != null && previewAgentId.isNotEmpty + ? previewAgentId + : null); await _apiService.downloadGridExcel( role: role, fileId: fileIdToSend, @@ -1303,11 +1226,8 @@ class _gridViewScreenState extends ConsumerState { vehicleType: _selectedVehicleType, segment: _selectedSegment, rto: _selectedRto, - planType: _selectedPlanTypeValue, search: _searchController.text.trim(), - loggedId: previewAgentId != null && previewAgentId.isNotEmpty - ? previewAgentId - : _loggedId, + loggedId: loggedIdForExport, ); } catch (e) { if (mounted) { @@ -1340,18 +1260,8 @@ class _gridViewScreenState extends ConsumerState { class _gridViewCard extends StatelessWidget { final Map row; - final bool showCompColumn; - final bool showTpColumn; - final bool showOdColumn; - final bool showPartnerCompValue; - const _gridViewCard({ - required this.row, - required this.showCompColumn, - required this.showTpColumn, - required this.showOdColumn, - required this.showPartnerCompValue, - }); + const _gridViewCard({required this.row}); String _nullableString(dynamic v) { if (v == null) return '-'; @@ -1405,21 +1315,11 @@ class _gridViewCard extends StatelessWidget { const SizedBox(height: 10), Row( children: [ - if (showCompColumn) - Expanded( - child: _upDownMetric( - title: 'Comp', - value: showPartnerCompValue ? row['partner_comp'] : row['comp'], - ), - ), - if (showCompColumn && (showTpColumn || showOdColumn)) - const SizedBox(width: 10), - if (showTpColumn) - Expanded(child: _metric('TP', row['tp'])), - if (showTpColumn && showOdColumn) - const SizedBox(width: 10), - if (showOdColumn) - Expanded(child: _metric('OD', row['od'])), + Expanded(child: _metric('Comp', row['comp'])), + const SizedBox(width: 10), + Expanded(child: _metric('TP', row['tp'])), + const SizedBox(width: 10), + Expanded(child: _metric('OD', row['od'])), ], ), const SizedBox(height: 10), @@ -1460,40 +1360,6 @@ class _gridViewCard extends StatelessWidget { ), ); } - - Widget _upDownMetric({ - required String title, - required dynamic value, - }) { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), - decoration: BoxDecoration( - color: const Color(0xFFF8FAFC), - borderRadius: BorderRadius.circular(10), - border: Border.all(color: const Color(0xFFE2E8F0)), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: GoogleFonts.poppins( - fontSize: 10, - color: const Color(0xFF64748B), - ), - ), - const SizedBox(height: 2), - Text( - _nullableString(value), - style: GoogleFonts.poppins( - fontSize: 11, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - ); - } } /* import 'package:dropdown_search/dropdown_search.dart'; import 'package:flutter/material.dart';