diff --git a/.DS_Store b/.DS_Store index cd2f32f..fd653c8 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index f935546..432fcdc 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -37,6 +37,12 @@ "packageUri": "lib/", "languageVersion": "3.2" }, + { + "name": "blur", + "rootUri": "file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/blur-4.0.0", + "packageUri": "lib/", + "languageVersion": "3.4" + }, { "name": "boolean_selector", "rootUri": "file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1", @@ -998,7 +1004,7 @@ "languageVersion": "3.4" } ], - "generated": "2025-03-18T13:17:38.535876Z", + "generated": "2025-03-20T12:51:19.355653Z", "generator": "pub", "generatorVersion": "3.4.4", "flutterRoot": "file:///Users/rajeevsingh/Documents/allSoftwares/flutter", diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index 821f9f6..4f5ad02 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -22,6 +22,10 @@ back_button_interceptor 3.2 file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/back_button_interceptor-8.0.4/ file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/back_button_interceptor-8.0.4/lib/ +blur +3.4 +file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/blur-4.0.0/ +file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/blur-4.0.0/lib/ boolean_selector 2.17 file:///Users/rajeevsingh/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 320a5ef..f5a8b6c 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/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geocoding_ios-3.0.1/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/","native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12+2/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.0.13/","native_build":true,"dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.22/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geocoding_android-3.3.1/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_api_headers","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_api_headers-1.6.0/","native_build":true,"dependencies":["package_info_plus"]},{"name":"google_maps_flutter_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.7/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_android-2.2.10/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_android-2.3.2/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4+2/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.0.11/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+2/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":false,"dependencies":[]},{"name":"file_selector_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.3+2/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+3/","native_build":true,"dependencies":[]},{"name":"geolocator_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","dependencies":[]},{"name":"flutter_inappwebview_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.0.8/","dependencies":[]},{"name":"fluttertoast","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","dependencies":[]},{"name":"geolocator_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.6/","dependencies":[]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_web-2.3.3/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"geocoding","dependencies":["geocoding_android","geocoding_ios"]},{"name":"geocoding_android","dependencies":[]},{"name":"geocoding_ios","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_api_headers","dependencies":["package_info_plus"]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios","google_maps_flutter_web"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]},{"name":"google_maps_flutter_web","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"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":"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":"sqflite","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":"2025-03-18 18:47:38.768972","version":"3.22.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.0.13/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geocoding_ios-3.0.1/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/","native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12+2/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.0.13/","native_build":true,"dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.22/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geocoding_android-3.3.1/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_api_headers","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_api_headers-1.6.0/","native_build":true,"dependencies":["package_info_plus"]},{"name":"google_maps_flutter_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.7/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_android-2.2.10/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_android-2.3.2/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.9/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4+2/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.0.11/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+2/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/sqflite-2.3.3+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":false,"dependencies":[]},{"name":"file_selector_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.3+2/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+3/","native_build":true,"dependencies":[]},{"name":"geolocator_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","dependencies":[]},{"name":"flutter_inappwebview_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.0.8/","dependencies":[]},{"name":"fluttertoast","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","dependencies":[]},{"name":"geolocator_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.6/","dependencies":[]},{"name":"package_info_plus","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/rajeevsingh/.pub-cache/hosted/pub.dev/url_launcher_web-2.3.3/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":[]},{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"geocoding","dependencies":["geocoding_android","geocoding_ios"]},{"name":"geocoding_android","dependencies":[]},{"name":"geocoding_ios","dependencies":[]},{"name":"geolocator","dependencies":["geolocator_android","geolocator_apple","geolocator_web","geolocator_windows"]},{"name":"geolocator_android","dependencies":[]},{"name":"geolocator_apple","dependencies":[]},{"name":"geolocator_web","dependencies":[]},{"name":"geolocator_windows","dependencies":[]},{"name":"google_api_headers","dependencies":["package_info_plus"]},{"name":"google_maps_flutter","dependencies":["google_maps_flutter_android","google_maps_flutter_ios","google_maps_flutter_web"]},{"name":"google_maps_flutter_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_maps_flutter_ios","dependencies":[]},{"name":"google_maps_flutter_web","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"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":"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":"sqflite","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":"2025-03-20 18:21:19.587229","version":"3.22.3"} \ No newline at end of file diff --git a/lib/src/core/constant/api.dart b/lib/src/core/constant/api.dart index c59474a..3444858 100644 --- a/lib/src/core/constant/api.dart +++ b/lib/src/core/constant/api.dart @@ -12,6 +12,7 @@ class APIURL { static const String getBestDealProduct = "${BASE_URL}products/best-deals"; static const String getAllcategory = "${BASE_URL}categories"; static const String addToWish = "${BASE_URL}carts/wishlist/items"; + static const String getSubcategory = "${BASE_URL}categories/by-level/2"; static const String deleteToWish = "${BASE_URL}carts/wishlist/items"; static const String addToCart = "${BASE_URL}carts/items"; static const String gettAllWishList = "${BASE_URL}carts/wishlist"; @@ -31,8 +32,7 @@ class APIURL { static const String offerCoupon = "${BASE_URL}coupons"; static const String applyCoupon = "${BASE_URL}coupons/validate"; static const String forgetPassword = "${BASE_URL}auth/forgot-password/vendor"; - static const String verifyForgetPassword = - "${BASE_URL}auth/forgot-password-verify-otp/vendor"; + static const String verifyForgetPassword = "${BASE_URL}auth/forgot-password-verify-otp/vendor"; static const String reset_password = "${BASE_URL}auth/reset-password/vendor"; static const String getProduct = "${BASE_URL}products"; @@ -45,8 +45,9 @@ class APIURL { static const String updateProduct = "${BASE_URL}products/"; - static const String getAssignedOtp = - "${BASE_URL}delivery/customer-otp"; + static const String getAssignedOtp ="${BASE_URL}delivery/customer-otp"; static const String updateStatus = "${BASE_URL}orders/items/"; + + } diff --git a/lib/src/core/utils/custom_dio_exception.dart b/lib/src/core/utils/custom_dio_exception.dart index 7375454..5fbfe1e 100644 --- a/lib/src/core/utils/custom_dio_exception.dart +++ b/lib/src/core/utils/custom_dio_exception.dart @@ -1,84 +1,15 @@ -import 'package:dio/dio.dart'; - -import 'package:dio/dio.dart'; - -import 'package:dio/dio.dart'; -import 'package:grocery_app/src/core/utils/response_type_def.dart'; - -class CustomDioExceptions implements Exception { - late String message; - - CustomDioExceptions.fromDioException(DioException dioException) { - switch (dioException.type) { - case DioExceptionType.cancel: - message = "Request to API server was cancelled"; - break; - case DioExceptionType.connectionTimeout: - message = "Connection timeout with API server"; - break; - case DioExceptionType.receiveTimeout: - message = "Receive timeout in connection with API server"; - break; - case DioExceptionType.badResponse: - message = _handleStatusError( - dioException.response?.statusCode, - dioException.response?.data, - ); - break; - case DioExceptionType.sendTimeout: - message = "Send timeout in connection with API server"; - break; - case DioExceptionType.unknown: - message = "Unexpected error occurred"; - break; - default: - message = "Something went wrong"; - break; - } - } - - String _handleStatusError(int? statusCode, dynamic error) { - switch (statusCode) { - case 400: - return error["message"] ?? 'Bad request'; - case 401: - return error["message"] ?? 'Unauthorized'; - case 403: - return error["message"] ?? 'Forbidden'; - case 404: - return error["message"] ?? 'Not Found'; - case 422: - return error["message"] ?? 'Cannot proceed with the data provided.'; - case 406: - return error["message"] ?? 'Input Mismatched'; - case 500: - return error["message"] ?? 'Internal server error'; - case 502: - return error["message"] ?? 'Bad gateway'; - default: - return error["message"] ?? 'Oops something went wrong'; - } - } - - /// Handle the error and return a `CustomError` - static CustomError handleError(DioException e) { - final errorMessage = CustomDioExceptions.fromDioException(e).toString(); - return CustomError(errorMessage, e.response?.statusCode); - } - - @override - String toString() => message; -} - +// import 'package:dio/dio.dart'; +// import 'package:dio/dio.dart'; +// import 'package:dio/dio.dart'; +// import 'package:grocery_app/src/core/utils/response_type_def.dart'; // class CustomDioExceptions implements Exception { // late String message; // CustomDioExceptions.fromDioException(DioException dioException) { -// switch (dioException.type) -// { +// switch (dioException.type) { // case DioExceptionType.cancel: // message = "Request to API server was cancelled"; // break; @@ -117,7 +48,7 @@ class CustomDioExceptions implements Exception { // case 404: // return error["message"] ?? 'Not Found'; // case 422: -// return error["message"] ?? 'Can not proceed with the data provided.'; +// return error["message"] ?? 'Cannot proceed with the data provided.'; // case 406: // return error["message"] ?? 'Input Mismatched'; // case 500: @@ -129,14 +60,242 @@ class CustomDioExceptions implements Exception { // } // } -// /// call this method from api repo to handle the error -// static CustomError handleError(DioException e) -// { +// /// Handle the error and return a `CustomError` +// static CustomError handleError(DioException e) { // final errorMessage = CustomDioExceptions.fromDioException(e).toString(); - // return CustomError(errorMessage, e.response?.statusCode); // } // @override // String toString() => message; // } + + + +// import 'package:dio/dio.dart'; +// import 'package:vendor_app/src/core/utiils_lib/response_type_def.dart'; +// import 'package:dio/dio.dart'; + +// import 'package:dio/dio.dart'; + +// class CustomDioExceptions implements Exception { +// late String message; + +// CustomDioExceptions.fromDioException(DioException dioException) { +// switch (dioException.type) { +// case DioExceptionType.cancel: +// message = "Request to API server was cancelled"; +// break; +// case DioExceptionType.connectionTimeout: +// message = "Connection timeout with API server"; +// break; +// case DioExceptionType.receiveTimeout: +// message = "Receive timeout in connection with API server"; +// break; +// case DioExceptionType.badResponse: +// message = _handleStatusError( +// dioException.response?.statusCode, +// dioException.response?.data, +// ); +// break; +// case DioExceptionType.sendTimeout: +// message = "Send timeout in connection with API server"; +// break; +// case DioExceptionType.unknown: +// message = "Unexpected error occurred"; +// break; +// default: +// message = "Something went wrong"; +// break; +// } +// } + +// String _handleStatusError(int? statusCode, dynamic error) +// { +// switch (statusCode) { +// case 400: +// return error["message"] ?? 'Bad request'; +// case 401: +// return error["message"] ?? 'Unauthorized'; +// case 403: +// return error["message"] ?? 'Forbidden'; +// case 404: +// return error["message"] ?? 'Not Found'; +// case 422: +// return error["message"] ?? 'Cannot proceed with the data provided.'; +// case 406: +// return error["message"] ?? 'Input Mismatched'; +// case 500: +// return error["message"] ?? 'Internal server error'; +// case 502: +// return error["message"] ?? 'Bad gateway'; +// default: +// return error["message"] ?? 'Oops something went wrong'; +// } +// } + +// /// Handle the error and return a `CustomError` +// static CustomError handleError(DioException e) { +// final errorMessage = CustomDioExceptions.fromDioException(e).toString(); +// return CustomError(errorMessage, e.response?.statusCode); +// } + +// @override +// String toString() => message; +// } + +// // class CustomDioExceptions implements Exception { +// // late String message; + +// // CustomDioExceptions.fromDioException(DioException dioException) { +// // switch (dioException.type) +// // { +// // case DioExceptionType.cancel: +// // message = "Request to API server was cancelled"; +// // break; +// // case DioExceptionType.connectionTimeout: +// // message = "Connection timeout with API server"; +// // break; +// // case DioExceptionType.receiveTimeout: +// // message = "Receive timeout in connection with API server"; +// // break; +// // case DioExceptionType.badResponse: +// // message = _handleStatusError( +// // dioException.response?.statusCode, +// // dioException.response?.data, +// // ); +// // break; +// // case DioExceptionType.sendTimeout: +// // message = "Send timeout in connection with API server"; +// // break; +// // case DioExceptionType.unknown: +// // message = "Unexpected error occurred"; +// // break; +// // default: +// // message = "Something went wrong"; +// // break; +// // } +// // } + +// // String _handleStatusError(int? statusCode, dynamic error) { +// // switch (statusCode) { +// // case 400: +// // return error["message"] ?? 'Bad request'; +// // case 401: +// // return error["message"] ?? 'Unauthorized'; +// // case 403: +// // return error["message"] ?? 'Forbidden'; +// // case 404: +// // return error["message"] ?? 'Not Found'; +// // case 422: +// // return error["message"] ?? 'Can not proceed with the data provided.'; +// // case 406: +// // return error["message"] ?? 'Input Mismatched'; +// // case 500: +// // return error["message"] ?? 'Internal server error'; +// // case 502: +// // return error["message"] ?? 'Bad gateway'; +// // default: +// // return error["message"] ?? 'Oops something went wrong'; +// // } +// // } + +// // /// call this method from api repo to handle the error +// // static CustomError handleError(DioException e) +// // { +// // final errorMessage = CustomDioExceptions.fromDioException(e).toString(); + +// // return CustomError(errorMessage, e.response?.statusCode); +// // } + +// // @override +// // String toString() => message; +// // } +import 'package:dio/dio.dart'; +import 'package:grocery_app/src/core/utils/response_type_def.dart'; + + +class CustomDioExceptions implements Exception { + late String message; + + CustomDioExceptions.fromDioException(DioException dioException) { + switch (dioException.type) { + case DioExceptionType.cancel: + message = "Request to API server was cancelled"; + break; + case DioExceptionType.connectionTimeout: + message = "Connection timeout with API server"; + break; + case DioExceptionType.receiveTimeout: + message = "Receive timeout in connection with API server"; + break; + case DioExceptionType.badResponse: + message = _handleStatusError( + dioException.response?.statusCode, + dioException.response?.data, + ); + break; + case DioExceptionType.sendTimeout: + message = "Send timeout in connection with API server"; + break; + case DioExceptionType.unknown: + message = "Unexpected error occurred"; + break; + default: + message = "Something went wrong"; + break; + } + } + + String _handleStatusError(int? statusCode, dynamic error) { + if (error is Map) { + // Extract the actual message inside the response + final errorMessage = error["message"]; + if (errorMessage is Map) { + return errorMessage["message"] ?? "Unknown error"; + } + return errorMessage ?? "Unknown error"; + } + + switch (statusCode) { + case 400: + return 'Bad request'; + case 401: + return 'Unauthorized'; + case 403: + return 'Forbidden'; + case 404: + return 'Not Found'; + case 422: + return 'Cannot proceed with the data provided.'; + case 406: + return 'Input Mismatched'; + case 500: + return 'Internal server error'; + case 502: + return 'Bad gateway'; + default: + return 'Oops something went wrong'; + } + } + + // final int statusCode; + // final String message; + // final String? error; + + static CustomError handleError(DioException e) { + final errorMessage = CustomDioExceptions.fromDioException(e).toString(); + + return CustomError( + statusCode: e.response?.statusCode ?? 0, + message: errorMessage, + error: e.message); + } + + @override + String toString() => message; +} + + + + diff --git a/lib/src/core/utils/response_type_def.dart b/lib/src/core/utils/response_type_def.dart index bda390a..5aa396c 100644 --- a/lib/src/core/utils/response_type_def.dart +++ b/lib/src/core/utils/response_type_def.dart @@ -1,10 +1,34 @@ +// import 'package:fpdart/fpdart.dart'; + +// typedef FutureResult = Future>; +// typedef VoidResult = Future>; + +// class CustomError { +// final String message; +// final int? code; +// CustomError(this.message, this.code); +// } + + import 'package:fpdart/fpdart.dart'; typedef FutureResult = Future>; typedef VoidResult = Future>; class CustomError { + final int statusCode; final String message; - final int? code; - CustomError(this.message, this.code); + final String? error; // Optional field for additional error details + + CustomError({required this.statusCode, required this.message, this.error}); + + factory CustomError.fromJson(Map json) { + return CustomError( + statusCode: json['statusCode'] ?? 0, + message: json['message'] is Map + ? json['message']['message'] ?? "Unknown error" + : json['message'].toString(), + error: json['message'] is Map ? json['message']['error'] : null, + ); + } } diff --git a/lib/src/data/ProductCategoryModel.dart b/lib/src/data/ProductCategoryModel.dart new file mode 100644 index 0000000..ed47e21 --- /dev/null +++ b/lib/src/data/ProductCategoryModel.dart @@ -0,0 +1,162 @@ +// // To parse this JSON data, do +// // +// // final productCategoryModel = productCategoryModelFromJson(jsondynamic); + +// import 'dart:convert'; + +// List productCategoryModelFromJson(dynamic str) => List.from(json.decode(str).map((x) => ProductCategoryModel.fromJson(x))); + +// dynamic productCategoryModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson()))); + +// class ProductCategoryModel +// { +// dynamic id; +// dynamic name; +// dynamic description; +// dynamic image; +// dynamic slug; +// dynamic level; +// bool? isActive; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic parentCategoryId; +// dynamic path; +// dynamic parentCategory; +// List? childCategories; + +// ProductCategoryModel({ +// this.id, +// this.name, +// this.description, +// this.image, +// this.slug, +// this.level, +// this.isActive, +// this.createdAt, +// this.updatedAt, +// this.parentCategoryId, +// this.path, +// this.parentCategory, +// this.childCategories, +// }); + +// factory ProductCategoryModel.fromJson(Map json) => ProductCategoryModel( +// id: json["id"], +// name: json["name"], +// description: json["description"], +// image: json["image"], +// slug: json["slug"], +// level: json["level"], +// isActive: json["isActive"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// parentCategoryId: json["parentCategoryId"], +// path: json["path"], +// parentCategory: json["parentCategory"], +// childCategories: List.from(json["childCategories"].map((x) => ProductCategoryModel.fromJson(x))), +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "description": description, +// "image": image, +// "slug": slug, +// "level": level, +// "isActive": isActive, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "parentCategoryId": parentCategoryId, +// "path": path, +// "parentCategory": parentCategory, +// "childCategories": List.from(childCategories!.map((x) => x.toJson())), +// }; +// } + +import 'dart:convert'; + +List productCategoryModelFromJson(String str) => + List.from( + json.decode(str).map((x) => ProductCategoryModel.fromJson(x))); + +String productCategoryModelToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + +class ProductCategoryModel { + String? id; + String? name; + String? description; + String? image; + String? slug; + int? level; + bool? isActive; + DateTime? createdAt; + DateTime? updatedAt; + String? parentCategoryId; + String? path; + dynamic commissionPercentage; + ProductCategoryModel? parentCategory; + List? childCategories; + + ProductCategoryModel( + {this.id, + this.name, + this.description, + this.image, + this.slug, + this.level, + this.isActive, + this.createdAt, + this.updatedAt, + this.parentCategoryId, + this.path, + this.parentCategory, + this.childCategories, + this.commissionPercentage}); + + factory ProductCategoryModel.fromJson(Map json) => + ProductCategoryModel( + id: json["id"], + name: json["name"], + description: json["description"], + image: json["image"], + slug: json["slug"], + level: json["level"], + isActive: json["isActive"], + createdAt: json["createdAt"] == null + ? null + : DateTime.parse(json["createdAt"]), + updatedAt: json["updatedAt"] == null + ? null + : DateTime.parse(json["updatedAt"]), + parentCategoryId: json["parentCategoryId"], + path: json["path"], + parentCategory: json["parentCategory"] == null + ? null + : ProductCategoryModel.fromJson(json["parentCategory"]), + childCategories: json["childCategories"] == null + ? [] + : List.from(json["childCategories"] + .map((x) => ProductCategoryModel.fromJson(x))), + commissionPercentage: json["commissionPercentage"], + ); + + Map toJson() => { + "id": id, + "name": name, + "description": description, + "image": image, + "slug": slug, + "level": level, + "isActive": isActive, + "createdAt": createdAt?.toIso8601String(), + "updatedAt": updatedAt?.toIso8601String(), + "parentCategoryId": parentCategoryId, + "path": path, + "parentCategory": parentCategory?.toJson(), + "childCategories": childCategories == null + ? [] + : List.from(childCategories!.map((x) => x.toJson())), + "commissionPercentage": commissionPercentage, + }; +} diff --git a/lib/src/data/coupon_model.dart b/lib/src/data/coupon_model.dart index fceaeaf..08c080f 100644 --- a/lib/src/data/coupon_model.dart +++ b/lib/src/data/coupon_model.dart @@ -4,102 +4,106 @@ import 'dart:convert'; -CouponDataModel couponDataFromJson(dynamic str) => CouponDataModel.fromJson(json.decode(str)); +CouponDataModel couponDataFromJson(dynamic str) => + CouponDataModel.fromJson(json.decode(str)); dynamic couponDataToJson(CouponDataModel data) => json.encode(data.toJson()); class CouponDataModel { - List? data; - int? total; - int? page; - int? limit; + List? data; + int? total; + int? page; + int? limit; - CouponDataModel({ - this.data, - this.total, - this.page, - this.limit, - }); + CouponDataModel({ + this.data, + this.total, + this.page, + this.limit, + }); - factory CouponDataModel.fromJson(Map json) => CouponDataModel( - data: List.from(json["data"].map((x) => CouponDatum.fromJson(x))), + factory CouponDataModel.fromJson(Map json) => + CouponDataModel( + data: List.from( + json["data"].map((x) => CouponDatum.fromJson(x))), total: json["total"], page: json["page"], limit: json["limit"], - ); + ); - Map toJson() => { + Map toJson() => { "data": List.from(data!.map((x) => x.toJson())), "total": total, "page": page, "limit": limit, - }; + }; } class CouponDatum { - dynamic id; - dynamic code; - dynamic type; - dynamic discountValue; - dynamic maxDiscountAmount; - dynamic minPurchaseAmount; - DateTime? startDate; - DateTime? endDate; - int? totalUsageLimit; - int? perUserUsageLimit; - dynamic applicability; - dynamic status; - dynamic description; - dynamic terms; - int? buyQuantity; - int? getQuantity; - List? applicableUserRoles; - int? totalUsageCount; - bool? isActive; - dynamic createdBy; - DateTime? createdAt; - DateTime? updatedAt; - List? applicableStores; - List? applicableCategories; - List? applicableProducts; - List? usages; - List? applicableStoreIds; - List? applicableCategoryIds; - List? applicableProductIds; + dynamic id; + dynamic code; + dynamic type; + dynamic discountValue; + dynamic maxDiscountAmount; + dynamic minPurchaseAmount; + DateTime? startDate; + DateTime? endDate; + int? totalUsageLimit; + int? perUserUsageLimit; + dynamic applicability; + dynamic status; + dynamic description; + dynamic terms; + int? buyQuantity; + int? getQuantity; + List? applicableUserRoles; + int? totalUsageCount; + bool? isActive; + dynamic createdBy; + DateTime? createdAt; + DateTime? updatedAt; + List? applicableStores; + List? applicableCategories; + List? applicableProducts; + List? usages; + List? applicableStoreIds; + List? applicableCategoryIds; + List? applicableProductIds; + dynamic imageUrl; - CouponDatum({ - this.id, - this.code, - this.type, - this.discountValue, - this.maxDiscountAmount, - this.minPurchaseAmount, - this.startDate, - this.endDate, - this.totalUsageLimit, - this.perUserUsageLimit, - this.applicability, - this.status, - this.description, - this.terms, - this.buyQuantity, - this.getQuantity, - this.applicableUserRoles, - this.totalUsageCount, - this.isActive, - this.createdBy, - this.createdAt, - this.updatedAt, - this.applicableStores, - this.applicableCategories, - this.applicableProducts, - this.usages, - this.applicableStoreIds, - this.applicableCategoryIds, - this.applicableProductIds, - }); + CouponDatum( + {this.id, + this.code, + this.type, + this.discountValue, + this.maxDiscountAmount, + this.minPurchaseAmount, + this.startDate, + this.endDate, + this.totalUsageLimit, + this.perUserUsageLimit, + this.applicability, + this.status, + this.description, + this.terms, + this.buyQuantity, + this.getQuantity, + this.applicableUserRoles, + this.totalUsageCount, + this.isActive, + this.createdBy, + this.createdAt, + this.updatedAt, + this.applicableStores, + this.applicableCategories, + this.applicableProducts, + this.usages, + this.applicableStoreIds, + this.applicableCategoryIds, + this.applicableProductIds, + this.imageUrl}); - factory CouponDatum.fromJson(Map json) => CouponDatum( + factory CouponDatum.fromJson(Map json) => CouponDatum( id: json["id"], code: json["code"], type: json["type"], @@ -116,22 +120,30 @@ class CouponDatum { terms: json["terms"], buyQuantity: json["buyQuantity"], getQuantity: json["getQuantity"], - applicableUserRoles: List.from(json["applicableUserRoles"].map((x) => x)), + applicableUserRoles: + List.from(json["applicableUserRoles"].map((x) => x)), totalUsageCount: json["totalUsageCount"], isActive: json["isActive"], createdBy: json["createdBy"], createdAt: DateTime.parse(json["createdAt"]), updatedAt: DateTime.parse(json["updatedAt"]), - applicableStores: List.from(json["applicableStores"].map((x) => x)), - applicableCategories: List.from(json["applicableCategories"].map((x) => x)), - applicableProducts: List.from(json["applicableProducts"].map((x) => x)), + applicableStores: + List.from(json["applicableStores"].map((x) => x)), + applicableCategories: + List.from(json["applicableCategories"].map((x) => x)), + applicableProducts: + List.from(json["applicableProducts"].map((x) => x)), usages: List.from(json["usages"].map((x) => x)), - applicableStoreIds: List.from(json["applicableStoreIds"].map((x) => x)), - applicableCategoryIds: List.from(json["applicableCategoryIds"].map((x) => x)), - applicableProductIds: List.from(json["applicableProductIds"].map((x) => x)), - ); + applicableStoreIds: + List.from(json["applicableStoreIds"].map((x) => x)), + applicableCategoryIds: + List.from(json["applicableCategoryIds"].map((x) => x)), + applicableProductIds: + List.from(json["applicableProductIds"].map((x) => x)), + imageUrl: json["imageUrl"], + ); - Map toJson() => { + Map toJson() => { "id": id, "code": code, "type": type, @@ -148,18 +160,25 @@ class CouponDatum { "terms": terms, "buyQuantity": buyQuantity, "getQuantity": getQuantity, - "applicableUserRoles": List.from(applicableUserRoles!.map((x) => x)), + "applicableUserRoles": + List.from(applicableUserRoles!.map((x) => x)), "totalUsageCount": totalUsageCount, "isActive": isActive, "createdBy": createdBy, "createdAt": createdAt, "updatedAt": updatedAt, "applicableStores": List.from(applicableStores!.map((x) => x)), - "applicableCategories": List.from(applicableCategories!.map((x) => x)), - "applicableProducts": List.from(applicableProducts!.map((x) => x)), + "applicableCategories": + List.from(applicableCategories!.map((x) => x)), + "applicableProducts": + List.from(applicableProducts!.map((x) => x)), "usages": List.from(usages!.map((x) => x)), - "applicableStoreIds": List.from(applicableStoreIds!.map((x) => x)), - "applicableCategoryIds": List.from(applicableCategoryIds!.map((x) => x)), - "applicableProductIds": List.from(applicableProductIds!.map((x) => x)), - }; + "applicableStoreIds": + List.from(applicableStoreIds!.map((x) => x)), + "applicableCategoryIds": + List.from(applicableCategoryIds!.map((x) => x)), + "applicableProductIds": + List.from(applicableProductIds!.map((x) => x)), + "imageUrl": imageUrl, + }; } diff --git a/lib/src/data/product_category.dart b/lib/src/data/product_category.dart index 8ace7b3..fa088ac 100644 --- a/lib/src/data/product_category.dart +++ b/lib/src/data/product_category.dart @@ -7,7 +7,7 @@ dynamic productCategoryToJson(ProductCategory data) => json.encode(data.toJson()); class ProductCategory { - List? data; + List? data; Meta? meta; ProductCategory({ @@ -19,7 +19,8 @@ class ProductCategory { ProductCategory( data: json["data"] == null ? [] - : List.from(json["data"].map((x) => Datum.fromJson(x))), + : List.from( + json["data"].map((x) => DatumCategory.fromJson(x))), meta: json["meta"] == null ? null : Meta.fromJson(json["meta"]), ); @@ -31,7 +32,20 @@ class ProductCategory { }; } -class Datum { +List datumCategoryFromJson(dynamic str) { + if (str is String) { + return List.from( + json.decode(str).map((x) => DatumCategory.fromJson(x))); + } else if (str is List) { + return str.map((x) => DatumCategory.fromJson(x)).toList(); + } else { + throw FormatException("Invalid JSON format"); + } +} + +dynamic datumCategoryToJson(ProductCategory data) => json.encode(data.toJson()); + +class DatumCategory { dynamic id; dynamic name; dynamic description; @@ -46,7 +60,7 @@ class Datum { Category? parentCategory; List? childCategories; - Datum({ + DatumCategory({ this.id, this.name, this.description, @@ -62,7 +76,7 @@ class Datum { this.childCategories, }); - factory Datum.fromJson(Map json) => Datum( + factory DatumCategory.fromJson(Map json) => DatumCategory( id: json["id"], name: json["name"], description: json["description"], diff --git a/lib/src/logic/provider/addTocart_provider.dart b/lib/src/logic/provider/addTocart_provider.dart index a384547..614bcf1 100644 --- a/lib/src/logic/provider/addTocart_provider.dart +++ b/lib/src/logic/provider/addTocart_provider.dart @@ -188,7 +188,7 @@ class AddtocartProvider extends ChangeNotifier { notifyListeners(); }, (response) { - print("kdjgkjfghjkfghjkl $response"); + print("kdjgkjfghjkfghjkl ${response.data}"); couponDataModel = response!; iscouponLoading = false; notifyListeners(); @@ -222,7 +222,7 @@ class AddtocartProvider extends ChangeNotifier { context.showLoader(show: false); isCouponApply = false; Fluttertoast.showToast( - msg: "Coupon Code invalid!", + msg: "${error.message}", toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, backgroundColor: Colors.red, @@ -267,6 +267,7 @@ class AddtocartProvider extends ChangeNotifier { } ///////////////////////////////////orderPaymnet/////////////////////////// + bool ispaymentLoader = false; Future orderPaymnet( BuildContext context, @@ -285,9 +286,10 @@ class AddtocartProvider extends ChangeNotifier { "addressId": addressId, "cartId": cartId, }; - } else { + } else + { data = { - "amount": originalAmount, + "amount": originalAmount, "addressId": addressId, "cartId": cartId, "couponId": couponId diff --git a/lib/src/logic/provider/home_provider.dart b/lib/src/logic/provider/home_provider.dart index b19845e..901e348 100644 --- a/lib/src/logic/provider/home_provider.dart +++ b/lib/src/logic/provider/home_provider.dart @@ -7,6 +7,7 @@ import 'package:geolocator/geolocator.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:grocery_app/src/core/network_services/service_locator.dart'; import 'package:grocery_app/src/core/routes/routes.dart'; +import 'package:grocery_app/src/data/ProductCategoryModel.dart'; import 'package:grocery_app/src/data/allProduct_model.dart'; import 'package:grocery_app/src/data/all_cart_items.dart'; import 'package:grocery_app/src/data/banners.dart'; @@ -186,7 +187,7 @@ class ProductProvider extends ChangeNotifier { ); } - List categoryList = []; + List categoryList = []; bool iscategroyloading = true; Future getAllcategory(BuildContext context) async { @@ -201,6 +202,7 @@ class ProductProvider extends ChangeNotifier { }, (response) { print("jdshfjghdhfjhgjd"); + categoryList = response.data!; iscategroyloading = false; notifyListeners(); @@ -208,6 +210,60 @@ class ProductProvider extends ChangeNotifier { ); } + Future getSubcategory(BuildContext context, String? id) async { + var data = {"parentId": id}; + + print("kdjhgkjfkjgkj ${id}"); + + var result = await _homeRepo.getSubcategory(data, context); + return result.fold( + (error) { + print("djhgfjdfhjg ${error}"); + iscategroyloading = false; + notifyListeners(); + }, + (response) { + print("dsfdgdfgfhfghjghjghjghjhkghj"); + categoryList = response!; + iscategroyloading = false; + notifyListeners(); + }, + ); + } + + List categoriesss = []; + + ProductCategoryModel? selectedCategory; + + Future getCategoryByLevel() async { + categoriesss.clear(); + + final result = await _homeRepo.getCategoryByLevel({}); + + result.fold( + (error) { + print("Error fetching categories: $error"); + notifyListeners(); + }, + (categoryList) { + if (categoryList.isNotEmpty) { + final categories = [ProductCategoryModel(id: "all", name: "ALL")]; + categories.addAll(categoryList.cast()); + + categoriesss = categories; + } else { + print("No categories found."); + } + notifyListeners(); // Notify UI after update + }, + ); + } + + void setSelectedCategory(ProductCategoryModel category) { + selectedCategory = category; + notifyListeners(); + } + //similarProduct List banner = []; @@ -809,8 +865,7 @@ class ProductProvider extends ChangeNotifier { (error) { notifyListeners(); }, - (response) - { + (response) { print("lkdfjglkfdglkh ${response.data}"); _suggestions.addAll(response.data as Iterable); diff --git a/lib/src/logic/repo/product_repo.dart b/lib/src/logic/repo/product_repo.dart index b8d17aa..91dce2d 100644 --- a/lib/src/logic/repo/product_repo.dart +++ b/lib/src/logic/repo/product_repo.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:io'; import 'package:dio/dio.dart'; @@ -6,6 +7,7 @@ import 'package:fpdart/fpdart.dart'; import 'package:grocery_app/src/core/routes/routes.dart'; import 'package:grocery_app/src/core/utils/custom_dio_exception.dart'; import 'package:grocery_app/src/core/utils/response_type_def.dart'; +import 'package:grocery_app/src/data/ProductCategoryModel.dart'; import 'package:grocery_app/src/data/address.dart'; import 'package:grocery_app/src/data/allProduct_model.dart'; import 'package:grocery_app/src/data/all_cart_items.dart'; @@ -100,6 +102,64 @@ class ProductRepo { } } + FutureResult> getSubcategory( + data, BuildContext context) async { + try { + var response = await _productService.getSubcategory(data); + + print("Response Type: ${response.runtimeType}"); + print("Raw Response: ${response.data}"); + + List categoryList; + + if (response.data is List) { + categoryList = (response.data as List) + .map((item) => DatumCategory.fromJson(item)) + .toList(); + ; + } else { + categoryList = (jsonDecode(response) as List) + .map((item) => DatumCategory.fromJson(item)) + .toList(); + } + + print("Raw Response: $response"); + + // final String model = response.toString(); + + return right(categoryList); + } on DioException catch (e) { + var error = CustomDioExceptions.handleError(e); + return left(error); + } + } + + FutureResult> getCategoryByLevel(data) async { + try { + var response = await _productService.getCategoryByLevel(data); + + final List productModels = (response.data as List) + .map((item) => ProductCategoryModel.fromJson(item)) + .toList(); + if (response != null && response.data != null) { + // Parse the response data into a list of ProductCategoryModel + final List productModels = (response.data as List) + .map((item) => ProductCategoryModel.fromJson(item)) + .toList(); + + // Print or handle the fetched data + if (productModels.isNotEmpty) { + print( + "Data successfully fetched and parsed: ${productModels.length} categories."); + } + } + return right(productModels); + } on DioException catch (e) { + var error = CustomDioExceptions.handleError(e); + return left(error); + } + } + FutureResult paymentOrder(data) async { try { var response = await _productService.paymentOrder(data); @@ -160,7 +220,7 @@ class ProductRepo { } } - FutureResult offerCoupon(data) async { + FutureResult offerCoupon(data) async { try { var response = await _productService.offerCoupon(data); @@ -172,11 +232,12 @@ class ProductRepo { } } - FutureResult applyCoupon(data) async { + FutureResult applyCoupon(data) async { try { var response = await _productService.applyCoupon(data); - CouponResponse couponresponse = couponResponseFromJson(response.toString()); + CouponResponse couponresponse = + couponResponseFromJson(response.toString()); return right(couponresponse); } on DioException catch (e) { var error = CustomDioExceptions.handleError(e); @@ -184,10 +245,6 @@ class ProductRepo { } } - - - - FutureResult getAddress(data) async { try { var response = await _productService.getAddress(data); @@ -221,11 +278,9 @@ class ProductRepo { try { var response = await _productService.updateProfile(data); - final String model = response.toString(); return right(model); - } on DioException catch (e) - { + } on DioException catch (e) { var error = CustomDioExceptions.handleError(e); return left(error); } diff --git a/lib/src/logic/services/home_locator.dart b/lib/src/logic/services/home_locator.dart index 75819ba..439eb1c 100644 --- a/lib/src/logic/services/home_locator.dart +++ b/lib/src/logic/services/home_locator.dart @@ -55,6 +55,20 @@ class ProductService extends ApiService { return response; } + Future getSubcategory(data) async { + var response = await api.get(APIURL.getSubcategory, data: jsonEncode(data),queryParameters: data); + + return response; + } + +Future getCategoryByLevel(data) async { + var response = await api.get(APIURL.getCategoryByLevel, data: jsonEncode(data)); + + return response; + } + + + Future paymentOrder(data) async { var response = await api.post(APIURL.paymentOrder, data: jsonEncode(data)); diff --git a/lib/src/ui/cart/cartview_screen.dart b/lib/src/ui/cart/cartview_screen.dart index b179a17..66521d7 100644 --- a/lib/src/ui/cart/cartview_screen.dart +++ b/lib/src/ui/cart/cartview_screen.dart @@ -1,3 +1,4 @@ +import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; @@ -27,6 +28,7 @@ import 'package:grocery_app/utils/extensions/uicontext.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:provider/provider.dart'; import 'package:skeletonizer/skeletonizer.dart'; +import 'package:url_launcher/url_launcher.dart'; class Mycart extends StatefulWidget { const Mycart({super.key}); @@ -74,6 +76,7 @@ class _MycartState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ cartItems(), + bannerview(), Padding( padding: const EdgeInsets.all(8.0), child: Text( @@ -1024,6 +1027,113 @@ class _MycartState extends State { }, ); } + + Widget bannerview() { + return Consumer(builder: (context, provider, child) { + return provider.isBannerLoading + ? Skeletonizer( + enabled: provider.isBannerLoading, + child: Container( + height: 180, + width: double.infinity, + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(15), + ), + ), + ) + : provider.banner.isEmpty + ? SizedBox.shrink() + : CarouselSlider( + options: CarouselOptions( + height: 180, + autoPlay: true, + enlargeCenterPage: true, + viewportFraction: 1, + aspectRatio: 16 / 9, + initialPage: 0, + enableInfiniteScroll: true, + reverse: false, + autoPlayInterval: Duration(seconds: 3), + autoPlayAnimationDuration: Duration(milliseconds: 800), + autoPlayCurve: Curves.fastOutSlowIn, + enlargeFactor: 0.3, + ), + items: provider.banner.map((banner) { + return Builder( + builder: (BuildContext context) { + return Container( + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Colors.greenAccent.withOpacity(0.1), + borderRadius: BorderRadius.circular(15), + ), + child: Stack( + children: [ + Positioned( + top: 15, + left: 15, + child: SizedBox( + width: 200, + child: Text( + banner.altText ?? "Special Event", + style: context.customExtraBold( + Colors.black, 18), + ), + ), + ), + Positioned( + bottom: 15, + left: 15, + child: GestureDetector( + onTap: () { + _launchUrl(banner.redirectUrl); + }, + child: Container( + height: 40, + width: 100, + decoration: BoxDecoration( + color: APPCOLOR.lightGreen, + borderRadius: BorderRadius.circular(5), + ), + child: Center( + child: Text( + 'Shop now', + style: context.customRegular( + Colors.white, 14), + ), + ), + ), + ), + ), + Positioned( + right: 15, + bottom: 15, + child: AppNetworkImage( + height: 130, + width: 150, + imageUrl: banner.imageUrl ?? + 'https://e7.pngegg.com/pngimages/742/816/png-clipart-coca-cola-can-illustration-coca-cola-soft-drink-surge-pepsi-coke-sweetness-cola-thumbnail.png', + backGroundColor: Colors.transparent, + ), + ), + ], + ), + ); + }, + ); + }).toList(), + ); + }); + } + + Future _launchUrl(url) async { + print("jdhfjkgh ${url}"); + final Uri uri = Uri.parse(url); + if (!await launchUrl(uri, mode: LaunchMode.externalApplication)) { + throw 'Could not launch $url'; + } + } } class AddressBottomSheet extends StatefulWidget { diff --git a/lib/src/ui/coupons/coupons_screen.dart b/lib/src/ui/coupons/coupons_screen.dart index 91d1bf5..3d9b28e 100644 --- a/lib/src/ui/coupons/coupons_screen.dart +++ b/lib/src/ui/coupons/coupons_screen.dart @@ -1,6 +1,11 @@ +import 'dart:math'; +import 'dart:ui'; + +import 'package:blur/blur.dart'; import 'package:flutter/material.dart'; import 'package:grocery_app/src/logic/provider/addTocart_provider.dart'; import 'package:grocery_app/src/logic/provider/home_provider.dart'; +import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; class CouponsScreen extends StatelessWidget { @@ -11,6 +16,7 @@ class CouponsScreen extends StatelessWidget { @override Widget build(BuildContext context) { + Provider.of(context, listen: false).offerCoupon(context); print("kldfjgdfkljgdf ${cartId}"); return Scaffold( appBar: AppBar( @@ -43,15 +49,12 @@ class CouponsScreen extends StatelessWidget { child: ElevatedButton( onPressed: () async { if (_formKey.currentState!.validate()) { - // var status = await provider.applyCoupon( - // context, - // cartId, - // inpucode.text, - // ); + var status = await provider.applyCoupon( + context, cartId, inpucode.text, ''); - // if (status) { - // Navigator.pop(context); - // } + if (status) { + Navigator.pop(context); + } } }, style: ElevatedButton.styleFrom( @@ -84,78 +87,266 @@ class CouponsScreen extends StatelessWidget { return Expanded( child: ListView.builder( itemCount: provider.couponDataModel.data!.length, - itemBuilder: (context, index) - { + itemBuilder: (context, index) { final coupon = provider.couponDataModel.data![index]; + + DateTime couponEndDate = + DateTime.parse(coupon.endDate.toString()).toUtc(); + DateTime now = DateTime.now().toUtc(); + + bool isCouponValid = now.isBefore(couponEndDate); + + print( + "Coupon Expiry: ${coupon.endDate} ${coupon.imageUrl}| Current UTC Time: $now | Valid: $isCouponValid"); return Card( - color: Colors.white, + color: Colors.transparent, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), ), - elevation: 2, - child: Padding( - padding: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + elevation: 4, + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: Stack( children: [ - Text( - coupon.description!, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, + // Background Image + Positioned.fill( + child: Image.network( + coupon.imageUrl, + fit: BoxFit.cover, ), ), - SizedBox(height: 5), - Text( - coupon.terms!, - style: TextStyle(color: Colors.grey[600]), - ), - SizedBox(height: 10), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - padding: EdgeInsets.symmetric( - horizontal: 10, vertical: 5), - decoration: BoxDecoration( - border: Border.all(color: Colors.green), - borderRadius: BorderRadius.circular(8), - ), - child: Text( - coupon.code!, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.green, - ), - ), - ), - ElevatedButton( - onPressed: () async { - var status = await provider.applyCoupon( - context, - cartId, - coupon.code, - coupon.id); - { - Navigator.pop(context); - } - }, - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + // Blur Effect + Positioned.fill( + child: BackdropFilter( + filter: + ImageFilter.blur(sigmaX: 5, sigmaY: 5), + child: Container( + color: Colors.black.withOpacity( + 0.3), // Dark overlay for readability + ), + ), + ), + + // Coupon Content + Padding( + padding: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + coupon.description ?? '', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors + .white, // Ensure contrast with background ), ), - child: Text("Apply"), - ) - ], - ) + SizedBox(height: 5), + Row( + children: [ + Text( + "Expired On : ", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors + .white, // Ensure contrast with background + ), + ), + Text( + DateFormat("dd-MM-yyyy").format( + DateTime.parse( + coupon.endDate.toString())), + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: + Colors.white, // Highlight price + ), + ), + ], + ), + SizedBox(height: 5), + Text( + "₹${coupon.discountValue ?? ''}", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.amber, // Highlight price + ), + ), + SizedBox(height: 5), + Text( + coupon.terms ?? "", + style: TextStyle(color: Colors.white70), + ), + SizedBox(height: 10), + + // Coupon Code and Apply Button + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + // Coupon Code Box + Container( + padding: EdgeInsets.symmetric( + horizontal: 10, vertical: 5), + decoration: BoxDecoration( + color: + Colors.white.withOpacity(0.2), + border: + Border.all(color: Colors.green), + borderRadius: + BorderRadius.circular(8), + ), + child: Text( + coupon.code!, + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ), + + // Apply Button + ElevatedButton( + onPressed: isCouponValid + ? () async { + var status = await provider + .applyCoupon( + context, + cartId, + coupon.code, + coupon.id); + if (status) { + Navigator.pop(context); + } + } + : null, // Disable button if expired + style: ElevatedButton.styleFrom( + backgroundColor: isCouponValid + ? Colors.green + : Colors.grey, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(8), + ), + ), + child: Text("Apply"), + ), + ], + ), + ], + ), + ), ], ), ), ); + + // Card( + // color: Colors.transparent.withOpacity(0.4), + // // color: Color((Random().nextDouble() * 0xFFFFFF).toInt()) + // // .withOpacity(0.9), + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(12), + // ), + // elevation: 2, + // child: Blur( + // blur: 2.5, + // // blurColor: Theme.of(context).primaryColor, + // child: Container( + // decoration: BoxDecoration( + // image: DecorationImage( + // image: NetworkImage( + // coupon.imageUrl), // Your background image + // fit: BoxFit.cover, // Adjust as needed + // ), + // borderRadius: BorderRadius.circular( + // 12), // Match Card's border radius + // ), + // child: Padding( + // padding: EdgeInsets.all(16.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // coupon.description ?? '', + // style: TextStyle( + // fontSize: 16, + // fontWeight: FontWeight.bold, + // ), + // ), + // Text( + // "₹" + coupon.discountValue ?? '', + // style: TextStyle( + // fontSize: 16, + // fontWeight: FontWeight.bold, + // ), + // ), + // SizedBox(height: 5), + // Text( + // coupon.terms ?? "", + // style: TextStyle(color: Colors.grey[600]), + // ), + // SizedBox(height: 10), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Container( + // padding: EdgeInsets.symmetric( + // horizontal: 10, vertical: 5), + // decoration: BoxDecoration( + // border: + // Border.all(color: Colors.green), + // borderRadius: + // BorderRadius.circular(8), + // ), + // child: Text( + // coupon.code!, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // color: Colors.green, + // ), + // ), + // ), + // ElevatedButton( + // onPressed: isCouponValid + // ? () async { + // var status = + // await provider.applyCoupon( + // context, + // cartId, + // coupon.code, + // coupon.id); + + // if (status) { + // Navigator.pop(context); + // } + // } + // : null, // Disables button if expired + // style: ElevatedButton.styleFrom( + // backgroundColor: isCouponValid + // ? Colors.green + // : Colors.grey, + // shape: RoundedRectangleBorder( + // borderRadius: + // BorderRadius.circular(8), + // ), + // ), + // child: Text("Apply"), + // ) + // ], + // ) + // ], + // ), + // ), + // ), + // ), + // ); }, ), ); diff --git a/lib/src/ui/fruitvegidetail/fruit_veggie_detail.dart b/lib/src/ui/fruitvegidetail/fruit_veggie_detail.dart index 8312ff6..5958714 100644 --- a/lib/src/ui/fruitvegidetail/fruit_veggie_detail.dart +++ b/lib/src/ui/fruitvegidetail/fruit_veggie_detail.dart @@ -6,6 +6,7 @@ import 'package:fluttertoast/fluttertoast.dart'; import 'package:go_router/go_router.dart'; import 'package:grocery_app/src/common_widget/network_image.dart'; import 'package:grocery_app/src/core/routes/routes.dart'; +import 'package:grocery_app/src/data/ProductCategoryModel.dart'; import 'package:grocery_app/src/data/product_category.dart'; import 'package:grocery_app/src/logic/provider/home_provider.dart'; @@ -33,6 +34,7 @@ class _FruitVeggieDetailState extends State { final productProvider = Provider.of(context, listen: false); productProvider.getAllcategory(context); + productProvider.getCategoryByLevel(); productProvider.gettAllProduct(context, "", true, ''); }); @@ -84,16 +86,7 @@ class _FruitVeggieDetailState extends State { ), ), actions: [ - // Padding( - // padding: const EdgeInsets.only(right: 10), - // child: InkWell( - // onTap: () {}, - // child: Icon( - // MdiIcons.magnify, - // size: 35, - // ), - // ), - // ) + ], ), body: Padding( @@ -465,108 +458,7 @@ class _FruitVeggieDetailState extends State { return discountPercentage.round(); } - // Widget filterCategory() { - // final activeIndexProvider = Provider.of(context); - // return Consumer(builder: (context, provider, child) { - // if (provider.iscategroyloading) { - // return Center( - // child: Container( - // width: 20, - // height: 20, - // decoration: BoxDecoration( - // color: APPCOLOR.bgGrey, - // borderRadius: BorderRadius.circular(10), - // border: Border.all( - // color: APPCOLOR.bgGrey, - // width: 1, - // )), - // child: const Center( - // child: CupertinoActivityIndicator(), - // ), - // )); - // } else if (provider.categoryList.isEmpty) { - // return SizedBox.shrink(); - // } else { - // return Container( - // decoration: const BoxDecoration(color: Colors.white), - // width: 100, - // child: ListView.builder( - // itemCount: provider.categoryList.length, - // scrollDirection: Axis.vertical, - // itemBuilder: (context, index) { - // var category = provider.categoryList[index]; - // return InkWell( - // onTap: () { - // provider.iscroll = true; - // provider.products.clear(); - // provider.isLoadingg = false; - // provider.hasMore = true; - // provider.page = 1; - // provider.notifyListeners(); - // provider.gettAllProduct( - // context, "/category/${category.id}", true, ''); - // activeIndexProvider.setActiveIndex(index); - // // provider.isLoadingg = false; - // // provider.hasMore = false; - // // provider.gettAllProduct(context, "/category/${category.id}"); - // // activeIndexProvider.setActiveIndex(index); - // }, - // child: SizedBox( - // height: 150, - // child: Column( - // children: [ - // Row( - // children: [ - // Expanded( - // child: Center( - // child: Container( - // decoration: BoxDecoration( - // color: - // activeIndexProvider.activeIndex == index - // ? Colors.greenAccent.withOpacity(0.1) - // : APPCOLOR.bgGrey, - // borderRadius: BorderRadius.circular(5), - // ), - // child: AppNetworkImage( - // height: 80, - // width: 80, - // imageUrl: category.image ?? - // 'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png', - // backGroundColor: APPCOLOR.bgGrey, - // radius: 10, - // ), - // ), - // ), - // ), - // Container( - // width: 3, - // height: 100, - // color: activeIndexProvider.activeIndex == index - // ? APPCOLOR.lightGreen - // : Colors.transparent, - // ), - // ], - // ), - // Text( - // category.name, - // textAlign: TextAlign.center, - // maxLines: 2, - // overflow: TextOverflow.ellipsis, - // style: activeIndexProvider.activeIndex == index - // ? context.customExtraBold(APPCOLOR.balck1A1A1A, 14) - // : context.customMedium(APPCOLOR.balck1A1A1A, 14), - // ), - // ], - // ), - // ), - // ); - // }, - // ), - // ); - // } - // }); - // } - + Widget filterCategory() { final activeIndexProvider = Provider.of(context); @@ -590,8 +482,8 @@ class _FruitVeggieDetailState extends State { ), ); } else { - final categories = [Datum(id: "all", name: "ALL")]; - categories.addAll(provider.categoryList.cast()); + final categories = [DatumCategory(id: "all", name: "ALL")]; + categories.addAll(provider.categoryList.cast()); return Container( decoration: const BoxDecoration(color: Colors.white), @@ -602,6 +494,8 @@ class _FruitVeggieDetailState extends State { itemBuilder: (context, index) { var category = categories[index]; + + return Padding( padding: const EdgeInsets.only(bottom: 8), child: InkWell( @@ -637,47 +531,105 @@ class _FruitVeggieDetailState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - Column( - children: [ - Center( - child: Container( - // decoration: BoxDecoration( - // color: activeIndexProvider.activeIndex == - // index - // ? Colors.greenAccent.withOpacity(0.1) - // : APPCOLOR.bgGrey, - // borderRadius: BorderRadius.circular(5), - // ), - child: AppNetworkImage( - height: 30, - width: 50, - imageUrl: category.image ?? - 'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png', - backGroundColor: APPCOLOR.bgGrey, - radius: 10, + if (category.name == "ALL") ...{ + if (provider.categoriesss.isNotEmpty) + PopupMenuButton( + onSelected: (ProductCategoryModel value) { + activeIndexProvider.setActiveIndex(0); + + if (value.id == "all") { + provider.iscroll = true; + provider.products.clear(); + provider.isLoadingg = false; + provider.hasMore = true; + provider.page = 1; + provider.gettAllProduct( + context, "", true, ''); + provider.getAllcategory(context); + } else { + provider.categoryList.clear(); + provider.getSubcategory( + context, value.id); + } + + provider.setSelectedCategory(value); + }, + itemBuilder: (BuildContext context) => + provider.categoriesss + .map( + (category) => PopupMenuItem( + value: category, + child: Text( + category.name ?? "Unknown"), + ), + ) + .toList(), + child: Padding( + padding: const EdgeInsets.symmetric( + vertical: 10, + horizontal: 10, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: 20, + child: Text( + provider.selectedCategory?.name ?? + "All", + maxLines: 1, + style: context.customMedium( + APPCOLOR.balck1A1A1A, + 12, + ), + ), + ), + Icon( + Icons.arrow_drop_down, + size: 20, + color: APPCOLOR.balck1A1A1A, + ), + ], ), ), ), - SizedBox( - height: 5, - ), - Container( - width: 50, - child: Text( - category.name, - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: - activeIndexProvider.activeIndex == index - ? context.customExtraBold( - APPCOLOR.balck1A1A1A, 9) - : context.customMedium( - APPCOLOR.balck1A1A1A, 10), + } else ...{ + Column( + children: [ + Center( + child: Container( + child: AppNetworkImage( + height: 30, + width: 50, + imageUrl: category.image ?? + 'https://i.pinimg.com/originals/a5/f3/5f/a5f35fb23e942809da3df91b23718e8d.png', + backGroundColor: APPCOLOR.bgGrey, + radius: 10, + ), + ), ), - ), - ], - ), + SizedBox( + height: 5, + ), + Container( + width: 50, + child: Text( + category.name, + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: activeIndexProvider.activeIndex == + index + ? context.customExtraBold( + APPCOLOR.balck1A1A1A, 9) + : context.customMedium( + APPCOLOR.balck1A1A1A, 10), + ), + ), + ], + ), + }, SizedBox( width: 5, ), diff --git a/lib/src/ui/home/home_screen.dart b/lib/src/ui/home/home_screen.dart index 3623c95..cc29acb 100644 --- a/lib/src/ui/home/home_screen.dart +++ b/lib/src/ui/home/home_screen.dart @@ -41,6 +41,7 @@ class _HomeScreenState extends State { productProvider.getHomeProduct(context, "", '', '', '', ''); productProvider.getBestDealProduct(context, ''); productProvider.getAllcategory(context); + // productProvider.getCategoryByLevel(); getUserDetails(); }); diff --git a/lib/src/ui/profilepage/profile_screen.dart b/lib/src/ui/profilepage/profile_screen.dart index abdd1cc..a61e019 100644 --- a/lib/src/ui/profilepage/profile_screen.dart +++ b/lib/src/ui/profilepage/profile_screen.dart @@ -153,7 +153,7 @@ class _ProfileScreenState extends State { context.push(MyRoutes.SIGNUP); }, child: Text( - "Login ", + " ", style: context.customExtraBold( top < 100 ? Colors.blue : Colors.blue, 14), @@ -330,7 +330,7 @@ class _ProfileScreenState extends State { ); } - // Function to show the Bottom Sheet + void _showBottomSheet(BuildContext context) { showModalBottomSheet( context: context, diff --git a/pubspec.lock b/pubspec.lock index 8f08b68..56cacbf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -49,6 +49,14 @@ packages: url: "https://pub.dev" source: hosted version: "8.0.4" + blur: + dependency: "direct main" + description: + name: blur + sha256: c17450404bceea429100e0838d19bbfaa6ad1f3053e7bac78a0264bbd60cfe01 + url: "https://pub.dev" + source: hosted + version: "4.0.0" boolean_selector: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 126585b..0a2bdb0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,7 @@ dependencies: url_launcher: ^6.3.1 skeletonizer: ^1.4.3 art_sweetalert: ^0.0.5 + blur: