From 5bc5e582f13b667d86ee62cb4a3d641be0293ac3 Mon Sep 17 00:00:00 2001 From: SurendarSuri30 Date: Tue, 7 Apr 2026 12:05:12 +0530 Subject: [PATCH] bug fix --- .flutter-plugins-dependencies | 2 +- .../dashboard/partner_portal_dashboard.dart | 114 ++- .../screens/payout/payout_details.dart | 395 ++++++----- .../screens/payout/payout_details_view.dart | 69 +- .../indicators/date_range_picker_dialog.dart | 665 ++++++++++++------ 5 files changed, 777 insertions(+), 468 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 8a6b4f8..6688718 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":"/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 17:25:04.969014","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}} \ No newline at end of file diff --git a/lib/presentation/screens/dashboard/partner_portal_dashboard.dart b/lib/presentation/screens/dashboard/partner_portal_dashboard.dart index 563d4f6..a675696 100644 --- a/lib/presentation/screens/dashboard/partner_portal_dashboard.dart +++ b/lib/presentation/screens/dashboard/partner_portal_dashboard.dart @@ -409,8 +409,8 @@ class _PolicyListCard extends StatelessWidget { ); } -class _RenewalAlertsCard extends StatelessWidget { - static const int kVisibleRows = 10; +class _RenewalAlertsCard extends StatefulWidget { + static const int kPageSize = 10; static const double kRowHeight = 44; final List> renewals; @@ -426,10 +426,44 @@ class _RenewalAlertsCard extends StatelessWidget { required this.inr, }); + @override + State<_RenewalAlertsCard> createState() => _RenewalAlertsCardState(); +} + +class _RenewalAlertsCardState extends State<_RenewalAlertsCard> { + int _currentPage = 1; + + int get _totalPages { + if (widget.renewals.isEmpty) return 1; + return ((widget.renewals.length - 1) ~/ _RenewalAlertsCard.kPageSize) + 1; + } + + List> get _pageItems { + final start = (_currentPage - 1) * _RenewalAlertsCard.kPageSize; + var end = start + _RenewalAlertsCard.kPageSize; + if (end > widget.renewals.length) end = widget.renewals.length; + if (start >= widget.renewals.length) return const []; + return widget.renewals.sublist(start, end); + } + + @override + void didUpdateWidget(covariant _RenewalAlertsCard oldWidget) { + super.didUpdateWidget(oldWidget); + final dataChanged = oldWidget.renewals != widget.renewals || + oldWidget.selectedDays != widget.selectedDays; + if (dataChanged) { + _currentPage = 1; + return; + } + if (_currentPage > _totalPages) { + _currentPage = _totalPages; + } + } + @override Widget build(BuildContext context) { - final visibleRowCount = renewals.length.clamp(1, kVisibleRows); - final listHeight = visibleRowCount * kRowHeight; + final pageItems = _pageItems; + final startIndex = (_currentPage - 1) * _RenewalAlertsCard.kPageSize; return _DashCard( header: Row(children: [ Container( @@ -472,9 +506,9 @@ class _RenewalAlertsCard extends StatelessWidget { spacing: 2, runSpacing: 2, children: [10, 20, 30, 40, 50].map((d) { - final act = selectedDays == d; + final act = widget.selectedDays == d; return GestureDetector( - onTap: () => onDays(d), + onTap: () => widget.onDays(d), child: AnimatedContainer( duration: const Duration(milliseconds: 180), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), @@ -500,7 +534,7 @@ class _RenewalAlertsCard extends StatelessWidget { ), ), ]), - body: totalCount == 0 + body: widget.totalCount == 0 ? const _EmptyState(message: 'No renewals due within selected period') : Column( crossAxisAlignment: CrossAxisAlignment.stretch, @@ -521,17 +555,63 @@ class _RenewalAlertsCard extends StatelessWidget { ], ), ), - SizedBox( - height: listHeight, - child: ListView.separated( - physics: const ClampingScrollPhysics(), - itemCount: renewals.length, - separatorBuilder: (_, __) => const Divider(height: 1, color: Color(0xFFD9F0ED)), - itemBuilder: (_, i) => _RenewalTableRow( - serialNo: i + 1, - renewal: renewals[i], - inr: inr, + ...List.generate(pageItems.length, (i) { + final serialNo = startIndex + i + 1; + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + _RenewalTableRow( + serialNo: serialNo, + renewal: pageItems[i], + inr: widget.inr, + ), + if (i != pageItems.length - 1) + const Divider(height: 1, color: Color(0xFFD9F0ED)), + ], + ); + }), + Container( + height: 44, + padding: const EdgeInsets.symmetric(horizontal: 12), + decoration: const BoxDecoration( + border: Border(top: BorderSide(color: Color(0xFFD9F0ED))), + ), + child: Row( + children: [ + Text( + '${startIndex + 1}-${startIndex + pageItems.length} of ${widget.renewals.length}', + style: GoogleFonts.inter( + fontSize: 11, + fontWeight: FontWeight.w500, + color: const Color(0xFF64748B), ), + ), + const Spacer(), + IconButton( + onPressed: _currentPage > 1 + ? () => setState(() => _currentPage--) + : null, + icon: const Icon(Icons.chevron_left, size: 18), + visualDensity: VisualDensity.compact, + tooltip: 'Previous', + ), + Text( + '$_currentPage / $_totalPages', + style: GoogleFonts.inter( + fontSize: 11, + fontWeight: FontWeight.w600, + color: const Color(0xFF334155), + ), + ), + IconButton( + onPressed: _currentPage < _totalPages + ? () => setState(() => _currentPage++) + : null, + icon: const Icon(Icons.chevron_right, size: 18), + visualDensity: VisualDensity.compact, + tooltip: 'Next', + ), + ], ), ), ], diff --git a/lib/presentation/screens/payout/payout_details.dart b/lib/presentation/screens/payout/payout_details.dart index 53414bc..5bcc5aa 100644 --- a/lib/presentation/screens/payout/payout_details.dart +++ b/lib/presentation/screens/payout/payout_details.dart @@ -5,8 +5,6 @@ import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; import 'package:nhance_partner/data/utils/toastNotification.dart'; -import 'dart:math' show max; - import '../../../data/utils/Pagination.dart'; import '../../../core/routing/routes.dart'; import '../../../core/services/api_service.dart'; @@ -201,7 +199,7 @@ class _PayOutDetailsState extends ConsumerState { return TextFormField( key: fieldKey, initialValue: (p["commission_amount"] ?? '').toString(), - textAlign: TextAlign.right, + textAlign: TextAlign.center, style: fieldStyle, keyboardType: const TextInputType.numberWithOptions(decimal: true), inputFormatters: _commissionInputFormatter, @@ -950,20 +948,12 @@ class _PayOutDetailsState extends ConsumerState { ? CrossFadeState.showFirst : CrossFadeState.showSecond, firstChild: const SizedBox(), - secondChild: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: SizedBox( - width: max( - _tableMinWidth, - MediaQuery.of(context).size.width - 32, - ), - child: Column( - children: [ - _policyTableHeader(), // static header - _policyTableBody(), // vertical scroll rows - ], - ), - ), + secondChild: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _policyTableHeader(), + _buildDataTable(context), + ], ), ), ], @@ -1124,166 +1114,214 @@ class _PayOutDetailsState extends ConsumerState { final partiallySelected = selectedPolicies.isNotEmpty && !allSelected; return Container( - height: 30, - padding: const EdgeInsets.symmetric(horizontal: 16), - decoration: const BoxDecoration( - // color: Color(0xFFf9fafb), - color: Color(0xFFf9fafb), - // color: Color(0xFFf9fafb), - // color: Color(0xFFF6F8F7), - // border: Border(bottom: BorderSide(color: Color(0xFFE0E0E0))), - // border: Border(bottom: BorderSide(color: Color(0xFFECEFF1))), - border: Border(bottom: BorderSide(color: Color(0xFFf9fafb))), + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), + decoration: BoxDecoration( + color: const Color(0xFFF1F5F9), + borderRadius: BorderRadius.circular(6), ), child: Row( children: [ SizedBox( - width: colCheck, - child: Checkbox( - value: allSelected ? true : (partiallySelected ? null : false), - tristate: true, - onChanged: (v) { - setState(() { - if (v == true) { - selectedPolicies = filteredPolicies - .map( - (p) => - int.tryParse( - p["policy_id"]?.toString() ?? "0", - ) ?? - 0, - ) - .where((id) => id != 0) // Filter out invalid IDs - .toSet(); - } else { - selectedPolicies.clear(); - } - totalPolicies = selectedPolicies.length.toString(); - }); - _calculateTotalCommission(); - }, + width: _colCheck, + child: Center( + child: Checkbox( + value: allSelected ? true : (partiallySelected ? null : false), + tristate: true, + onChanged: (v) { + setState(() { + if (v == true) { + selectedPolicies = filteredPolicies + .map( + (p) => + int.tryParse( + p["policy_id"]?.toString() ?? "0", + ) ?? + 0, + ) + .where((id) => id != 0) // Filter out invalid IDs + .toSet(); + } else { + selectedPolicies.clear(); + } + totalPolicies = selectedPolicies.length.toString(); + }); + _calculateTotalCommission(); + }, + ), ), ), - _headerText("S.NO", colSno, align: TextAlign.center), - _headerText("POLICY NO", colPolicy), - _headerText("POLICY DATE", colDate), - _headerText("PARTNER", colAgent), - _headerText("CUSTOMER", colCustomer), - _headerText("PREMIUM (₹)", colPremium, align: TextAlign.right), - const SizedBox(width: 10), - _headerText("PAYOUT (₹)", colCommission, align: TextAlign.right), + _headerText("S.NO", _flexSno, align: TextAlign.left), + _headerText("POLICY NO", _flexPolicy, align: TextAlign.left), + _headerText("POLICY DATE", _flexDate, align: TextAlign.left), + _headerText("PARTNER", _flexAgent, align: TextAlign.left), + _headerText("CUSTOMER", _flexCustomer, align: TextAlign.left), + _headerText("PREMIUM (₹)", _flexPremium, align: TextAlign.right), + SizedBox(width: 10), + _headerText("PAYOUT (₹)", _flexCommission, align: TextAlign.right), ], ), ); } - Widget _headerText(String text, double width, {TextAlign align = TextAlign.left}) { - return SizedBox( - width: width, + Widget _headerText(String text, int flex, {TextAlign align = TextAlign.left}) { + return Expanded( + flex: flex, child: Text( text, textAlign: align, - style: GoogleFonts.poppins( - fontSize: 11, - fontWeight: FontWeight.w500, - color: Colors.blueGrey, - letterSpacing: 0.5, - ), + style: _tableHeaderStyle, ), ); } - Widget _policyTableBody() { + Widget _buildDataTable(BuildContext context) { + if (filteredPolicies.isEmpty) { + return const SizedBox( + height: 50, + child: Center(child: Text('No available data')), + ); + } + final pageRows = _paginatedPolicies; - final startIndex = - filteredPolicies.isEmpty ? 0 : (currentPage - 1) * itemsPerPage; return SizedBox( height: MediaQuery.of(context).size.height * 0.48, child: ListView.builder( - itemCount: pageRows.length, + itemCount: pageRows.length + 1, itemBuilder: (context, index) { - final p = pageRows[index]; + if (index == 0) return _buildHeader(); + final startIndex = (currentPage - 1) * itemsPerPage; + final item = pageRows[index - 1]; + final sno = startIndex + index; + return _buildDataRow(item, sno); + }, + ), + ); + } - final int id = int.tryParse(p["policy_id"]?.toString() ?? "0") ?? 0; - final bool isSelected = selectedPolicies.contains(id); - return InkWell( - onTap: () { - setState(() { - isSelected - ? selectedPolicies.remove(id) - : selectedPolicies.add(id); - totalPolicies = selectedPolicies.length.toString(); - }); - _calculateTotalCommission(); - }, - child: Container( - height: 38, - padding: const EdgeInsets.symmetric(horizontal: 16), - decoration: BoxDecoration( - // const Color(0xFFE6F4EF) - color: isSelected ? const Color(0xFFF0FAF6) : Colors.white, - border: const Border( - bottom: BorderSide(color: Color(0xFFf9fafb)), - // bottom: BorderSide(color: Color(0xFFEDEDED)), + Widget _buildHeader() { + return const SizedBox.shrink(); + } + + Widget _buildDataRow(Map item, int sno) { + final int id = int.tryParse(item["policy_id"]?.toString() ?? "0") ?? 0; + final bool isSelected = selectedPolicies.contains(id); + return InkWell( + onTap: () { + setState(() { + isSelected ? selectedPolicies.remove(id) : selectedPolicies.add(id); + totalPolicies = selectedPolicies.length.toString(); + }); + _calculateTotalCommission(); + }, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 16), + decoration: BoxDecoration( + color: isSelected ? const Color(0xFFF0FAF6) : Colors.white, + border: const Border( + bottom: BorderSide(color: Color(0xFFEAEAEA), width: 1), + ), + borderRadius: BorderRadius.circular(8), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: _colCheck, + child: Center( + child: Checkbox( + value: isSelected, + onChanged: (v) { + setState(() { + v == true ? selectedPolicies.add(id) : selectedPolicies.remove(id); + totalPolicies = selectedPolicies.length.toString(); + }); + _calculateTotalCommission(); + }, ), ), - child: Row( - children: [ - SizedBox( - width: colCheck, - child: Checkbox( - value: isSelected, - onChanged: (v) { - setState(() { - v == true - ? selectedPolicies.add(id) - : selectedPolicies.remove(id); - totalPolicies = selectedPolicies.length.toString(); - }); - _calculateTotalCommission(); - }, - ), - ), - _cell( - '${startIndex + index + 1}', - colSno, - align: TextAlign.center, - ), - _cell(p["policy_no"], colPolicy), - // _cell(p["issued_date"] ?? "-", colDate), - _cell(_formatDate(p['issued_date']), colDate), - // _cell(p["agent_name"] ?? "-", colAgent), - _cell( - (p["agent_code"] != null && p["agent_name"] != null) - ? '${p["agent_code"]} - ${p["agent_name"]}' - : (p["agent_name"] ?? '-'), - colAgent, - ), - _cell(p["customer_name"], colCustomer), - _cell( - _amountText(p["premium_amount"]), - colPremium, - align: TextAlign.right, - ), - const SizedBox(width: 10), - SizedBox( - width: colCommission, - child: Row( - children: [ - Expanded( - child: _commissionAmountField( - p, - _commissionControllerFor(p), - ), - ), - ], - ), - ), - ], + ), + + Expanded( + flex: _flexSno, + child: Text( + '$sno', + textAlign: TextAlign.left, + style: _tableDataStyle, + overflow: TextOverflow.ellipsis, + maxLines: 2, ), ), - ); - }, + Expanded( + flex: _flexPolicy, + child: Text( + (item["policy_no"] ?? "-").toString(), + textAlign: TextAlign.left, + style: _tableDataStyle, + overflow: TextOverflow.ellipsis, + maxLines: 2, + ), + ), + Expanded( + flex: _flexDate, + child: Text( + _formatDate(item['issued_date']), + textAlign: TextAlign.left, + style: _tableDataStyle, + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + Expanded( + flex: _flexAgent, + child: Text( + (item["agent_code"] != null && item["agent_name"] != null) + ? '${item["agent_code"]} - ${item["agent_name"]}' + : (item["agent_name"] ?? '-'), + textAlign: TextAlign.left, + style: _tableDataStyle, + overflow: TextOverflow.ellipsis, + maxLines: 2, + ), + ), + Expanded( + flex: _flexCustomer, + child: Text( + (item["customer_name"] ?? "-").toString(), + textAlign: TextAlign.left, + style: _tableDataStyle, + overflow: TextOverflow.ellipsis, + maxLines: 2, + ), + ), + Expanded( + flex: _flexPremium, + child: Text( + _amountText(item["premium_amount"]), + textAlign: TextAlign.right, + style: _tableDataStyle, + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + SizedBox(width: 10), + Expanded( + flex: _flexCommission, + child: Align( + alignment: Alignment.centerRight, + child: ConstrainedBox( + constraints: const BoxConstraints( + minWidth: 76, + maxWidth: 112, + ), + child: _commissionAmountField( + item, + _commissionControllerFor(item), + ), + ), + ), + ), + ], + ), ), ); } @@ -1399,22 +1437,6 @@ class _PayOutDetailsState extends ConsumerState { } } - Widget _cell( - dynamic value, - double width, { - TextAlign align = TextAlign.left, - }) { - return SizedBox( - width: width, - child: Text( - (value ?? "-").toString(), - textAlign: align, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 11), - ), - ); - } - double _calculateTotalCommission() { print("ASD"); print(filteredPolicies); @@ -1519,6 +1541,17 @@ class _PayOutDetailsState extends ConsumerState { fontSize: 11, fontWeight: FontWeight.w500, ); + static final _tableDataStyle = GoogleFonts.inter( + fontSize: 12, + height: 1.4, + fontWeight: FontWeight.w400, + color: const Color(0xFF000000), + ); + static final _tableHeaderStyle = GoogleFonts.poppins( + fontSize: 11.2, + fontWeight: FontWeight.w500, + color: const Color(0xFF1E293B), + ); String _formatDate(String rawDate) { try { @@ -1526,28 +1559,16 @@ class _PayOutDetailsState extends ConsumerState { return DateFormat('dd-MM-yyyy').format(dateTime); // 24-hour format } catch (e) { return rawDate; // fallback if parsing fails - } + } } - static final double colCheck = 44; - static final double colSno = 60; - static final double colPolicy = 200; - static final double colDate = 200; - static final double colAgent = 400; - static final double colCustomer = 200; - static final double colPremium = 200; - static final double colPremiumPayoutGap = 10; - static final double colCommission = 150; - - double get _tableMinWidth => - colCheck + - colSno + - colPolicy + - colDate + - colAgent + - colCustomer + - colPremium + - colPremiumPayoutGap + - colCommission + - 32; + static const double _colCheck = 44; + /// Wider columns get more flex; narrow ids/dates get less to avoid empty middle gaps. + static const int _flexSno = 1; + static const int _flexPolicy = 2; + static const int _flexDate = 1; + static const int _flexAgent = 3; + static const int _flexCustomer = 3; + static const int _flexPremium = 1; + static const int _flexCommission = 1; } \ No newline at end of file diff --git a/lib/presentation/screens/payout/payout_details_view.dart b/lib/presentation/screens/payout/payout_details_view.dart index 50f7a31..bb2180b 100644 --- a/lib/presentation/screens/payout/payout_details_view.dart +++ b/lib/presentation/screens/payout/payout_details_view.dart @@ -183,28 +183,13 @@ class _PayOutDetailsViewState extends ConsumerState { return text.replaceAll('₹', '').trim(); } - List _columnWidths(double maxWidth) { - const sidePadding = 32.0; // 16 left + 16 right - final usable = (maxWidth - sidePadding).clamp(720.0, 2000.0); - const totalFlex = 2 + 14 + 10 + 20 + 16 + 11 + 11; - return [ - usable * (2 / totalFlex), // S.NO - usable * (14 / totalFlex), // POLICY NO - usable * (10 / totalFlex), // POLICY DATE - usable * (20 / totalFlex), // PARTNER - usable * (16 / totalFlex), // CUSTOMER - usable * (11 / totalFlex), // PREMIUM - usable * (11 / totalFlex), // PAYOUT - ]; - } - Widget _headerText( String text, - double width, { + int flex, { TextAlign align = TextAlign.left, }) { - return SizedBox( - width: width, + return Expanded( + flex: flex, child: Text( text, textAlign: align, @@ -220,13 +205,13 @@ class _PayOutDetailsViewState extends ConsumerState { Widget _cell( String? value, - double width, { + int flex, { TextAlign align = TextAlign.left, Color? color, FontWeight? fontWeight, }) { - return SizedBox( - width: width, + return Expanded( + flex: flex, child: Text( value ?? '-', textAlign: align, @@ -240,7 +225,7 @@ class _PayOutDetailsViewState extends ConsumerState { ); } - Widget _policyTableHeader(List w) { + Widget _policyTableHeader() { return Container( height: 30, padding: const EdgeInsets.symmetric(horizontal: 16), @@ -250,19 +235,19 @@ class _PayOutDetailsViewState extends ConsumerState { ), child: Row( children: [ - _headerText('S.NO', w[0]), - _headerText('POLICY NO', w[1]), - _headerText('POLICY DATE', w[2]), - _headerText('PARTNER', w[3]), - _headerText('CUSTOMER', w[4]), - _headerText('PREMIUM (₹)', w[5], align: TextAlign.right), - _headerText('PAYOUT (₹)', w[6], align: TextAlign.right), + _headerText('S.NO', 5, align: TextAlign.center), + _headerText('POLICY NO', 14), + _headerText('POLICY DATE', 10, align: TextAlign.center), + _headerText('PARTNER', 20), + _headerText('CUSTOMER', 16), + _headerText('PREMIUM (₹)', 11, align: TextAlign.right), + _headerText('PAYOUT (₹)', 11, align: TextAlign.right), ], ), ); } - Widget _policyRow(Map p, int index, List w) { + Widget _policyRow(Map p, int index) { return Container( height: 38, padding: const EdgeInsets.symmetric(horizontal: 16), @@ -272,24 +257,24 @@ class _PayOutDetailsViewState extends ConsumerState { ), child: Row( children: [ - _cell('${index + 1}', w[0]), - _cell(p['policy_no']?.toString(), w[1]), - _cell(_formatDate(p['issued_date']?.toString()), w[2]), + _cell('${index + 1}', 5, align: TextAlign.center), + _cell(p['policy_no']?.toString(), 14), + _cell(_formatDate(p['issued_date']?.toString()), 10, align: TextAlign.center), _cell( (p['agent_code'] != null && p['agent_name'] != null) ? '${p['agent_code']} - ${p['agent_name']}' : (p['agent_name'] ?? '-').toString(), - w[3], + 20, ), - _cell(p['customer_name']?.toString(), w[4]), + _cell(p['customer_name']?.toString(), 16), _cell( _amountText(p['premium_amount']), - w[5], + 11, align: TextAlign.right, ), _cell( _amountText(p['commission_amount']), - w[6], + 11, align: TextAlign.right, color: const Color(0xFF009B77), fontWeight: FontWeight.w600, @@ -350,9 +335,9 @@ class _PayOutDetailsViewState extends ConsumerState { : Container( color: Colors.white, padding: const EdgeInsets.all(8), - margin: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * 0.1, - ), + // margin: EdgeInsets.symmetric( + // horizontal: MediaQuery.of(context).size.width * 0.1, + // ), child: Column( children: [ SizedBox( @@ -468,7 +453,6 @@ class _PayOutDetailsViewState extends ConsumerState { ), child: LayoutBuilder( builder: (context, constraints) { - final widths = _columnWidths(constraints.maxWidth); final rows = _paginatedPolicies; final startIdx = (filteredPolicies.isEmpty) ? 0 @@ -476,7 +460,7 @@ class _PayOutDetailsViewState extends ConsumerState { return Column( children: [ - _policyTableHeader(widths), + _policyTableHeader(), Expanded( child: filteredPolicies.isEmpty ? const Center( @@ -494,7 +478,6 @@ class _PayOutDetailsViewState extends ConsumerState { return _policyRow( rows[index], startIdx + index, - widths, ); }, ), diff --git a/lib/presentation/themes/indicators/date_range_picker_dialog.dart b/lib/presentation/themes/indicators/date_range_picker_dialog.dart index 1d840a2..aff0467 100644 --- a/lib/presentation/themes/indicators/date_range_picker_dialog.dart +++ b/lib/presentation/themes/indicators/date_range_picker_dialog.dart @@ -1,52 +1,99 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:intl/intl.dart'; +import 'dart:math' as math; -/// Compact date-range dialog (centered card, not full-screen on web). -/// From/To header, month navigation, range highlight, Cancel / Apply. +/// Date-range dialog with quick presets (Today, Yesterday, Month, Custom Range), +/// dual-month calendar, and Apply / Clear. Future showCompactDateRangePicker({ required BuildContext context, required DateTime firstDate, required DateTime lastDate, DateTimeRange? initialRange, }) { - return showDialog( + final box = context.findRenderObject(); + final screenSize = MediaQuery.sizeOf(context); + const margin = 12.0; + const gap = 6.0; + + var left = margin; + var top = margin; + var popupWidth = math.min(720.0, screenSize.width - (margin * 2)); + + if (box is RenderBox) { + final offset = box.localToGlobal(Offset.zero); + final fieldSize = box.size; + popupWidth = math.min(720.0, screenSize.width - (margin * 2)); + left = offset.dx.clamp(margin, screenSize.width - popupWidth - margin); + top = (offset.dy + fieldSize.height + gap) + .clamp(margin, screenSize.height - margin); + } + + return showGeneralDialog( context: context, barrierDismissible: true, - builder: (ctx) => _CompactDateRangeDialog( - firstDate: DateTime(firstDate.year, firstDate.month, firstDate.day), - lastDate: DateTime(lastDate.year, lastDate.month, lastDate.day), - initialRange: initialRange, - ), + barrierLabel: 'Close', + useRootNavigator: true, + barrierColor: Colors.transparent, + pageBuilder: (ctx, animation, secondaryAnimation) { + return Stack( + children: [ + Positioned( + left: left, + top: top, + child: _CompactDateRangeDialog( + firstDate: DateTime(firstDate.year, firstDate.month, firstDate.day), + lastDate: DateTime(lastDate.year, lastDate.month, lastDate.day), + initialRange: initialRange, + maxWidth: popupWidth, + ), + ), + ], + ); + }, + transitionBuilder: (ctx, animation, secondaryAnimation, child) { + final curved = CurvedAnimation(parent: animation, curve: Curves.easeOutCubic); + return FadeTransition( + opacity: curved, + child: child, + ); + }, ); } +enum _QuickPreset { today, yesterday, month, custom } + class _CompactDateRangeDialog extends StatefulWidget { const _CompactDateRangeDialog({ required this.firstDate, required this.lastDate, this.initialRange, + required this.maxWidth, }); final DateTime firstDate; final DateTime lastDate; final DateTimeRange? initialRange; + final double maxWidth; @override State<_CompactDateRangeDialog> createState() => _CompactDateRangeDialogState(); } class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { - static const _primary = Color(0xFF2E7D6E); - static const _primaryLight = Color(0xFFE6F4F1); static const _muted = Color(0xFF64748B); + Color get _primary => Theme.of(context).colorScheme.primary; + Color get _primaryLight => _primary.withValues(alpha: 0.14); + Color get _sidebarSelected => _primary; late DateTime _focusedMonth; DateTime? _start; DateTime? _end; + _QuickPreset _preset = _QuickPreset.custom; final _headerFrom = DateFormat('EEE, dd MMM'); final _headerMonth = DateFormat('MMMM yyyy'); + final _footerRange = DateFormat('dd/MM/yyyy'); @override void initState() { @@ -56,6 +103,7 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { _start = DateTime(ir.start.year, ir.start.month, ir.start.day); _end = DateTime(ir.end.year, ir.end.month, ir.end.day); _focusedMonth = DateTime(_start!.year, _start!.month, 1); + _preset = _QuickPreset.custom; } else { final now = DateTime.now(); final n = DateTime(now.year, now.month, now.day); @@ -94,6 +142,7 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { if (d.isBefore(widget.firstDate) || d.isAfter(widget.lastDate)) return; setState(() { + _preset = _QuickPreset.custom; if (_start == null || (_start != null && _end != null)) { _start = d; _end = null; @@ -108,14 +157,68 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { }); } + void _clampToBounds(DateTime s, DateTime e) { + var s0 = _norm(s); + var e0 = _norm(e); + if (s0.isBefore(widget.firstDate)) s0 = widget.firstDate; + if (e0.isAfter(widget.lastDate)) e0 = widget.lastDate; + if (s0.isAfter(e0)) e0 = s0; + _start = s0; + _end = e0; + } + + void _setToday() { + final n = DateTime.now(); + final d = DateTime(n.year, n.month, n.day); + setState(() { + _preset = _QuickPreset.today; + _clampToBounds(d, d); + _focusedMonth = DateTime(d.year, d.month, 1); + }); + } + + void _setYesterday() { + final n = DateTime.now().subtract(const Duration(days: 1)); + final d = DateTime(n.year, n.month, n.day); + setState(() { + _preset = _QuickPreset.yesterday; + _clampToBounds(d, d); + _focusedMonth = DateTime(d.year, d.month, 1); + }); + } + + void _setThisMonth() { + final n = DateTime.now(); + final start = DateTime(n.year, n.month, 1); + final end = DateTime(n.year, n.month + 1, 0); + setState(() { + _preset = _QuickPreset.month; + _clampToBounds(start, end); + _focusedMonth = DateTime(n.year, n.month, 1); + }); + } + + void _setCustomMode() { + setState(() => _preset = _QuickPreset.custom); + } + + void _clear() { + setState(() { + _start = null; + _end = null; + _preset = _QuickPreset.custom; + }); + } + bool get _canPrev { final lastOfPrevMonth = DateTime(_focusedMonth.year, _focusedMonth.month, 0); return !lastOfPrevMonth.isBefore(widget.firstDate); } + /// Right panel shows month after [_focusedMonth]; allow next if that month's last day is not past [lastDate]. bool get _canNext { - final firstOfNextMonth = DateTime(_focusedMonth.year, _focusedMonth.month + 1, 1); - return !firstOfNextMonth.isAfter(widget.lastDate); + final lastOfRightMonth = DateTime(_focusedMonth.year, _focusedMonth.month + 2, 0); + return !lastOfRightMonth.isAfter(widget.lastDate); } void _prevMonth() { @@ -132,23 +235,24 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { }); } - List _calendarCells() { - final first = DateTime(_focusedMonth.year, _focusedMonth.month, 1); - final daysInMonth = DateTime(_focusedMonth.year, _focusedMonth.month + 1, 0).day; - final leading = first.weekday - 1; + /// Sunday-first week grid cells for [month] (first day of month). + List _calendarCellsForMonth(DateTime monthFirst) { + final first = DateTime(monthFirst.year, monthFirst.month, 1); + final daysInMonth = DateTime(monthFirst.year, monthFirst.month + 1, 0).day; + final leading = first.weekday % 7; final cells = []; - final prevEnd = DateTime(_focusedMonth.year, _focusedMonth.month, 0); + final prevEnd = DateTime(monthFirst.year, monthFirst.month, 0); for (int i = 0; i < leading; i++) { final dayNum = prevEnd.day - leading + i + 1; cells.add(DateTime(prevEnd.year, prevEnd.month, dayNum)); } for (int d = 1; d <= daysInMonth; d++) { - cells.add(DateTime(_focusedMonth.year, _focusedMonth.month, d)); + cells.add(DateTime(monthFirst.year, monthFirst.month, d)); } var next = 1; while (cells.length % 7 != 0 || cells.length < 42) { - cells.add(DateTime(_focusedMonth.year, _focusedMonth.month + 1, next)); + cells.add(DateTime(monthFirst.year, monthFirst.month + 1, next)); next++; } return cells; @@ -163,8 +267,8 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { Navigator.of(context).pop(DateTimeRange(start: _start!, end: end)); } - Widget _dayCell(DateTime d) { - final inMonth = d.month == _focusedMonth.month; + Widget _dayCell(DateTime d, DateTime monthForGrid) { + final inMonth = d.month == monthForGrid.month && d.year == monthForGrid.year; final disabled = d.isBefore(widget.firstDate) || d.isAfter(widget.lastDate); @@ -173,7 +277,7 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { child: Text( '${d.day}', style: GoogleFonts.inter( - fontSize: 13, + fontSize: 12, color: const Color(0xFF94A3B8), fontWeight: FontWeight.w500, ), @@ -209,8 +313,8 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { ), alignment: Alignment.center, child: Container( - width: 36, - height: 36, + width: 32, + height: 32, alignment: Alignment.center, decoration: BoxDecoration( shape: BoxShape.circle, @@ -222,7 +326,7 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { child: Text( '${d.day}', style: GoogleFonts.inter( - fontSize: 13, + fontSize: 12, fontWeight: (isStart || isEnd) ? FontWeight.w700 : FontWeight.w500, color: disabled @@ -237,210 +341,331 @@ class _CompactDateRangeDialogState extends State<_CompactDateRangeDialog> { ); } - @override - Widget build(BuildContext context) { - final cells = _calendarCells(); - - return Dialog( - insetPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 24), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), - clipBehavior: Clip.antiAlias, - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 400), - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - IconButton( - icon: const Icon(Icons.close, size: 22), - color: _muted, - onPressed: () => Navigator.of(context).pop(), - visualDensity: VisualDensity.compact, - ), - ], - ), - Container( - decoration: BoxDecoration( - color: const Color(0xFFF8FAFC), - borderRadius: BorderRadius.circular(12), - border: Border.all(color: const Color(0xFFE2E8F0)), - ), - child: Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12, horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'From', - style: GoogleFonts.inter( - fontSize: 11, - color: _muted, - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 4), - Text( - _start != null - ? _headerFrom.format(_start!) - : '—', - style: GoogleFonts.inter( - fontSize: 14, - fontWeight: FontWeight.w700, - color: const Color(0xFF0F172A), - ), - ), - ], - ), - ), - ), - Container( - width: 1, height: 52, color: const Color(0xFFE2E8F0)), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - vertical: 12, horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'To', - style: GoogleFonts.inter( - fontSize: 11, - color: _muted, - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 4), - Text( - _start != null - ? _headerFrom.format(_end ?? _start!) - : '—', - style: GoogleFonts.inter( - fontSize: 14, - fontWeight: FontWeight.w700, - color: const Color(0xFF0F172A), - ), - ), - ], - ), - ), - ), - ], - ), - ), - const SizedBox(height: 14), - Row( - children: [ - IconButton( - onPressed: _canPrev ? _prevMonth : null, - icon: const Icon(Icons.chevron_left), - color: _primary, - ), - Expanded( + Widget _monthPanel(DateTime monthFirst) { + final cells = _calendarCellsForMonth(monthFirst); + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 6), + child: Text( + _headerMonth.format(monthFirst), + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: 13, + fontWeight: FontWeight.w600, + color: const Color(0xFF1E293B), + ), + ), + ), + Row( + children: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] + .map( + (w) => Expanded( + child: Center( child: Text( - _headerMonth.format(_focusedMonth), - textAlign: TextAlign.center, - style: GoogleFonts.poppins( - fontSize: 15, + w, + style: GoogleFonts.inter( + fontSize: 10, fontWeight: FontWeight.w600, - color: const Color(0xFF1E293B), + color: _primary, ), ), ), - IconButton( - onPressed: _canNext ? _nextMonth : null, - icon: const Icon(Icons.chevron_right), - color: _primary, - ), - ], - ), - const SizedBox(height: 6), - Row( - children: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] - .map( - (w) => Expanded( - child: Center( - child: Text( - w, - style: GoogleFonts.inter( - fontSize: 11, - fontWeight: FontWeight.w600, - color: _primary, - ), - ), - ), - ), - ) - .toList(), - ), - const SizedBox(height: 6), - GridView.builder( - shrinkWrap: true, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 7, - mainAxisSpacing: 2, - crossAxisSpacing: 2, - childAspectRatio: 1.05, ), - itemCount: cells.length, - itemBuilder: (context, i) => _dayCell(cells[i]), - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: OutlinedButton( - onPressed: () => Navigator.of(context).pop(), - style: OutlinedButton.styleFrom( - foregroundColor: _primary, - side: const BorderSide(color: _primary), - padding: const EdgeInsets.symmetric(vertical: 12), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(24), - ), - ), - child: Text( - 'Cancel', - style: - GoogleFonts.poppins(fontWeight: FontWeight.w600), - ), - ), - ), - const SizedBox(width: 12), - Expanded( - child: FilledButton( - onPressed: _start != null ? _apply : null, - style: FilledButton.styleFrom( - backgroundColor: _primary, - disabledBackgroundColor: const Color(0xFFCBD5E1), - padding: const EdgeInsets.symmetric(vertical: 12), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(24), - ), - ), - child: Text( - 'Apply', - style: GoogleFonts.poppins( - fontWeight: FontWeight.w600, - color: Colors.white, - ), - ), - ), - ), - ], - ), - ], + ) + .toList(), + ), + const SizedBox(height: 4), + GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 7, + mainAxisSpacing: 2, + crossAxisSpacing: 2, + childAspectRatio: 1.05, + ), + itemCount: cells.length, + itemBuilder: (context, i) => _dayCell(cells[i], monthFirst), + ), + ], + ); + } + + Widget _sidebarItem(String label, _QuickPreset preset, VoidCallback onTap) { + final selected = _preset == preset; + return Material( + color: Colors.transparent, + child: InkWell( + onTap: () { + if (preset == _QuickPreset.custom) { + _setCustomMode(); + } else { + onTap(); + } + }, + borderRadius: BorderRadius.circular(8), + child: Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 10), + decoration: BoxDecoration( + color: selected ? _sidebarSelected : Colors.transparent, + borderRadius: BorderRadius.circular(8), + ), + child: Text( + label, + style: GoogleFonts.inter( + fontSize: 13, + fontWeight: selected ? FontWeight.w600 : FontWeight.w500, + color: selected ? Colors.white : const Color(0xFF334155), + ), ), ), ), ); } + + @override + Widget build(BuildContext context) { + final leftMonth = _focusedMonth; + final rightMonth = DateTime(_focusedMonth.year, _focusedMonth.month + 1, 1); + + return Material( + color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: const [ + BoxShadow( + color: Color(0x26000000), + blurRadius: 20, + offset: Offset(0, 8), + ), + ], + ), + child: ConstrainedBox( + constraints: BoxConstraints( + maxWidth: widget.maxWidth, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 148, + color: const Color(0xFFF8FAFC), + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 10), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + 'Quick select', + style: GoogleFonts.inter( + fontSize: 11, + fontWeight: FontWeight.w600, + color: _muted, + ), + ), + const SizedBox(height: 8), + _sidebarItem('Today', _QuickPreset.today, _setToday), + _sidebarItem('Yesterday', _QuickPreset.yesterday, _setYesterday), + _sidebarItem('Month', _QuickPreset.month, _setThisMonth), + _sidebarItem('Custom Range', _QuickPreset.custom, _setCustomMode), + ], + ), + ), + const VerticalDivider(width: 1, thickness: 1, color: Color(0xFFE2E8F0)), + Expanded( + child: Padding( + padding: const EdgeInsets.fromLTRB(12, 8, 12, 12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + IconButton( + icon: const Icon(Icons.close, size: 22), + color: _muted, + onPressed: () => Navigator.of(context).pop(), + visualDensity: VisualDensity.compact, + ), + ], + ), + Container( + decoration: BoxDecoration( + color: const Color(0xFFF8FAFC), + borderRadius: BorderRadius.circular(12), + border: Border.all(color: const Color(0xFFE2E8F0)), + ), + child: Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'From', + style: GoogleFonts.inter( + fontSize: 11, + color: _muted, + fontWeight: FontWeight.w500, + ), + ), + const SizedBox(height: 4), + Text( + _start != null + ? _headerFrom.format(_start!) + : '—', + style: GoogleFonts.inter( + fontSize: 14, + fontWeight: FontWeight.w700, + color: const Color(0xFF0F172A), + ), + ), + ], + ), + ), + ), + Container( + width: 1, + height: 52, + color: const Color(0xFFE2E8F0)), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'To', + style: GoogleFonts.inter( + fontSize: 11, + color: _muted, + fontWeight: FontWeight.w500, + ), + ), + const SizedBox(height: 4), + Text( + _start != null + ? _headerFrom.format(_end ?? _start!) + : '—', + style: GoogleFonts.inter( + fontSize: 14, + fontWeight: FontWeight.w700, + color: const Color(0xFF0F172A), + ), + ), + ], + ), + ), + ), + ], + ), + ), + const SizedBox(height: 10), + Row( + children: [ + IconButton( + onPressed: _canPrev ? _prevMonth : null, + icon: const Icon(Icons.chevron_left), + color: _primary, + ), + Expanded( + child: Text( + '${_headerMonth.format(leftMonth)} – ${_headerMonth.format(rightMonth)}', + textAlign: TextAlign.center, + style: GoogleFonts.poppins( + fontSize: 14, + fontWeight: FontWeight.w600, + color: const Color(0xFF1E293B), + ), + ), + ), + IconButton( + onPressed: _canNext ? _nextMonth : null, + icon: const Icon(Icons.chevron_right), + color: _primary, + ), + ], + ), + const SizedBox(height: 8), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: _monthPanel(leftMonth)), + const SizedBox(width: 12), + Expanded(child: _monthPanel(rightMonth)), + ], + ), + const SizedBox(height: 12), + Container( + padding: const EdgeInsets.symmetric( + vertical: 10, horizontal: 12), + decoration: BoxDecoration( + color: const Color(0xFFF1F5F9), + borderRadius: BorderRadius.circular(8), + ), + child: Row( + children: [ + Expanded( + child: Text( + _start != null + ? '${_footerRange.format(_start!)} - ${_footerRange.format(_end ?? _start!)}' + : 'Select a range', + style: GoogleFonts.inter( + fontSize: 13, + fontWeight: FontWeight.w600, + color: const Color(0xFF0F172A), + ), + ), + ), + TextButton( + onPressed: _clear, + child: Text( + 'Clear', + style: GoogleFonts.poppins( + fontWeight: FontWeight.w600, + color: _muted, + ), + ), + ), + const SizedBox(width: 8), + FilledButton( + onPressed: _start != null ? _apply : null, + style: FilledButton.styleFrom( + backgroundColor: _sidebarSelected, + disabledBackgroundColor: const Color(0xFFCBD5E1), + padding: const EdgeInsets.symmetric( + horizontal: 20, vertical: 10), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + child: Text( + 'Apply', + style: GoogleFonts.poppins( + fontWeight: FontWeight.w600, + color: Colors.white, + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + } }