diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index 7560eaa..1d903a6 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -1010,7 +1010,7 @@ "languageVersion": "3.4" } ], - "generated": "2025-02-08T20:21:28.051863Z", + "generated": "2025-02-09T21:06:34.160787Z", "generator": "pub", "generatorVersion": "3.5.3", "flutterRoot": "file:///Users/apple/Documents/development/flutter", diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 3c88875..b6c59b4 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/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/apple/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/geocoding_ios-3.0.1/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/","native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12+2/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite_darwin","path":"/Users/apple/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.1+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/apple/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/geocoding_android-3.3.1/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_api_headers","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+20/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"package_info_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/path_provider_android-2.2.15/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.4/","native_build":true,"dependencies":[]},{"name":"sqflite_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/sqflite_android-2.4.0/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.14/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_macos","path":"/Users/apple/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4+2/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_macos","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.2/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite_darwin","path":"/Users/apple/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.1+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":false,"dependencies":[]},{"name":"file_selector_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.3+2/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_windows-0.6.0/","native_build":true,"dependencies":[]},{"name":"geolocator_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","dependencies":[]},{"name":"flutter_inappwebview_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.1.2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/apple/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","dependencies":[]},{"name":"geolocator_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.6/","dependencies":[]},{"name":"package_info_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/apple/.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","flutter_inappwebview_windows"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_inappwebview_windows","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":["sqflite_android","sqflite_darwin"]},{"name":"sqflite_android","dependencies":[]},{"name":"sqflite_darwin","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-02-09 01:51:28.219749","version":"3.24.3","swift_package_manager_enabled":false} \ 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/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/apple/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/geocoding_ios-3.0.1/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"google_maps_flutter_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/google_maps_flutter_ios-2.13.2/","native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12+2/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite_darwin","path":"/Users/apple/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.1+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.2/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.24/","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"/Users/apple/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","native_build":true,"dependencies":[]},{"name":"geocoding_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/geocoding_android-3.3.1/","native_build":true,"dependencies":[]},{"name":"geolocator_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/","native_build":true,"dependencies":[]},{"name":"google_api_headers","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/google_maps_flutter_android-2.14.12/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+20/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"package_info_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/path_provider_android-2.2.15/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.4/","native_build":true,"dependencies":[]},{"name":"sqflite_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/sqflite_android-2.4.0/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.14/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_macos","path":"/Users/apple/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4+2/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_macos","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.2/","native_build":true,"dependencies":[]},{"name":"geolocator_apple","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.8+1/","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite_darwin","path":"/Users/apple/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.1+1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.2/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":false,"dependencies":[]},{"name":"file_selector_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.3+2/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","native_build":true,"dependencies":[]},{"name":"file_selector_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+3/","native_build":true,"dependencies":[]},{"name":"flutter_inappwebview_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_windows-0.6.0/","native_build":true,"dependencies":[]},{"name":"geolocator_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"/Users/apple/.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/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/apple/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.4/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/connectivity_plus-6.1.3/","dependencies":[]},{"name":"flutter_inappwebview_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.1.2/","dependencies":[]},{"name":"fluttertoast","path":"/Users/apple/.pub-cache/hosted/pub.dev/fluttertoast-8.2.11/","dependencies":[]},{"name":"geolocator_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/","dependencies":[]},{"name":"google_maps_flutter_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/google_maps_flutter_web-0.5.10/","dependencies":[]},{"name":"image_picker_for_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.6/","dependencies":[]},{"name":"package_info_plus","path":"/Users/apple/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/apple/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/apple/.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","flutter_inappwebview_windows"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_inappwebview_windows","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":["sqflite_android","sqflite_darwin"]},{"name":"sqflite_android","dependencies":[]},{"name":"sqflite_darwin","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-02-10 02:36:34.304825","version":"3.24.3","swift_package_manager_enabled":false} \ No newline at end of file diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 9074fee..6266644 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import Flutter import UIKit -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/lib/src/core/constant/api.dart b/lib/src/core/constant/api.dart index 684a847..bdf1e53 100644 --- a/lib/src/core/constant/api.dart +++ b/lib/src/core/constant/api.dart @@ -28,6 +28,10 @@ class APIURL { static const String paymentOrder = "${BASE_URL}payment/initiate"; static const String paymentCODOrder = "${BASE_URL}orders"; static const String myOrder = "${BASE_URL}orders/my-orders"; + 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 = diff --git a/lib/src/core/routes/routes.dart b/lib/src/core/routes/routes.dart index 834a6b5..0628ae7 100644 --- a/lib/src/core/routes/routes.dart +++ b/lib/src/core/routes/routes.dart @@ -82,10 +82,14 @@ class MyRoutes { ), animatedGoRoute( - path: COUPONSSCREEN, - name: COUPONSSCREEN, - pageBuilder: (context, state) => CouponsScreen(), - ), + path: COUPONSSCREEN, + name: COUPONSSCREEN, + pageBuilder: (context, state) { + final id = state.extra as String; + return CouponsScreen( + cartId: id, + ); + }), animatedGoRoute( path: ADDRESSS, name: ADDRESSS, diff --git a/lib/src/data/allProduct_model.dart b/lib/src/data/allProduct_model.dart index bc55b48..140bc5d 100644 --- a/lib/src/data/allProduct_model.dart +++ b/lib/src/data/allProduct_model.dart @@ -1,13 +1,414 @@ +// // To parse this JSON data, do +// // +// // final allProductModel = allProductModelFromJson(jsondynamic); + +// import 'dart:convert'; + +// AllProductModel allProductModelFromJson(dynamic str) => +// AllProductModel.fromJson(json.decode(str)); + +// dynamic allProductModelToJson(AllProductModel data) => +// json.encode(data.toJson()); + +// class AllProductModel { +// List? data; +// Meta? meta; + +// AllProductModel({ +// this.data, +// this.meta, +// }); + +// factory AllProductModel.fromJson(Map json) => +// AllProductModel( +// data: List.from(json["data"].map((x) => Product.fromJson(x))), +// meta: Meta.fromJson(json["meta"]), +// ); + +// Map toJson() => { +// "data": List.from(data!.map((x) => x.toJson())), +// "meta": meta!.toJson(), +// }; +// } + +// class Product { +// dynamic id; +// dynamic name; +// dynamic description; +// dynamic additionalInfo; +// dynamic brand; +// dynamic basePrice; +// dynamic discountPrice; +// dynamic stock; +// dynamic quantity; +// dynamic unit; +// dynamic slug; +// dynamic rating; +// bool? isInStock; +// bool? isActive; +// DateTime?? createdAt; +// DateTime?? updatedAt; +// dynamic storeId; +// dynamic categoryId; +// dynamic productTypeId; +// dynamic timeSlotId; +// Store? store; +// Category? category; +// dynamic productType; +// dynamic timeSlot; +// dynamic isInWishlist; +// List? productImages; +// List? productTags; +// List? zones; +// List? productReview; + +// Product( +// {this.id, +// this.name, +// this.description, +// this.additionalInfo, +// this.brand, +// this.basePrice, +// this.discountPrice, +// this.stock, +// this.quantity, +// this.unit, +// this.slug, +// this.rating, +// this.isInStock, +// this.isActive, +// this.createdAt, +// this.updatedAt, +// this.storeId, +// this.categoryId, +// this.productTypeId, +// this.timeSlotId, +// this.store, +// this.category, +// this.productType, +// this.timeSlot, +// this.productImages, +// this.productTags, +// this.zones, +// this.productReview, +// this.isInWishlist}); + +// factory Product.fromJson(Map json) => Product( +// id: json["id"], +// name: json["name"], +// description: json["description"], +// additionalInfo: json["additionalInfo"], +// brand: json["brand"], +// basePrice: json["basePrice"], +// discountPrice: json["discountPrice"], +// stock: json["stock"], +// quantity: json["quantity"], +// unit: json["unit"], +// slug: json["slug"], +// rating: json["rating"], +// isInStock: json["isInStock"], +// isActive: json["isActive"], +// createdAt:DateTime?.parse(json["createdAt"]), +// updatedAt:DateTime?.parse(json["updatedAt"]), +// storeId: json["storeId"], +// categoryId: json["categoryId"], +// productTypeId: json["productTypeId"], +// timeSlotId: json["timeSlotId"], +// store: Store.fromJson(json["store"]), +// category: Category.fromJson(json["category"]), +// productType: json["productType"], +// timeSlot: json["timeSlot"], +// productImages: List.from( +// json["productImages"].map((x) => ProductImage.fromJson(x))), +// productTags: List.from(json["productTags"].map((x) => x)), +// zones: List.from(json["zones"].map((x) => x)), +// productReview: List.from( +// json["ProductReview"].map((x) => ProductReview.fromJson(x))), +// isInWishlist: json["isInWishlist"], +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "description": description, +// "additionalInfo": additionalInfo, +// "brand": brand, +// "basePrice": basePrice, +// "discountPrice": discountPrice, +// "stock": stock, +// "quantity": quantity, +// "unit": unit, +// "slug": slug, +// "rating": rating, +// "isInStock": isInStock, +// "isActive": isActive, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "storeId": storeId, +// "categoryId": categoryId, +// "productTypeId": productTypeId, +// "timeSlotId": timeSlotId, +// "store": store!.toJson(), +// "category": category!.toJson(), +// "productType": productType, +// "timeSlot": timeSlot, +// "productImages": +// List.from(productImages!.map((x) => x.toJson())), +// "productTags": List.from(productTags!.map((x) => x)), +// "zones": List.from(zones!.map((x) => x)), +// "ProductReview": +// List.from(productReview!.map((x) => x.toJson())), +// "isInWishlist": isInWishlist, +// }; + +// } + +// class Category { +// dynamic id; +// dynamic name; +// dynamic description; +// dynamic image; +// dynamic slug; +// dynamic level; +// bool? isActive; +// DateTime?? createdAt; +// DateTime?? updatedAt; +// dynamic parentCategoryId; +// dynamic path; + +// Category({ +// this.id, +// this.name, +// this.description, +// this.image, +// this.slug, +// this.level, +// this.isActive, +// this.createdAt, +// this.updatedAt, +// this.parentCategoryId, +// this.path, +// }); + +// factory Category.fromJson(Map json) => Category( +// 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"], +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "description": description, +// "image": image, +// "slug": slug, +// "level": level, +// "isActive": isActive, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "parentCategoryId": parentCategoryId, +// "path": path, +// }; +// } + +// class ProductImage { +// dynamic id; +// dynamic url; +// bool? isDefault; +// dynamic productId; + +// ProductImage({ +// this.id, +// this.url, +// this.isDefault, +// this.productId, +// }); + +// factory ProductImage.fromJson(Map json) => ProductImage( +// id: json["id"], +// url: json["url"], +// isDefault: json["isDefault"], +// productId: json["productId"], +// ); + +// Map toJson() => { +// "id": id, +// "url": url, +// "isDefault": isDefault, +// "productId": productId, +// }; +// } + +// class ProductReview { +// dynamic id; +// dynamic userId; +// dynamic productId; +// dynamic rating; +// dynamic title; +// dynamic description; +// dynamic likes; +// dynamic dislikes; +// dynamic helpfulCount; +// bool? isVerified; +// bool? verifiedPurchase; +// dynamic status; +// DateTime?? createdAt; +// DateTime?? updatedAt; + +// ProductReview({ +// this.id, +// this.userId, +// this.productId, +// this.rating, +// this.title, +// this.description, +// this.likes, +// this.dislikes, +// this.helpfulCount, +// this.isVerified, +// this.verifiedPurchase, +// this.status, +// this.createdAt, +// this.updatedAt, +// }); + +// factory ProductReview.fromJson(Map json) => ProductReview( +// id: json["id"], +// userId: json["userId"], +// productId: json["productId"], +// rating: json["rating"], +// title: json["title"], +// description: json["description"], +// likes: json["likes"], +// dislikes: json["dislikes"], +// helpfulCount: json["helpfulCount"], +// isVerified: json["isVerified"], +// verifiedPurchase: json["verifiedPurchase"], +// status: json["status"], +// createdAt:DateTime?.parse(json["createdAt"]), +// updatedAt:DateTime?.parse(json["updatedAt"]), +// ); + +// Map toJson() => { +// "id": id, +// "userId": userId, +// "productId": productId, +// "rating": rating, +// "title": title, +// "description": description, +// "likes": likes, +// "dislikes": dislikes, +// "helpfulCount": helpfulCount, +// "isVerified": isVerified, +// "verifiedPurchase": verifiedPurchase, +// "status": status, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// }; +// } + +// class Store { +// dynamic id; +// dynamic storeName; +// dynamic storeDescription; +// dynamic officialPhoneNumber; +// dynamic storeAddress; +// dynamic gstNumber; +// dynamic gumastaNumber; +// dynamic storePicture; +// DateTime?? createdAt; +// DateTime?? updatedAt; +// dynamic vendorId; +// bool? isActive; + +// Store({ +// this.id, +// this.storeName, +// this.storeDescription, +// this.officialPhoneNumber, +// this.storeAddress, +// this.gstNumber, +// this.gumastaNumber, +// this.storePicture, +// this.createdAt, +// this.updatedAt, +// this.vendorId, +// this.isActive, +// }); + +// factory Store.fromJson(Map json) => Store( +// id: json["id"], +// storeName: json["storeName"], +// storeDescription: json["storeDescription"], +// officialPhoneNumber: json["officialPhoneNumber"], +// storeAddress: json["storeAddress"], +// gstNumber: json["gstNumber"], +// gumastaNumber: json["gumastaNumber"], +// storePicture: json["storePicture"], +// createdAt:DateTime?.parse(json["createdAt"]), +// updatedAt:DateTime?.parse(json["updatedAt"]), +// vendorId: json["vendorId"], +// isActive: json["isActive"], +// ); + +// Map toJson() => { +// "id": id, +// "storeName": storeName, +// "storeDescription": storeDescription, +// "officialPhoneNumber": officialPhoneNumber, +// "storeAddress": storeAddress, +// "gstNumber": gstNumber, +// "gumastaNumber": gumastaNumber, +// "storePicture": storePicture, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "vendorId": vendorId, +// "isActive": isActive, +// }; +// } + +// class Meta { +// dynamic total; +// dynamic page; +// dynamic lastPage; + +// Meta({ +// this.total, +// this.page, +// this.lastPage, +// }); + +// factory Meta.fromJson(Map json) => Meta( +// total: json["total"], +// page: json["page"], +// lastPage: json["lastPage"], +// ); + +// Map toJson() => { +// "total": total, +// "page": page, +// "lastPage": lastPage, +// }; +// } + // To parse this JSON data, do // -// final allProductModel = allProductModelFromJson(jsonString); +// final allProductModel = allProductModelFromJson(jsondynamic); import 'dart:convert'; -AllProductModel allProductModelFromJson(String str) => +AllProductModel allProductModelFromJson(dynamic str) => AllProductModel.fromJson(json.decode(str)); -String allProductModelToJson(AllProductModel data) => +dynamic allProductModelToJson(AllProductModel data) => json.encode(data.toJson()); class AllProductModel { @@ -19,13 +420,13 @@ class AllProductModel { this.meta, }); - factory AllProductModel.fromJson(Map json) => + factory AllProductModel.fromJson(Map json) => AllProductModel( data: List.from(json["data"].map((x) => Product.fromJson(x))), meta: Meta.fromJson(json["meta"]), ); - Map toJson() => { + Map toJson() => { "data": List.from(data!.map((x) => x.toJson())), "meta": meta!.toJson(), }; @@ -43,9 +444,17 @@ class Product { dynamic quantity; dynamic unit; dynamic slug; - dynamic rating; - bool? isInStock; - bool? isActive; + dynamic averageRating; + dynamic isInStock; + dynamic isActive; + dynamic disclaimer; + dynamic customerCareDetails; + dynamic manufacturerName; + dynamic manufacturerAddress; + dynamic countryOfOrigin; + dynamic expiryDate; + dynamic returnsAllowedDays; + dynamic exchangeAllowedDays; DateTime? createdAt; DateTime? updatedAt; dynamic storeId; @@ -56,44 +465,61 @@ class Product { Category? category; dynamic productType; dynamic timeSlot; - dynamic isInWishlist; List? productImages; - List? productTags; + List? productTags; List? zones; + List? productHighlight; List? productReview; + List? questions; + List? cartItems; + List? wishlistItem; + List? applicableCoupons; - Product( - {this.id, - this.name, - this.description, - this.additionalInfo, - this.brand, - this.basePrice, - this.discountPrice, - this.stock, - this.quantity, - this.unit, - this.slug, - this.rating, - this.isInStock, - this.isActive, - this.createdAt, - this.updatedAt, - this.storeId, - this.categoryId, - this.productTypeId, - this.timeSlotId, - this.store, - this.category, - this.productType, - this.timeSlot, - this.productImages, - this.productTags, - this.zones, - this.productReview, - this.isInWishlist}); + Product({ + this.id, + this.name, + this.description, + this.additionalInfo, + this.brand, + this.basePrice, + this.discountPrice, + this.stock, + this.quantity, + this.unit, + this.slug, + this.averageRating, + this.isInStock, + this.isActive, + this.disclaimer, + this.customerCareDetails, + this.manufacturerName, + this.manufacturerAddress, + this.countryOfOrigin, + this.expiryDate, + this.returnsAllowedDays, + this.exchangeAllowedDays, + this.createdAt, + this.updatedAt, + this.storeId, + this.categoryId, + this.productTypeId, + this.timeSlotId, + this.store, + this.category, + this.productType, + this.timeSlot, + this.productImages, + this.productTags, + this.zones, + this.productHighlight, + this.productReview, + this.questions, + this.cartItems, + this.wishlistItem, + this.applicableCoupons, + }); - factory Product.fromJson(Map json) => Product( + factory Product.fromJson(Map json) => Product( id: json["id"], name: json["name"], description: json["description"], @@ -105,11 +531,19 @@ class Product { quantity: json["quantity"], unit: json["unit"], slug: json["slug"], - rating: json["rating"], + averageRating: json["averageRating"], isInStock: json["isInStock"], isActive: json["isActive"], - createdAt: DateTime.parse(json["createdAt"]), - updatedAt: DateTime.parse(json["updatedAt"]), + disclaimer: json["disclaimer"], + customerCareDetails: json["customerCareDetails"], + manufacturerName: json["manufacturerName"], + manufacturerAddress: json["manufacturerAddress"], + countryOfOrigin: json["countryOfOrigin"], + expiryDate: DateTime?.parse(json["expiryDate"]), + returnsAllowedDays: json["returnsAllowedDays"], + exchangeAllowedDays: json["exchangeAllowedDays"], + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), storeId: json["storeId"], categoryId: json["categoryId"], productTypeId: json["productTypeId"], @@ -120,14 +554,23 @@ class Product { timeSlot: json["timeSlot"], productImages: List.from( json["productImages"].map((x) => ProductImage.fromJson(x))), - productTags: List.from(json["productTags"].map((x) => x)), + productTags: List.from( + json["productTags"].map((x) => ProductTag.fromJson(x))), zones: List.from(json["zones"].map((x) => x)), + productHighlight: List.from( + json["ProductHighlight"].map((x) => ProductHighlight.fromJson(x))), productReview: List.from( json["ProductReview"].map((x) => ProductReview.fromJson(x))), - isInWishlist: json["isInWishlist"], + questions: List.from(json["questions"].map((x) => x)), + cartItems: List.from( + json["cartItems"].map((x) => CartItem.fromJson(x))), + wishlistItem: List.from( + json["WishlistItem"].map((x) => WishlistItem.fromJson(x))), + applicableCoupons: + List.from(json["applicableCoupons"].map((x) => x)), ); - Map toJson() => { + Map toJson() => { "id": id, "name": name, "description": description, @@ -139,9 +582,17 @@ class Product { "quantity": quantity, "unit": unit, "slug": slug, - "rating": rating, + "averageRating": averageRating, "isInStock": isInStock, "isActive": isActive, + "disclaimer": disclaimer, + "customerCareDetails": customerCareDetails, + "manufacturerName": manufacturerName, + "manufacturerAddress": manufacturerAddress, + "countryOfOrigin": countryOfOrigin, + "expiryDate": expiryDate, + "returnsAllowedDays": returnsAllowedDays, + "exchangeAllowedDays": exchangeAllowedDays, "createdAt": createdAt, "updatedAt": updatedAt, "storeId": storeId, @@ -154,15 +605,72 @@ class Product { "timeSlot": timeSlot, "productImages": List.from(productImages!.map((x) => x.toJson())), - "productTags": List.from(productTags!.map((x) => x)), + "productTags": List.from(productTags!.map((x) => x.toJson())), "zones": List.from(zones!.map((x) => x)), + "ProductHighlight": + List.from(productHighlight!.map((x) => x.toJson())), "ProductReview": List.from(productReview!.map((x) => x.toJson())), - "isInWishlist": isInWishlist, + "questions": List.from(questions!.map((x) => x)), + "cartItems": List.from(cartItems!.map((x) => x.toJson())), + "WishlistItem": + List.from(wishlistItem!.map((x) => x.toJson())), + "applicableCoupons": + List.from(applicableCoupons!.map((x) => x)), }; - } +class CartItem { + dynamic id; + dynamic quantity; + dynamic priceSnapshot; + dynamic cartId; + dynamic productId; + dynamic storeId; + DateTime? createdAt; + DateTime? updatedAt; + + CartItem({ + this.id, + this.quantity, + this.priceSnapshot, + this.cartId, + this.productId, + this.storeId, + this.createdAt, + this.updatedAt, + }); + + factory CartItem.fromJson(Map json) => CartItem( + id: json["id"], + quantity: json["quantity"], + priceSnapshot: json["priceSnapshot"], + cartId: json["cartId"], + productId: idValues.map[json["productId"]], + storeId: json["storeId"], + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + ); + + Map toJson() => { + "id": id, + "quantity": quantity, + "priceSnapshot": priceSnapshot, + "cartId": cartId, + "productId": idValues.reverse[productId], + "storeId": storeId, + "createdAt": createdAt, + "updatedAt": updatedAt, + }; +} + +enum Id { CM6_X4_PQQN0000_UYFOBAI380_ED, CM6_X5_O33_O000_OUYFO0_Y5_K28_IU } + +final idValues = EnumValues({ + "cm6x4pqqn0000uyfobai380ed": Id.CM6_X4_PQQN0000_UYFOBAI380_ED, + "cm6x5o33o000ouyfo0y5k28iu": Id.CM6_X5_O33_O000_OUYFO0_Y5_K28_IU +}); + class Category { dynamic id; dynamic name; @@ -170,9 +678,10 @@ class Category { dynamic image; dynamic slug; dynamic level; - bool? isActive; + dynamic isActive; DateTime? createdAt; DateTime? updatedAt; + dynamic commissionPercentage; dynamic parentCategoryId; dynamic path; @@ -186,11 +695,12 @@ class Category { this.isActive, this.createdAt, this.updatedAt, + this.commissionPercentage, this.parentCategoryId, this.path, }); - factory Category.fromJson(Map json) => Category( + factory Category.fromJson(Map json) => Category( id: json["id"], name: json["name"], description: json["description"], @@ -198,13 +708,14 @@ class Category { slug: json["slug"], level: json["level"], isActive: json["isActive"], - createdAt: DateTime.parse(json["createdAt"]), - updatedAt: DateTime.parse(json["updatedAt"]), + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + commissionPercentage: json["commissionPercentage"], parentCategoryId: json["parentCategoryId"], path: json["path"], ); - Map toJson() => { + Map toJson() => { "id": id, "name": name, "description": description, @@ -214,15 +725,53 @@ class Category { "isActive": isActive, "createdAt": createdAt, "updatedAt": updatedAt, + "commissionPercentage": commissionPercentage, "parentCategoryId": parentCategoryId, "path": path, }; } +class ProductHighlight { + dynamic id; + dynamic key; + dynamic value; + dynamic productId; + DateTime? createdAt; + DateTime? updatedAt; + + ProductHighlight({ + this.id, + this.key, + this.value, + this.productId, + this.createdAt, + this.updatedAt, + }); + + factory ProductHighlight.fromJson(Map json) => + ProductHighlight( + id: json["id"], + key: json["key"], + value: json["value"], + productId: idValues.map[json["productId"]], + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + ); + + Map toJson() => { + "id": id, + "key": key, + "value": value, + "productId": idValues.reverse[productId], + "createdAt": createdAt, + "updatedAt": updatedAt, + }; +} + class ProductImage { dynamic id; dynamic url; - bool? isDefault; + dynamic isDefault; dynamic productId; ProductImage({ @@ -232,18 +781,18 @@ class ProductImage { this.productId, }); - factory ProductImage.fromJson(Map json) => ProductImage( + factory ProductImage.fromJson(Map json) => ProductImage( id: json["id"], url: json["url"], isDefault: json["isDefault"], - productId: json["productId"], + productId: idValues.map[json["productId"]], ); - Map toJson() => { + Map toJson() => { "id": id, "url": url, "isDefault": isDefault, - "productId": productId, + "productId": idValues.reverse[productId], }; } @@ -257,11 +806,12 @@ class ProductReview { dynamic likes; dynamic dislikes; dynamic helpfulCount; - bool? isVerified; - bool? verifiedPurchase; + dynamic verifiedPurchase; dynamic status; DateTime? createdAt; DateTime? updatedAt; + User? user; + List? productReviewImage; ProductReview({ this.id, @@ -273,105 +823,336 @@ class ProductReview { this.likes, this.dislikes, this.helpfulCount, - this.isVerified, this.verifiedPurchase, this.status, this.createdAt, this.updatedAt, + this.user, + this.productReviewImage, }); - factory ProductReview.fromJson(Map json) => ProductReview( + factory ProductReview.fromJson(Map json) => ProductReview( id: json["id"], userId: json["userId"], - productId: json["productId"], + productId: idValues.map[json["productId"]], rating: json["rating"], title: json["title"], description: json["description"], likes: json["likes"], dislikes: json["dislikes"], helpfulCount: json["helpfulCount"], - isVerified: json["isVerified"], verifiedPurchase: json["verifiedPurchase"], status: json["status"], - createdAt: DateTime.parse(json["createdAt"]), - updatedAt: DateTime.parse(json["updatedAt"]), + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + user: User.fromJson(json["user"]), + productReviewImage: List.from( + json["ProductReviewImage"] + .map((x) => ProductReviewImage.fromJson(x))), ); - Map toJson() => { + Map toJson() => { "id": id, "userId": userId, - "productId": productId, + "productId": idValues.reverse[productId], "rating": rating, "title": title, "description": description, "likes": likes, "dislikes": dislikes, "helpfulCount": helpfulCount, - "isVerified": isVerified, "verifiedPurchase": verifiedPurchase, "status": status, "createdAt": createdAt, "updatedAt": updatedAt, + "user": user!.toJson(), + "ProductReviewImage": + List.from(productReviewImage!.map((x) => x.toJson())), + }; +} + +class ProductReviewImage { + dynamic id; + dynamic reviewId; + dynamic imageUrl; + dynamic isDefault; + DateTime? createdAt; + + ProductReviewImage({ + this.id, + this.reviewId, + this.imageUrl, + this.isDefault, + this.createdAt, + }); + + factory ProductReviewImage.fromJson(Map json) => + ProductReviewImage( + id: json["id"], + reviewId: json["reviewId"], + imageUrl: json["imageUrl"], + isDefault: json["isDefault"], + createdAt: DateTime?.parse(json["createdAt"]), + ); + + Map toJson() => { + "id": id, + "reviewId": reviewId, + "imageUrl": imageUrl, + "isDefault": isDefault, + "createdAt": createdAt, + }; +} + +class User { + dynamic id; + dynamic email; + dynamic firstName; + dynamic lastName; + dynamic name; + dynamic img; + dynamic authType; + dynamic role; + dynamic phone; + dynamic password; + dynamic isActive; + dynamic isPhoneVerified; + dynamic vendorType; + dynamic businessId; + dynamic isVendorAccountCreated; + dynamic isVendorAccountActive; + dynamic vendorTermsAccepted; + DateTime? createdAt; + DateTime? updatedAt; + dynamic rtHash; + dynamic resetToken; + dynamic resetTokenExpiresAt; + + User({ + this.id, + this.email, + this.firstName, + this.lastName, + this.name, + this.img, + this.authType, + this.role, + this.phone, + this.password, + this.isActive, + this.isPhoneVerified, + this.vendorType, + this.businessId, + this.isVendorAccountCreated, + this.isVendorAccountActive, + this.vendorTermsAccepted, + this.createdAt, + this.updatedAt, + this.rtHash, + this.resetToken, + this.resetTokenExpiresAt, + }); + + factory User.fromJson(Map json) => User( + id: json["id"], + email: json["email"], + firstName: json["firstName"], + lastName: json["lastName"], + name: json["name"], + img: json["img"], + authType: json["authType"], + role: json["role"], + phone: json["phone"], + password: json["password"], + isActive: json["isActive"], + isPhoneVerified: json["isPhoneVerified"], + vendorType: json["vendorType"], + businessId: json["businessId"], + isVendorAccountCreated: json["isVendorAccountCreated"], + isVendorAccountActive: json["isVendorAccountActive"], + vendorTermsAccepted: json["vendorTermsAccepted"], + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + rtHash: json["rtHash"], + resetToken: json["resetToken"], + resetTokenExpiresAt: json["resetTokenExpiresAt"], + ); + + Map toJson() => { + "id": id, + "email": email, + "firstName": firstName, + "lastName": lastName, + "name": name, + "img": img, + "authType": authType, + "role": role, + "phone": phone, + "password": password, + "isActive": isActive, + "isPhoneVerified": isPhoneVerified, + "vendorType": vendorType, + "businessId": businessId, + "isVendorAccountCreated": isVendorAccountCreated, + "isVendorAccountActive": isVendorAccountActive, + "vendorTermsAccepted": vendorTermsAccepted, + "createdAt": createdAt, + "updatedAt": updatedAt, + "rtHash": rtHash, + "resetToken": resetToken, + "resetTokenExpiresAt": resetTokenExpiresAt, + }; +} + +class ProductTag { + dynamic id; + dynamic name; + dynamic description; + dynamic isActive; + DateTime? createdAt; + DateTime? updatedAt; + + ProductTag({ + this.id, + this.name, + this.description, + this.isActive, + this.createdAt, + this.updatedAt, + }); + + factory ProductTag.fromJson(Map json) => ProductTag( + id: json["id"], + name: json["name"], + description: descriptionValues.map[json["description"]], + isActive: json["isActive"], + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "description": descriptionValues.reverse[description], + "isActive": isActive, + "createdAt": createdAt, + "updatedAt": updatedAt, }; } +enum Description { BEST_PRODUCT, SAMSUNG_PHONES, TOP_PRODUCT } + +final descriptionValues = EnumValues({ + "best product": Description.BEST_PRODUCT, + "Samsung phones \ud83d\udc96": Description.SAMSUNG_PHONES, + "top product": Description.TOP_PRODUCT +}); + class Store { dynamic id; dynamic storeName; - dynamic storeDescription; - dynamic officialPhoneNumber; - dynamic storeAddress; - dynamic gstNumber; - dynamic gumastaNumber; dynamic storePicture; - DateTime? createdAt; - DateTime? updatedAt; - dynamic vendorId; - bool? isActive; + dynamic storeAddress; + dynamic officialPhoneNumber; + dynamic sellerLicenseNumber; + Vendor? vendor; Store({ this.id, this.storeName, - this.storeDescription, - this.officialPhoneNumber, - this.storeAddress, - this.gstNumber, - this.gumastaNumber, this.storePicture, - this.createdAt, - this.updatedAt, - this.vendorId, - this.isActive, + this.storeAddress, + this.officialPhoneNumber, + this.sellerLicenseNumber, + this.vendor, }); - factory Store.fromJson(Map json) => Store( + factory Store.fromJson(Map json) => Store( id: json["id"], storeName: json["storeName"], - storeDescription: json["storeDescription"], - officialPhoneNumber: json["officialPhoneNumber"], - storeAddress: json["storeAddress"], - gstNumber: json["gstNumber"], - gumastaNumber: json["gumastaNumber"], storePicture: json["storePicture"], - createdAt: DateTime.parse(json["createdAt"]), - updatedAt: DateTime.parse(json["updatedAt"]), - vendorId: json["vendorId"], - isActive: json["isActive"], + storeAddress: json["storeAddress"], + officialPhoneNumber: json["officialPhoneNumber"], + sellerLicenseNumber: json["sellerLicenseNumber"], + vendor: Vendor.fromJson(json["vendor"]), ); - Map toJson() => { + Map toJson() => { "id": id, "storeName": storeName, - "storeDescription": storeDescription, - "officialPhoneNumber": officialPhoneNumber, - "storeAddress": storeAddress, - "gstNumber": gstNumber, - "gumastaNumber": gumastaNumber, "storePicture": storePicture, + "storeAddress": storeAddress, + "officialPhoneNumber": officialPhoneNumber, + "sellerLicenseNumber": sellerLicenseNumber, + "vendor": vendor!.toJson(), + }; +} + +class Vendor { + dynamic id; + dynamic email; + dynamic firstName; + dynamic lastName; + dynamic phone; + + Vendor({ + this.id, + this.email, + this.firstName, + this.lastName, + this.phone, + }); + + factory Vendor.fromJson(Map json) => Vendor( + id: json["id"], + email: json["email"], + firstName: json["firstName"], + lastName: json["lastName"], + phone: json["phone"], + ); + + Map toJson() => { + "id": id, + "email": email, + "firstName": firstName, + "lastName": lastName, + "phone": phone, + }; +} + +class WishlistItem { + dynamic id; + dynamic wishlistId; + dynamic productId; + dynamic storeId; + DateTime? createdAt; + DateTime? updatedAt; + + WishlistItem({ + this.id, + this.wishlistId, + this.productId, + this.storeId, + this.createdAt, + this.updatedAt, + }); + + factory WishlistItem.fromJson(Map json) => WishlistItem( + id: json["id"], + wishlistId: json["wishlistId"], + productId: idValues.map[json["productId"]], + storeId: json["storeId"], + createdAt: DateTime?.parse(json["createdAt"]), + updatedAt: DateTime?.parse(json["updatedAt"]), + ); + + Map toJson() => { + "id": id, + "wishlistId": wishlistId, + "productId": idValues.reverse[productId], + "storeId": storeId, "createdAt": createdAt, "updatedAt": updatedAt, - "vendorId": vendorId, - "isActive": isActive, }; } @@ -386,15 +1167,27 @@ class Meta { this.lastPage, }); - factory Meta.fromJson(Map json) => Meta( + factory Meta.fromJson(Map json) => Meta( total: json["total"], page: json["page"], lastPage: json["lastPage"], ); - Map toJson() => { + Map toJson() => { "total": total, "page": page, "lastPage": lastPage, }; } + +class EnumValues { + Map map; + late Map reverseMap; + + EnumValues(this.map); + + Map get reverse { + reverseMap = map.map((k, v) => MapEntry(v, k)); + return reverseMap; + } +} diff --git a/lib/src/data/coupon_model.dart b/lib/src/data/coupon_model.dart new file mode 100644 index 0000000..fceaeaf --- /dev/null +++ b/lib/src/data/coupon_model.dart @@ -0,0 +1,165 @@ +// To parse this JSON data, do +// +// final couponData = couponDataFromJson(jsondynamic); + +import 'dart:convert'; + +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; + + 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))), + total: json["total"], + page: json["page"], + limit: json["limit"], + ); + + 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; + + 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, + }); + + factory CouponDatum.fromJson(Map json) => CouponDatum( + id: json["id"], + code: json["code"], + type: json["type"], + discountValue: json["discountValue"], + maxDiscountAmount: json["maxDiscountAmount"], + minPurchaseAmount: json["minPurchaseAmount"], + startDate: DateTime.parse(json["startDate"]), + endDate: DateTime.parse(json["endDate"]), + totalUsageLimit: json["totalUsageLimit"], + perUserUsageLimit: json["perUserUsageLimit"], + applicability: json["applicability"], + status: json["status"], + description: json["description"], + terms: json["terms"], + buyQuantity: json["buyQuantity"], + getQuantity: json["getQuantity"], + 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)), + 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)), + ); + + Map toJson() => { + "id": id, + "code": code, + "type": type, + "discountValue": discountValue, + "maxDiscountAmount": maxDiscountAmount, + "minPurchaseAmount": minPurchaseAmount, + "startDate": startDate, + "endDate": endDate, + "totalUsageLimit": totalUsageLimit, + "perUserUsageLimit": perUserUsageLimit, + "applicability": applicability, + "status": status, + "description": description, + "terms": terms, + "buyQuantity": buyQuantity, + "getQuantity": getQuantity, + "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)), + "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)), + }; +} diff --git a/lib/src/data/coupon_response.dart b/lib/src/data/coupon_response.dart new file mode 100644 index 0000000..0205551 --- /dev/null +++ b/lib/src/data/coupon_response.dart @@ -0,0 +1,69 @@ +// To parse this JSON data, do +// +// final couponResponse = couponResponseFromJson(jsonString); + +import 'dart:convert'; + +CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str)); + +String couponResponseToJson(CouponResponse data) => json.encode(data.toJson()); + +class CouponResponse { + bool? isValid; + String? originalPrice; + int? discountAmount; + int? finalPrice; + String? message; + CouponDetails? couponDetails; + + CouponResponse({ + this.isValid, + this.originalPrice, + this.discountAmount, + this.finalPrice, + this.message, + this.couponDetails, + }); + + factory CouponResponse.fromJson(Map json) => CouponResponse( + isValid: json["isValid"], + originalPrice: json["originalPrice"], + discountAmount: json["discountAmount"], + finalPrice: json["finalPrice"], + message: json["message"], + couponDetails: CouponDetails.fromJson(json["couponDetails"]), + ); + + Map toJson() => { + "isValid": isValid, + "originalPrice": originalPrice, + "discountAmount": discountAmount, + "finalPrice": finalPrice, + "message": message, + "couponDetails": couponDetails!.toJson(), + }; +} + +class CouponDetails { + String? code; + String? type; + String? discountValue; + + CouponDetails({ + this.code, + this.type, + this.discountValue, + }); + + factory CouponDetails.fromJson(Map json) => CouponDetails( + code: json["code"], + type: json["type"], + discountValue: json["discountValue"], + ); + + Map toJson() => { + "code": code, + "type": type, + "discountValue": discountValue, + }; +} diff --git a/lib/src/data/myOrder.dart b/lib/src/data/myOrder.dart index 359266c..11e54ba 100644 --- a/lib/src/data/myOrder.dart +++ b/lib/src/data/myOrder.dart @@ -1,3 +1,689 @@ +// // To parse this JSON data, do +// // +// // final myOrder = myOrderFromJson(jsondynamic); + +// import 'dart:convert'; + +// MyOrder myOrderFromJson(dynamic str) => MyOrder.fromJson(json.decode(str)); + +// dynamic myOrderToJson(MyOrder data) => json.encode(data.toJson()); + +// class MyOrder { +// List? data; +// Meta? meta; + +// MyOrder({ +// this.data, +// this.meta, +// }); + +// factory MyOrder.fromJson(Map json) => MyOrder( +// data: List.from(json["data"].map((x) => Datum.fromJson(x))), +// meta: Meta.fromJson(json["meta"]), +// ); + +// Map toJson() => { +// "data": List.from(data!.map((x) => x.toJson())), +// "meta": meta!.toJson(), +// }; +// } + +// class Datum { +// dynamic id; +// dynamic orderNumber; +// dynamic userId; +// int? totalItems; +// dynamic subtotal; +// dynamic deliveryCharge; +// dynamic discount; +// dynamic grandTotal; +// dynamic paymentMethod; +// dynamic paymentStatus; +// dynamic transactionId; +// dynamic orderStatus; +// dynamic deliveryAddressId; +// dynamic couponId; +// dynamic cancelReason; +// dynamic cancelledBy; +// dynamic cancelledAt; +// DateTime? createdAt; +// DateTime? updatedAt; +// User? user; +// List? orderItems; +// DeliveryAddress? deliveryAddress; + +// List? statusHistory; +// List? stores; + +// Datum({ +// this.id, +// this.orderNumber, +// this.userId, +// this.totalItems, +// this.subtotal, +// this.deliveryCharge, +// this.discount, +// this.grandTotal, +// this.paymentMethod, +// this.paymentStatus, +// this.transactionId, +// this.orderStatus, +// this.deliveryAddressId, +// this.couponId, +// this.cancelReason, +// this.cancelledBy, +// this.cancelledAt, +// this.createdAt, +// this.updatedAt, +// this.user, +// this.orderItems, +// this.deliveryAddress, +// this.statusHistory, +// this.stores, +// }); + +// factory Datum.fromJson(Map json) => Datum( +// id: json["id"], +// orderNumber: json["orderNumber"], +// userId: json["userId"], +// totalItems: json["totalItems"], +// subtotal: json["subtotal"], +// deliveryCharge: json["deliveryCharge"], +// discount: json["discount"], +// grandTotal: json["grandTotal"], +// paymentMethod: json["paymentMethod"], +// paymentStatus: json["paymentStatus"], +// transactionId: json["transactionId"], +// orderStatus: json["orderStatus"], +// deliveryAddressId: json["deliveryAddressId"], +// couponId: json["couponId"], +// cancelReason: json["cancelReason"], +// cancelledBy: json["cancelledBy"], +// cancelledAt: json["cancelledAt"], +// createdAt: DateTime?.parse(json["createdAt"]), +// updatedAt: DateTime?.parse(json["updatedAt"]), +// user: User.fromJson(json["user"]), +// orderItems: List.from( +// json["orderItems"].map((x) => OrderItem.fromJson(x))), +// deliveryAddress: DeliveryAddress.fromJson(json["deliveryAddress"]), +// statusHistory: List.from( +// json["statusHistory"].map((x) => StatusHistory.fromJson(x))), +// stores: List.from(json["stores"].map((x) => Store.fromJson(x))), +// ); + +// Map toJson() => { +// "id": id, +// "orderNumber": orderNumber, +// "userId": userId, +// "totalItems": totalItems, +// "subtotal": subtotal, +// "deliveryCharge": deliveryCharge, +// "discount": discount, +// "grandTotal": grandTotal, +// "paymentMethod": paymentMethod, +// "paymentStatus": paymentStatus, +// "transactionId": transactionId, +// "orderStatus": orderStatus, +// "deliveryAddressId": deliveryAddressId, +// "couponId": couponId, +// "cancelReason": cancelReason, +// "cancelledBy": cancelledBy, +// "cancelledAt": cancelledAt, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "user": user!.toJson(), +// "orderItems": List.from(orderItems!.map((x) => x.toJson())), +// "deliveryAddress": deliveryAddress!.toJson(), +// "statusHistory": +// List.from(statusHistory!.map((x) => x.toJson())), +// "stores": List.from(stores!.map((x) => x.toJson())), +// }; +// } + +// class DeliveryAddress { +// dynamic id; +// dynamic pincode; +// dynamic phoneNumber; +// dynamic alternatePhoneNumber; +// dynamic addressLine; +// dynamic landmark; +// dynamic addressType; +// dynamic city; +// dynamic district; +// dynamic name; +// dynamic state; +// dynamic country; +// bool? isDeliverable; +// bool? isDefault; +// dynamic additionalInstructions; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic userId; + +// DeliveryAddress({ +// this.id, +// this.pincode, +// this.phoneNumber, +// this.alternatePhoneNumber, +// this.addressLine, +// this.landmark, +// this.addressType, +// this.city, +// this.district, +// this.name, +// this.state, +// this.country, +// this.isDeliverable, +// this.isDefault, +// this.additionalInstructions, +// this.createdAt, +// this.updatedAt, +// this.userId, +// }); + +// factory DeliveryAddress.fromJson(Map json) => +// DeliveryAddress( +// id: json["id"], +// pincode: json["pincode"], +// phoneNumber: json["phoneNumber"], +// alternatePhoneNumber: json["alternatePhoneNumber"], +// addressLine: json["addressLine"], +// landmark: json["landmark"], +// addressType: json["addressType"], +// city: json["city"], +// district: json["district"], +// name: json["name"], +// state: json["state"], +// country: json["country"], +// isDeliverable: json["isDeliverable"], +// isDefault: json["isDefault"], +// additionalInstructions: json["additionalInstructions"], +// createdAt: DateTime?.parse(json["createdAt"]), +// updatedAt: DateTime?.parse(json["updatedAt"]), +// userId: json["userId"], +// ); + +// Map toJson() => { +// "id": id, +// "pincode": pincode, +// "phoneNumber": phoneNumber, +// "alternatePhoneNumber": alternatePhoneNumber, +// "addressLine": addressLine, +// "landmark": landmark, +// "addressType": addressType, +// "city": city, +// "district": district, +// "name": name, +// "state": state, +// "country": country, +// "isDeliverable": isDeliverable, +// "isDefault": isDefault, +// "additionalInstructions": additionalInstructions, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "userId": userId, +// }; +// } + +// class OrderItem { +// dynamic id; +// dynamic orderId; +// dynamic productId; +// dynamic storeId; +// dynamic productName; +// dynamic productImage; +// dynamic productVariant; +// int? quantity; +// dynamic price; +// dynamic originalPrice; +// dynamic discountAmount; +// DateTime? createdAt; +// DateTime? updatedAt; +// Product? product; +// // Store? store; + +// OrderItem({ +// this.id, +// this.orderId, +// this.productId, +// this.storeId, +// this.productName, +// this.productImage, +// this.productVariant, +// this.quantity, +// this.price, +// this.originalPrice, +// this.discountAmount, +// this.createdAt, +// this.updatedAt, +// this.product, +// // this.store, +// }); + +// factory OrderItem.fromJson(Map json) => OrderItem( +// id: json["id"], +// orderId: json["orderId"], +// productId: json["productId"], +// storeId: json["storeId"], +// productName: json["productName"], +// productImage: json["productImage"], +// productVariant: json["productVariant"], +// quantity: json["quantity"], +// price: json["price"], +// originalPrice: json["originalPrice"], +// discountAmount: json["discountAmount"], +// createdAt: DateTime?.parse(json["createdAt"]), +// updatedAt: DateTime?.parse(json["updatedAt"]), +// product: Product.fromJson(json["product"]), +// // store: Store.fromJson(json["store"]), +// ); + +// Map toJson() => { +// "id": id, +// "orderId": orderId, +// "productId": productId, +// "storeId": storeId, +// "productName": productName, +// "productImage": productImage, +// "productVariant": productVariant, +// "quantity": quantity, +// "price": price, +// "originalPrice": originalPrice, +// "discountAmount": discountAmount, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "product": product!.toJson(), +// // "store": store!.toJson(), +// }; +// } + +// class Product { +// dynamic id; +// dynamic name; +// dynamic description; +// dynamic additionalInfo; +// dynamic brand; +// dynamic basePrice; +// dynamic discountPrice; +// int? stock; +// int? quantity; +// dynamic unit; +// dynamic slug; +// dynamic averageRating; +// bool? isInStock; +// bool? isActive; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic storeId; +// dynamic categoryId; +// dynamic productTypeId; +// dynamic timeSlotId; +// List? productImages; +// Category? category; +// dynamic? productType; + +// Product({ +// this.id, +// this.name, +// this.description, +// this.additionalInfo, +// this.brand, +// this.basePrice, +// this.discountPrice, +// this.stock, +// this.quantity, +// this.unit, +// this.slug, +// this.averageRating, +// this.isInStock, +// this.isActive, +// this.createdAt, +// this.updatedAt, +// this.storeId, +// this.categoryId, +// this.productTypeId, +// this.timeSlotId, +// this.productImages, +// this.category, +// this.productType, +// }); + +// factory Product.fromJson(Map json) => Product( +// id: json["id"], +// name: json["name"], +// description: json["description"], +// additionalInfo: json["additionalInfo"], +// brand: json["brand"], +// basePrice: json["basePrice"], +// discountPrice: json["discountPrice"], +// stock: json["stock"], +// quantity: json["quantity"], +// unit: json["unit"], +// slug: json["slug"], +// averageRating: json["averageRating"], +// isInStock: json["isInStock"], +// isActive: json["isActive"], +// createdAt: DateTime?.parse(json["createdAt"]), +// updatedAt: DateTime?.parse(json["updatedAt"]), +// storeId: json["storeId"], +// categoryId: json["categoryId"], +// productTypeId: json["productTypeId"], +// timeSlotId: json["timeSlotId"], +// productImages: List.from( +// json["productImages"].map((x) => ProductImage.fromJson(x))), +// category: Category.fromJson(json["category"]), +// productType: json["productType"], +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "description": description, +// "additionalInfo": additionalInfo, +// "brand": brand, +// "basePrice": basePrice, +// "discountPrice": discountPrice, +// "stock": stock, +// "quantity": quantity, +// "unit": unit, +// "slug": slug, +// "averageRating": averageRating, +// "isInStock": isInStock, +// "isActive": isActive, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "storeId": storeId, +// "categoryId": categoryId, +// "productTypeId": productTypeId, +// "timeSlotId": timeSlotId, +// "productImages": +// List.from(productImages!.map((x) => x.toJson())), +// "category": category!.toJson(), +// "productType": productType, +// }; +// } + +// class Category { +// dynamic id; +// dynamic name; +// dynamic path; + +// Category({ +// this.id, +// this.name, +// this.path, +// }); + +// factory Category.fromJson(Map json) => Category( +// id: json["id"], +// name: json["name"], +// path: json["path"], +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "path": path, +// }; +// } + +// class ProductImage { +// dynamic id; +// dynamic url; +// bool? isDefault; +// dynamic productId; + +// ProductImage({ +// this.id, +// this.url, +// this.isDefault, +// this.productId, +// }); + +// factory ProductImage.fromJson(Map json) => ProductImage( +// id: json["id"], +// url: json["url"], +// isDefault: json["isDefault"], +// productId: json["productId"], +// ); + +// Map toJson() => { +// "id": id, +// "url": url, +// "isDefault": isDefault, +// "productId": productId, +// }; +// } + +// class Store { +// dynamic id; +// dynamic storeName; +// dynamic storePicture; +// dynamic storeAddress; +// dynamic officialPhoneNumber; +// User? vendor; +// OperateDates? operateDates; +// OperateTimes? operateTimes; + +// Store({ +// this.id, +// this.storeName, +// this.storePicture, +// this.storeAddress, +// this.officialPhoneNumber, +// this.vendor, +// this.operateDates, +// this.operateTimes, +// }); + +// factory Store.fromJson(Map json) => Store( +// id: json["id"], +// storeName: json["storeName"], +// storePicture: json["storePicture"], +// storeAddress: json["storeAddress"], +// officialPhoneNumber: json["officialPhoneNumber"], +// vendor: User.fromJson(json["vendor"]), +// operateDates: OperateDates.fromJson(json["operateDates"]), +// operateTimes: OperateTimes.fromJson(json["operateTimes"]), +// ); + +// Map toJson() => { +// "id": id, +// "storeName": storeName, +// "storePicture": storePicture, +// "storeAddress": storeAddress, +// "officialPhoneNumber": officialPhoneNumber, +// "vendor": vendor!.toJson(), +// "operateDates": operateDates!.toJson(), +// "operateTimes": operateTimes!.toJson(), +// }; +// } + +// class OperateDates { +// dynamic id; +// bool? monday; +// bool? tuesday; +// bool? wednesday; +// bool? thursday; +// bool? friday; +// bool? saturday; +// bool? sunday; +// dynamic storeId; + +// OperateDates({ +// this.id, +// this.monday, +// this.tuesday, +// this.wednesday, +// this.thursday, +// this.friday, +// this.saturday, +// this.sunday, +// this.storeId, +// }); + +// factory OperateDates.fromJson(Map json) => OperateDates( +// id: json["id"], +// monday: json["monday"], +// tuesday: json["tuesday"], +// wednesday: json["wednesday"], +// thursday: json["thursday"], +// friday: json["friday"], +// saturday: json["saturday"], +// sunday: json["sunday"], +// storeId: json["storeId"], +// ); + +// Map toJson() => { +// "id": id, +// "monday": monday, +// "tuesday": tuesday, +// "wednesday": wednesday, +// "thursday": thursday, +// "friday": friday, +// "saturday": saturday, +// "sunday": sunday, +// "storeId": storeId, +// }; +// } + +// class OperateTimes { +// dynamic id; +// dynamic startTime; +// dynamic endTime; +// dynamic storeId; + +// OperateTimes({ +// this.id, +// this.startTime, +// this.endTime, +// this.storeId, +// }); + +// factory OperateTimes.fromJson(Map json) => OperateTimes( +// id: json["id"], +// startTime: json["startTime"], +// endTime: json["endTime"], +// storeId: json["storeId"], +// ); + +// Map toJson() => { +// "id": id, +// "startTime": startTime, +// "endTime": endTime, +// "storeId": storeId, +// }; +// } + +// class User { +// dynamic id; +// dynamic email; +// dynamic firstName; +// dynamic lastName; +// dynamic phone; +// dynamic role; + +// User({ +// this.id, +// this.email, +// this.firstName, +// this.lastName, +// this.phone, +// this.role, +// }); + +// factory User.fromJson(Map json) => User( +// id: json["id"], +// email: json["email"], +// firstName: json["firstName"], +// lastName: json["lastName"], +// phone: json["phone"], +// role: json["role"], +// ); + +// Map toJson() => { +// "id": id, +// "email": email, +// "firstName": firstName, +// "lastName": lastName, +// "phone": phone, +// "role": role, +// }; +// } + +// class StatusHistory { +// dynamic id; +// dynamic orderId; +// dynamic status; +// dynamic comment; +// dynamic updatedBy; +// DateTime? createdAt; + +// StatusHistory({ +// this.id, +// this.orderId, +// this.status, +// this.comment, +// this.updatedBy, +// this.createdAt, +// }); + +// factory StatusHistory.fromJson(Map json) => StatusHistory( +// id: json["id"], +// orderId: json["orderId"], +// status: json["status"], +// comment: json["comment"], +// updatedBy: json["updatedBy"], +// createdAt: DateTime?.parse(json["createdAt"]), +// ); + +// Map toJson() => { +// "id": id, +// "orderId": orderId, +// "status": status, +// "comment": comment, +// "updatedBy": updatedBy, +// "createdAt": createdAt, +// }; +// } + +// class Meta { +// int? total; +// int? page; +// int? limit; +// int? lastPage; +// bool? hasNextPage; +// bool? hasPreviousPage; + +// Meta({ +// this.total, +// this.page, +// this.limit, +// this.lastPage, +// this.hasNextPage, +// this.hasPreviousPage, +// }); + +// factory Meta.fromJson(Map json) => Meta( +// total: json["total"], +// page: json["page"], +// limit: json["limit"], +// lastPage: json["lastPage"], +// hasNextPage: json["hasNextPage"], +// hasPreviousPage: json["hasPreviousPage"], +// ); + +// Map toJson() => { +// "total": total, +// "page": page, +// "limit": limit, +// "lastPage": lastPage, +// "hasNextPage": hasNextPage, +// "hasPreviousPage": hasPreviousPage, +// }; +// } + + // To parse this JSON data, do // // final myOrder = myOrderFromJson(jsondynamic); @@ -9,88 +695,79 @@ MyOrder myOrderFromJson(dynamic str) => MyOrder.fromJson(json.decode(str)); dynamic myOrderToJson(MyOrder data) => json.encode(data.toJson()); class MyOrder { - List? data; - Meta? meta; + List? data; + Meta? meta; - MyOrder({ - this.data, - this.meta, - }); + MyOrder({ + this.data, + this.meta, + }); - factory MyOrder.fromJson(Map json) => MyOrder( + factory MyOrder.fromJson(Map json) => MyOrder( data: List.from(json["data"].map((x) => Datum.fromJson(x))), meta: Meta.fromJson(json["meta"]), - ); + ); - Map toJson() => { + Map toJson() => { "data": List.from(data!.map((x) => x.toJson())), "meta": meta!.toJson(), - }; + }; } class Datum { - dynamic id; - dynamic orderNumber; - dynamic userId; - int? totalItems; - dynamic subtotal; - dynamic deliveryCharge; - dynamic discount; - dynamic grandTotal; - dynamic paymentMethod; - dynamic paymentStatus; - dynamic transactionId; - dynamic orderStatus; - dynamic deliveryAddressId; - dynamic couponId; - dynamic cancelReason; - dynamic cancelledBy; - dynamic cancelledAt; - DateTime? createdAt; - DateTime? updatedAt; - User? user; - List? orderItems; - DeliveryAddress? deliveryAddress; + dynamic id; + dynamic orderNumber; + dynamic userId; + dynamic totalItems; + dynamic subtotal; + dynamic deliveryCharge; + dynamic paymentMethod; + dynamic paymentStatus; + dynamic transactionId; + dynamic orderStatus; + dynamic deliveryAddressId; + dynamic couponId; + dynamic cancelReason; + dynamic cancelledBy; + dynamic cancelledAt; + DateTime? createdAt; + DateTime? updatedAt; + User? user; + DeliveryAddress? deliveryAddress; + List? orderItems; + List? statusHistory; - List? statusHistory; - List? stores; + Datum({ + this.id, + this.orderNumber, + this.userId, + this.totalItems, + this.subtotal, + this.deliveryCharge, + this.paymentMethod, + this.paymentStatus, + this.transactionId, + this.orderStatus, + this.deliveryAddressId, + this.couponId, + this.cancelReason, + this.cancelledBy, + this.cancelledAt, + this.createdAt, + this.updatedAt, + this.user, + this.deliveryAddress, + this.orderItems, + this.statusHistory, + }); - Datum({ - this.id, - this.orderNumber, - this.userId, - this.totalItems, - this.subtotal, - this.deliveryCharge, - this.discount, - this.grandTotal, - this.paymentMethod, - this.paymentStatus, - this.transactionId, - this.orderStatus, - this.deliveryAddressId, - this.couponId, - this.cancelReason, - this.cancelledBy, - this.cancelledAt, - this.createdAt, - this.updatedAt, - this.user, - this.orderItems, - this.deliveryAddress, - this.statusHistory, - this.stores, - }); - - factory Datum.fromJson(Map json) => Datum( + factory Datum.fromJson(Map json) => Datum( id: json["id"], orderNumber: json["orderNumber"], userId: json["userId"], totalItems: json["totalItems"], subtotal: json["subtotal"], deliveryCharge: json["deliveryCharge"], - discount: json["discount"], - grandTotal: json["grandTotal"], paymentMethod: json["paymentMethod"], paymentStatus: json["paymentStatus"], transactionId: json["transactionId"], @@ -100,26 +777,21 @@ class Datum { cancelReason: json["cancelReason"], cancelledBy: json["cancelledBy"], cancelledAt: json["cancelledAt"], - createdAt: DateTime?.parse(json["createdAt"]), - updatedAt: DateTime?.parse(json["updatedAt"]), + createdAt: DateTime.parse(json["createdAt"]), + updatedAt: DateTime.parse(json["updatedAt"]), user: User.fromJson(json["user"]), - orderItems: List.from( - json["orderItems"].map((x) => OrderItem.fromJson(x))), deliveryAddress: DeliveryAddress.fromJson(json["deliveryAddress"]), - statusHistory: List.from( - json["statusHistory"].map((x) => StatusHistory.fromJson(x))), - stores: List.from(json["stores"].map((x) => Store.fromJson(x))), - ); + orderItems: List.from(json["orderItems"].map((x) => OrderItem.fromJson(x))), + statusHistory: List.from(json["statusHistory"].map((x) => StatusHistory.fromJson(x))), + ); - Map toJson() => { + Map toJson() => { "id": id, "orderNumber": orderNumber, "userId": userId, "totalItems": totalItems, "subtotal": subtotal, "deliveryCharge": deliveryCharge, - "discount": discount, - "grandTotal": grandTotal, "paymentMethod": paymentMethod, "paymentStatus": paymentStatus, "transactionId": transactionId, @@ -132,57 +804,54 @@ class Datum { "createdAt": createdAt, "updatedAt": updatedAt, "user": user!.toJson(), - "orderItems": List.from(orderItems!.map((x) => x.toJson())), "deliveryAddress": deliveryAddress!.toJson(), - "statusHistory": - List.from(statusHistory!.map((x) => x.toJson())), - "stores": List.from(stores!.map((x) => x.toJson())), - }; + "orderItems": List.from(orderItems!.map((x) => x.toJson())), + "statusHistory": List.from(statusHistory!.map((x) => x.toJson())), + }; } class DeliveryAddress { - dynamic id; - dynamic pincode; - dynamic phoneNumber; - dynamic alternatePhoneNumber; - dynamic addressLine; - dynamic landmark; - dynamic addressType; - dynamic city; - dynamic district; - dynamic name; - dynamic state; - dynamic country; - bool? isDeliverable; - bool? isDefault; - dynamic additionalInstructions; - DateTime? createdAt; - DateTime? updatedAt; - dynamic userId; + dynamic id; + dynamic pincode; + dynamic phoneNumber; + dynamic alternatePhoneNumber; + dynamic addressLine; + dynamic landmark; + dynamic addressType; + dynamic city; + dynamic district; + dynamic name; + dynamic state; + dynamic country; + bool? isDeliverable; + bool? isDefault; + dynamic additionalInstructions; + DateTime? createdAt; + DateTime? updatedAt; + dynamic userId; - DeliveryAddress({ - this.id, - this.pincode, - this.phoneNumber, - this.alternatePhoneNumber, - this.addressLine, - this.landmark, - this.addressType, - this.city, - this.district, - this.name, - this.state, - this.country, - this.isDeliverable, - this.isDefault, - this.additionalInstructions, - this.createdAt, - this.updatedAt, - this.userId, - }); + DeliveryAddress({ + this.id, + this.pincode, + this.phoneNumber, + this.alternatePhoneNumber, + this.addressLine, + this.landmark, + this.addressType, + this.city, + this.district, + this.name, + this.state, + this.country, + this.isDeliverable, + this.isDefault, + this.additionalInstructions, + this.createdAt, + this.updatedAt, + this.userId, + }); - factory DeliveryAddress.fromJson(Map json) => - DeliveryAddress( + factory DeliveryAddress.fromJson(Map json) => DeliveryAddress( id: json["id"], pincode: json["pincode"], phoneNumber: json["phoneNumber"], @@ -198,12 +867,12 @@ class DeliveryAddress { isDeliverable: json["isDeliverable"], isDefault: json["isDefault"], additionalInstructions: json["additionalInstructions"], - createdAt: DateTime?.parse(json["createdAt"]), - updatedAt: DateTime?.parse(json["updatedAt"]), + createdAt: DateTime.parse(json["createdAt"]), + updatedAt: DateTime.parse(json["updatedAt"]), userId: json["userId"], - ); + ); - Map toJson() => { + Map toJson() => { "id": id, "pincode": pincode, "phoneNumber": phoneNumber, @@ -222,45 +891,43 @@ class DeliveryAddress { "createdAt": createdAt, "updatedAt": updatedAt, "userId": userId, - }; + }; } class OrderItem { - dynamic id; - dynamic orderId; - dynamic productId; - dynamic storeId; - dynamic productName; - dynamic productImage; - dynamic productVariant; - int? quantity; - dynamic price; - dynamic originalPrice; - dynamic discountAmount; - DateTime? createdAt; - DateTime? updatedAt; - Product? product; - // Store? store; + dynamic id; + dynamic orderId; + dynamic productId; + dynamic storeId; + dynamic productName; + dynamic productImage; + dynamic productVariant; + dynamic quantity; + dynamic price; + dynamic originalPrice; + dynamic discountAmount; + DateTime? createdAt; + DateTime? updatedAt; + Product? product; - OrderItem({ - this.id, - this.orderId, - this.productId, - this.storeId, - this.productName, - this.productImage, - this.productVariant, - this.quantity, - this.price, - this.originalPrice, - this.discountAmount, - this.createdAt, - this.updatedAt, - this.product, - // this.store, - }); + OrderItem({ + this.id, + this.orderId, + this.productId, + this.storeId, + this.productName, + this.productImage, + this.productVariant, + this.quantity, + this.price, + this.originalPrice, + this.discountAmount, + this.createdAt, + this.updatedAt, + this.product, + }); - factory OrderItem.fromJson(Map json) => OrderItem( + factory OrderItem.fromJson(Map json) => OrderItem( id: json["id"], orderId: json["orderId"], productId: json["productId"], @@ -272,13 +939,12 @@ class OrderItem { price: json["price"], originalPrice: json["originalPrice"], discountAmount: json["discountAmount"], - createdAt: DateTime?.parse(json["createdAt"]), - updatedAt: DateTime?.parse(json["updatedAt"]), - product: Product.fromJson(json["product"]), - // store: Store.fromJson(json["store"]), - ); + createdAt: DateTime.parse(json["createdAt"]), + updatedAt: DateTime.parse(json["updatedAt"]), + product: Product.fromJson(json["product"]), + ); - Map toJson() => { + Map toJson() => { "id": id, "orderId": orderId, "productId": productId, @@ -292,393 +958,122 @@ class OrderItem { "discountAmount": discountAmount, "createdAt": createdAt, "updatedAt": updatedAt, - "product": product!.toJson(), - // "store": store!.toJson(), - }; + "product": product!.toJson(), + }; } class Product { - dynamic id; - dynamic name; - dynamic description; - dynamic additionalInfo; - dynamic brand; - dynamic basePrice; - dynamic discountPrice; - int? stock; - int? quantity; - dynamic unit; - dynamic slug; - dynamic averageRating; - bool? isInStock; - bool? isActive; - DateTime? createdAt; - DateTime? updatedAt; - dynamic storeId; - dynamic categoryId; - dynamic productTypeId; - dynamic timeSlotId; - List? productImages; - Category? category; - dynamic? productType; + dynamic id; + dynamic name; + dynamic description; - Product({ - this.id, - this.name, - this.description, - this.additionalInfo, - this.brand, - this.basePrice, - this.discountPrice, - this.stock, - this.quantity, - this.unit, - this.slug, - this.averageRating, - this.isInStock, - this.isActive, - this.createdAt, - this.updatedAt, - this.storeId, - this.categoryId, - this.productTypeId, - this.timeSlotId, - this.productImages, - this.category, - this.productType, - }); + Product({ + this.id, + this.name, + this.description, + }); - factory Product.fromJson(Map json) => Product( + factory Product.fromJson(Map json) => Product( id: json["id"], name: json["name"], description: json["description"], - additionalInfo: json["additionalInfo"], - brand: json["brand"], - basePrice: json["basePrice"], - discountPrice: json["discountPrice"], - stock: json["stock"], - quantity: json["quantity"], - unit: json["unit"], - slug: json["slug"], - averageRating: json["averageRating"], - isInStock: json["isInStock"], - isActive: json["isActive"], - createdAt: DateTime?.parse(json["createdAt"]), - updatedAt: DateTime?.parse(json["updatedAt"]), - storeId: json["storeId"], - categoryId: json["categoryId"], - productTypeId: json["productTypeId"], - timeSlotId: json["timeSlotId"], - productImages: List.from( - json["productImages"].map((x) => ProductImage.fromJson(x))), - category: Category.fromJson(json["category"]), - productType: json["productType"], - ); + ); - Map toJson() => { + Map toJson() => { "id": id, "name": name, "description": description, - "additionalInfo": additionalInfo, - "brand": brand, - "basePrice": basePrice, - "discountPrice": discountPrice, - "stock": stock, - "quantity": quantity, - "unit": unit, - "slug": slug, - "averageRating": averageRating, - "isInStock": isInStock, - "isActive": isActive, - "createdAt": createdAt, - "updatedAt": updatedAt, - "storeId": storeId, - "categoryId": categoryId, - "productTypeId": productTypeId, - "timeSlotId": timeSlotId, - "productImages": - List.from(productImages!.map((x) => x.toJson())), - "category": category!.toJson(), - "productType": productType, - }; -} - -class Category { - dynamic id; - dynamic name; - dynamic path; - - Category({ - this.id, - this.name, - this.path, - }); - - factory Category.fromJson(Map json) => Category( - id: json["id"], - name: json["name"], - path: json["path"], - ); - - Map toJson() => { - "id": id, - "name": name, - "path": path, - }; -} - -class ProductImage { - dynamic id; - dynamic url; - bool? isDefault; - dynamic productId; - - ProductImage({ - this.id, - this.url, - this.isDefault, - this.productId, - }); - - factory ProductImage.fromJson(Map json) => ProductImage( - id: json["id"], - url: json["url"], - isDefault: json["isDefault"], - productId: json["productId"], - ); - - Map toJson() => { - "id": id, - "url": url, - "isDefault": isDefault, - "productId": productId, - }; -} - -class Store { - dynamic id; - dynamic storeName; - dynamic storePicture; - dynamic storeAddress; - dynamic officialPhoneNumber; - User? vendor; - OperateDates? operateDates; - OperateTimes? operateTimes; - - Store({ - this.id, - this.storeName, - this.storePicture, - this.storeAddress, - this.officialPhoneNumber, - this.vendor, - this.operateDates, - this.operateTimes, - }); - - factory Store.fromJson(Map json) => Store( - id: json["id"], - storeName: json["storeName"], - storePicture: json["storePicture"], - storeAddress: json["storeAddress"], - officialPhoneNumber: json["officialPhoneNumber"], - vendor: User.fromJson(json["vendor"]), - operateDates: OperateDates.fromJson(json["operateDates"]), - operateTimes: OperateTimes.fromJson(json["operateTimes"]), - ); - - Map toJson() => { - "id": id, - "storeName": storeName, - "storePicture": storePicture, - "storeAddress": storeAddress, - "officialPhoneNumber": officialPhoneNumber, - "vendor": vendor!.toJson(), - "operateDates": operateDates!.toJson(), - "operateTimes": operateTimes!.toJson(), - }; -} - -class OperateDates { - dynamic id; - bool? monday; - bool? tuesday; - bool? wednesday; - bool? thursday; - bool? friday; - bool? saturday; - bool? sunday; - dynamic storeId; - - OperateDates({ - this.id, - this.monday, - this.tuesday, - this.wednesday, - this.thursday, - this.friday, - this.saturday, - this.sunday, - this.storeId, - }); - - factory OperateDates.fromJson(Map json) => OperateDates( - id: json["id"], - monday: json["monday"], - tuesday: json["tuesday"], - wednesday: json["wednesday"], - thursday: json["thursday"], - friday: json["friday"], - saturday: json["saturday"], - sunday: json["sunday"], - storeId: json["storeId"], - ); - - Map toJson() => { - "id": id, - "monday": monday, - "tuesday": tuesday, - "wednesday": wednesday, - "thursday": thursday, - "friday": friday, - "saturday": saturday, - "sunday": sunday, - "storeId": storeId, - }; -} - -class OperateTimes { - dynamic id; - dynamic startTime; - dynamic endTime; - dynamic storeId; - - OperateTimes({ - this.id, - this.startTime, - this.endTime, - this.storeId, - }); - - factory OperateTimes.fromJson(Map json) => OperateTimes( - id: json["id"], - startTime: json["startTime"], - endTime: json["endTime"], - storeId: json["storeId"], - ); - - Map toJson() => { - "id": id, - "startTime": startTime, - "endTime": endTime, - "storeId": storeId, - }; -} - -class User { - dynamic id; - dynamic email; - dynamic firstName; - dynamic lastName; - dynamic phone; - dynamic role; - - User({ - this.id, - this.email, - this.firstName, - this.lastName, - this.phone, - this.role, - }); - - factory User.fromJson(Map json) => User( - id: json["id"], - email: json["email"], - firstName: json["firstName"], - lastName: json["lastName"], - phone: json["phone"], - role: json["role"], - ); - - Map toJson() => { - "id": id, - "email": email, - "firstName": firstName, - "lastName": lastName, - "phone": phone, - "role": role, - }; + }; } class StatusHistory { - dynamic id; - dynamic orderId; - dynamic status; - dynamic comment; - dynamic updatedBy; - DateTime? createdAt; + dynamic status; + dynamic comment; + DateTime? createdAt; - StatusHistory({ - this.id, - this.orderId, - this.status, - this.comment, - this.updatedBy, - this.createdAt, - }); + StatusHistory({ + this.status, + this.comment, + this.createdAt, + }); - factory StatusHistory.fromJson(Map json) => StatusHistory( - id: json["id"], - orderId: json["orderId"], + factory StatusHistory.fromJson(Map json) => StatusHistory( status: json["status"], comment: json["comment"], - updatedBy: json["updatedBy"], - createdAt: DateTime?.parse(json["createdAt"]), - ); + createdAt: DateTime.parse(json["createdAt"]), + ); - Map toJson() => { - "id": id, - "orderId": orderId, + Map toJson() => { "status": status, "comment": comment, - "updatedBy": updatedBy, "createdAt": createdAt, - }; + }; +} + +class User { + dynamic id; + dynamic email; + dynamic phone; + dynamic firstName; + dynamic lastName; + + User({ + this.id, + this.email, + this.phone, + this.firstName, + this.lastName, + }); + + factory User.fromJson(Map json) => User( + id: json["id"], + email: json["email"], + phone: json["phone"], + firstName: json["firstName"], + lastName: json["lastName"], + ); + + Map toJson() => { + "id": id, + "email": email, + "phone": phone, + "firstName": firstName, + "lastName": lastName, + }; } class Meta { - int? total; - int? page; - int? limit; - int? lastPage; - bool? hasNextPage; - bool? hasPreviousPage; + dynamic total; + dynamic page; + dynamic limit; + dynamic lastPage; + dynamic hasNextPage; + dynamic hasPreviousPage; - Meta({ - this.total, - this.page, - this.limit, - this.lastPage, - this.hasNextPage, - this.hasPreviousPage, - }); + Meta({ + this.total, + this.page, + this.limit, + this.lastPage, + this.hasNextPage, + this.hasPreviousPage, + }); - factory Meta.fromJson(Map json) => Meta( + factory Meta.fromJson(Map json) => Meta( total: json["total"], page: json["page"], limit: json["limit"], lastPage: json["lastPage"], hasNextPage: json["hasNextPage"], hasPreviousPage: json["hasPreviousPage"], - ); + ); - Map toJson() => { + Map toJson() => { "total": total, "page": page, "limit": limit, "lastPage": lastPage, "hasNextPage": hasNextPage, "hasPreviousPage": hasPreviousPage, - }; + }; } diff --git a/lib/src/data/product_details.dart b/lib/src/data/product_details.dart index 10a9802..0968b02 100644 --- a/lib/src/data/product_details.dart +++ b/lib/src/data/product_details.dart @@ -1,14 +1,631 @@ +// // To parse this JSON data, do +// // +// // final productDetails = productDetailsFromJson(jsondynamic); + +// import 'dart:convert'; +// import 'dart:ffi'; + +// ProductDetailsData productDetailsdataFromJson(dynamic str) => +// ProductDetailsData.fromJson(json.decode(str)); + +// dynamic productDetailsToJson(ProductDetailsData data) => +// json.encode(data.toJson()); + +// class ProductDetailsData { +// Data? data; + +// ProductDetailsData({ +// this.data, +// }); + +// factory ProductDetailsData.fromJson(Map json) => +// ProductDetailsData( +// data: Data.fromJson(json["data"]), +// ); + +// Map toJson() => { +// "data": data!.toJson(), +// }; +// } + +// class Data { +// dynamic id; +// dynamic name; +// dynamic description; +// dynamic additionalInfo; +// dynamic brand; +// dynamic basePrice; +// dynamic discountPrice; +// dynamic? stock; +// dynamic? quantity; +// dynamic unit; +// dynamic slug; +// dynamic averageRating; +// bool? isInStock; +// bool? isActive; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic storeId; +// dynamic categoryId; +// dynamic productTypeId; +// dynamic timeSlotId; +// Store? store; +// Category? category; +// dynamic? productType; +// dynamic timeSlot; +// List? productImages; +// List? productTags; +// List? zones; +// List? productReview; +// List? questions; +// List? cartItems; +// List? wishlistItem; +// List? applicableCoupons; +// bool? isInWishlist; + +// Data({ +// this.id, +// this.name, +// this.description, +// this.additionalInfo, +// this.brand, +// this.basePrice, +// this.discountPrice, +// this.stock, +// this.quantity, +// this.unit, +// this.slug, +// this.averageRating, +// this.isInStock, +// this.isActive, +// this.createdAt, +// this.updatedAt, +// this.storeId, +// this.categoryId, +// this.productTypeId, +// this.timeSlotId, +// this.store, +// this.category, +// this.productType, +// this.timeSlot, +// this.productImages, +// this.productTags, +// this.zones, +// this.productReview, +// this.questions, +// this.cartItems, +// this.wishlistItem, +// this.applicableCoupons, +// this.isInWishlist, +// }); + +// factory Data.fromJson(Map json) => Data( +// id: json["id"], +// name: json["name"], +// description: json["description"], +// additionalInfo: json["additionalInfo"], +// brand: json["brand"], +// basePrice: json["basePrice"], +// discountPrice: json["discountPrice"], +// stock: json["stock"], +// quantity: json["quantity"], +// unit: json["unit"], +// slug: json["slug"], +// averageRating: json["averageRating"], +// isInStock: json["isInStock"], +// isActive: json["isActive"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// storeId: json["storeId"], +// categoryId: json["categoryId"], +// productTypeId: json["productTypeId"], +// timeSlotId: json["timeSlotId"], +// store: Store.fromJson(json["store"]), +// category: Category.fromJson(json["category"]), +// productType: json["productType"], +// timeSlot: json["timeSlot"], +// productImages: List.from( +// json["productImages"].map((x) => ProductImage.fromJson(x))), +// productTags: List.from(json["productTags"].map((x) => x)), +// zones: List.from(json["zones"].map((x) => x)), +// productReview: List.from( +// json["ProductReview"].map((x) => ProductReview.fromJson(x))), +// questions: List.from(json["questions"].map((x) => x)), +// cartItems: List.from( +// json["cartItems"].map((x) => CartItem.fromJson(x))), +// wishlistItem: List.from( +// json["WishlistItem"].map((x) => WishlistItem.fromJson(x))), +// applicableCoupons: +// List.from(json["applicableCoupons"].map((x) => x)), +// isInWishlist: json["isInWishlist"], +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "description": description, +// "additionalInfo": additionalInfo, +// "brand": brand, +// "basePrice": basePrice, +// "discountPrice": discountPrice, +// "stock": stock, +// "quantity": quantity, +// "unit": unit, +// "slug": slug, +// "averageRating": averageRating, +// "isInStock": isInStock, +// "isActive": isActive, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "storeId": storeId, +// "categoryId": categoryId, +// "productTypeId": productTypeId, +// "timeSlotId": timeSlotId, +// "store": store!.toJson(), +// "category": category!.toJson(), +// "productType": productType, +// "timeSlot": timeSlot, +// "productImages": +// List.from(productImages!.map((x) => x.toJson())), +// "productTags": List.from(productTags!.map((x) => x)), +// "zones": List.from(zones!.map((x) => x)), +// "ProductReview": List.from(productReview!.map((x) => x)), +// "questions": List.from(questions!.map((x) => x)), +// "cartItems": List.from(cartItems!.map((x) => x.toJson())), +// "WishlistItem": +// List.from(wishlistItem!.map((x) => x.toJson())), +// "applicableCoupons": +// List.from(applicableCoupons!.map((x) => x)), +// "isInWishlist": isInWishlist, +// }; +// } + +// class CartItem { +// dynamic id; +// dynamic quantity; +// dynamic priceSnapshot; +// dynamic cartId; +// dynamic productId; +// dynamic storeId; +// DateTime? createdAt; +// DateTime? updatedAt; + +// CartItem({ +// this.id, +// this.quantity, +// this.priceSnapshot, +// this.cartId, +// this.productId, +// this.storeId, +// this.createdAt, +// this.updatedAt, +// }); + +// factory CartItem.fromJson(Map json) => CartItem( +// id: json["id"], +// quantity: json["quantity"], +// priceSnapshot: json["priceSnapshot"], +// cartId: json["cartId"], +// productId: json["productId"], +// storeId: json["storeId"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// ); + +// Map toJson() => { +// "id": id, +// "quantity": quantity, +// "priceSnapshot": priceSnapshot, +// "cartId": cartId, +// "productId": productId, +// "storeId": storeId, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// }; +// } + +// class Category { +// dynamic id; +// dynamic name; +// dynamic description; +// dynamic image; +// dynamic slug; +// dynamic level; +// bool? isActive; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic parentCategoryId; +// dynamic path; + +// Category({ +// this.id, +// this.name, +// this.description, +// this.image, +// this.slug, +// this.level, +// this.isActive, +// this.createdAt, +// this.updatedAt, +// this.parentCategoryId, +// this.path, +// }); + +// factory Category.fromJson(Map json) => Category( +// 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"], +// ); + +// Map toJson() => { +// "id": id, +// "name": name, +// "description": description, +// "image": image, +// "slug": slug, +// "level": level, +// "isActive": isActive, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "parentCategoryId": parentCategoryId, +// "path": path, +// }; +// } + +// class ProductImage { +// dynamic id; +// dynamic url; +// bool? isDefault; +// dynamic productId; + +// ProductImage({ +// this.id, +// this.url, +// this.isDefault, +// this.productId, +// }); + +// factory ProductImage.fromJson(Map json) => ProductImage( +// id: json["id"], +// url: json["url"], +// isDefault: json["isDefault"], +// productId: json["productId"], +// ); + +// Map toJson() => { +// "id": id, +// "url": url, +// "isDefault": isDefault, +// "productId": productId, +// }; +// } + +// class Store { +// dynamic id; +// dynamic storeName; +// dynamic storeDescription; +// dynamic officialPhoneNumber; +// dynamic storeAddress; +// dynamic gstNumber; +// dynamic gumastaNumber; +// dynamic storePicture; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic vendorId; +// bool? isActive; +// dynamic couponId; + +// Store({ +// this.id, +// this.storeName, +// this.storeDescription, +// this.officialPhoneNumber, +// this.storeAddress, +// this.gstNumber, +// this.gumastaNumber, +// this.storePicture, +// this.createdAt, +// this.updatedAt, +// this.vendorId, +// this.isActive, +// this.couponId, +// }); + +// factory Store.fromJson(Map json) => Store( +// id: json["id"], +// storeName: json["storeName"], +// storeDescription: json["storeDescription"], +// officialPhoneNumber: json["officialPhoneNumber"], +// storeAddress: json["storeAddress"], +// gstNumber: json["gstNumber"], +// gumastaNumber: json["gumastaNumber"], +// storePicture: json["storePicture"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// vendorId: json["vendorId"], +// isActive: json["isActive"], +// couponId: json["couponId"], +// ); + +// Map toJson() => { +// "id": id, +// "storeName": storeName, +// "storeDescription": storeDescription, +// "officialPhoneNumber": officialPhoneNumber, +// "storeAddress": storeAddress, +// "gstNumber": gstNumber, +// "gumastaNumber": gumastaNumber, +// "storePicture": storePicture, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "vendorId": vendorId, +// "isActive": isActive, +// "couponId": couponId, +// }; +// } + +// class WishlistItem { +// dynamic id; +// dynamic wishlistId; +// dynamic productId; +// dynamic storeId; +// DateTime? createdAt; +// DateTime? updatedAt; + +// WishlistItem({ +// this.id, +// this.wishlistId, +// this.productId, +// this.storeId, +// this.createdAt, +// this.updatedAt, +// }); + +// factory WishlistItem.fromJson(Map json) => WishlistItem( +// id: json["id"], +// wishlistId: json["wishlistId"], +// productId: json["productId"], +// storeId: json["storeId"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// ); + +// Map toJson() => { +// "id": id, +// "wishlistId": wishlistId, +// "productId": productId, +// "storeId": storeId, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// }; +// } + +// class ProductReview { +// dynamic id; +// dynamic userId; +// dynamic productId; +// dynamic rating; +// dynamic title; +// dynamic description; +// int? likes; +// int? dislikes; +// int? helpfulCount; +// bool? verifiedPurchase; +// dynamic status; +// DateTime? createdAt; +// DateTime? updatedAt; +// User? user; +// List? productReviewImage; + +// ProductReview({ +// this.id, +// this.userId, +// this.productId, +// this.rating, +// this.title, +// this.description, +// this.likes, +// this.dislikes, +// this.helpfulCount, +// this.verifiedPurchase, +// this.status, +// this.createdAt, +// this.updatedAt, +// this.user, +// this.productReviewImage, +// }); + +// factory ProductReview.fromJson(Map json) => ProductReview( +// id: json["id"], +// userId: json["userId"], +// productId: json["productId"], +// rating: json["rating"], +// title: json["title"], +// description: json["description"], +// likes: json["likes"], +// dislikes: json["dislikes"], +// helpfulCount: json["helpfulCount"], +// verifiedPurchase: json["verifiedPurchase"], +// status: json["status"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// user: User.fromJson(json["user"]), +// productReviewImage: List.from( +// json["ProductReviewImage"] +// .map((x) => ProductReviewImage.fromJson(x))), +// ); + +// Map toJson() => { +// "id": id, +// "userId": userId, +// "productId": productId, +// "rating": rating, +// "title": title, +// "description": description, +// "likes": likes, +// "dislikes": dislikes, +// "helpfulCount": helpfulCount, +// "verifiedPurchase": verifiedPurchase, +// "status": status, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "user": user!.toJson(), +// "ProductReviewImage": +// List.from(productReviewImage!.map((x) => x.toJson())), +// }; +// } + +// class ProductReviewImage { +// dynamic id; +// dynamic reviewId; +// dynamic imageUrl; +// bool? isDefault; +// DateTime? createdAt; + +// ProductReviewImage({ +// this.id, +// this.reviewId, +// this.imageUrl, +// this.isDefault, +// this.createdAt, +// }); + +// factory ProductReviewImage.fromJson(Map json) => +// ProductReviewImage( +// id: json["id"], +// reviewId: json["reviewId"], +// imageUrl: json["imageUrl"], +// isDefault: json["isDefault"], +// createdAt: DateTime.parse(json["createdAt"]), +// ); + +// Map toJson() => { +// "id": id, +// "reviewId": reviewId, +// "imageUrl": imageUrl, +// "isDefault": isDefault, +// "createdAt": createdAt, +// }; +// } + +// class User { +// dynamic id; +// dynamic email; +// dynamic firstName; +// dynamic lastName; +// dynamic name; +// dynamic img; +// dynamic authType; +// dynamic role; +// dynamic phone; +// dynamic password; +// bool? isActive; +// bool? isPhoneVerified; +// dynamic vendorType; +// dynamic businessId; +// bool? isVendorAccountCreated; +// bool? isVendorAccountActive; +// bool? vendorTermsAccepted; +// DateTime? createdAt; +// DateTime? updatedAt; +// dynamic rtHash; +// dynamic resetToken; +// dynamic resetTokenExpiresAt; + +// User({ +// this.id, +// this.email, +// this.firstName, +// this.lastName, +// this.name, +// this.img, +// this.authType, +// this.role, +// this.phone, +// this.password, +// this.isActive, +// this.isPhoneVerified, +// this.vendorType, +// this.businessId, +// this.isVendorAccountCreated, +// this.isVendorAccountActive, +// this.vendorTermsAccepted, +// this.createdAt, +// this.updatedAt, +// this.rtHash, +// this.resetToken, +// this.resetTokenExpiresAt, +// }); + +// factory User.fromJson(Map json) => User( +// id: json["id"], +// email: json["email"], +// firstName: json["firstName"], +// lastName: json["lastName"], +// name: json["name"], +// img: json["img"], +// authType: json["authType"], +// role: json["role"], +// phone: json["phone"], +// password: json["password"], +// isActive: json["isActive"], +// isPhoneVerified: json["isPhoneVerified"], +// vendorType: json["vendorType"], +// businessId: json["businessId"], +// isVendorAccountCreated: json["isVendorAccountCreated"], +// isVendorAccountActive: json["isVendorAccountActive"], +// vendorTermsAccepted: json["vendorTermsAccepted"], +// createdAt: DateTime.parse(json["createdAt"]), +// updatedAt: DateTime.parse(json["updatedAt"]), +// rtHash: json["rtHash"], +// resetToken: json["resetToken"], +// resetTokenExpiresAt: json["resetTokenExpiresAt"], +// ); + +// Map toJson() => { +// "id": id, +// "email": email, +// "firstName": firstName, +// "lastName": lastName, +// "name": name, +// "img": img, +// "authType": authType, +// "role": role, +// "phone": phone, +// "password": password, +// "isActive": isActive, +// "isPhoneVerified": isPhoneVerified, +// "vendorType": vendorType, +// "businessId": businessId, +// "isVendorAccountCreated": isVendorAccountCreated, +// "isVendorAccountActive": isVendorAccountActive, +// "vendorTermsAccepted": vendorTermsAccepted, +// "createdAt": createdAt, +// "updatedAt": updatedAt, +// "rtHash": rtHash, +// "resetToken": resetToken, +// "resetTokenExpiresAt": resetTokenExpiresAt, +// }; +// } + // To parse this JSON data, do // -// final productDetails = productDetailsFromJson(jsondynamic); +// final productDetailsData = productDetailsDataFromJson(jsondynamic); import 'dart:convert'; -import 'dart:ffi'; -ProductDetailsData productDetailsdataFromJson(dynamic str) => +ProductDetailsData productDetailsDataFromJson(dynamic str) => ProductDetailsData.fromJson(json.decode(str)); -dynamic productDetailsToJson(ProductDetailsData data) => +dynamic productDetailsDataToJson(ProductDetailsData data) => json.encode(data.toJson()); class ProductDetailsData { @@ -36,13 +653,21 @@ class Data { dynamic brand; dynamic basePrice; dynamic discountPrice; - dynamic? stock; - dynamic? quantity; + dynamic stock; + dynamic quantity; dynamic unit; dynamic slug; dynamic averageRating; bool? isInStock; bool? isActive; + dynamic disclaimer; + dynamic customerCareDetails; + dynamic manufacturerName; + dynamic manufacturerAddress; + dynamic countryOfOrigin; + DateTime? expiryDate; + dynamic returnsAllowedDays; + dynamic exchangeAllowedDays; DateTime? createdAt; DateTime? updatedAt; dynamic storeId; @@ -51,14 +676,15 @@ class Data { dynamic timeSlotId; Store? store; Category? category; - dynamic? productType; + dynamic productType; dynamic timeSlot; List? productImages; - List? productTags; + List? productTags; List? zones; + List? productHighlight; List? productReview; List? questions; - List? cartItems; + List? cartItems; List? wishlistItem; List? applicableCoupons; bool? isInWishlist; @@ -78,6 +704,14 @@ class Data { this.averageRating, this.isInStock, this.isActive, + this.disclaimer, + this.customerCareDetails, + this.manufacturerName, + this.manufacturerAddress, + this.countryOfOrigin, + this.expiryDate, + this.returnsAllowedDays, + this.exchangeAllowedDays, this.createdAt, this.updatedAt, this.storeId, @@ -91,6 +725,7 @@ class Data { this.productImages, this.productTags, this.zones, + this.productHighlight, this.productReview, this.questions, this.cartItems, @@ -114,6 +749,14 @@ class Data { averageRating: json["averageRating"], isInStock: json["isInStock"], isActive: json["isActive"], + disclaimer: json["disclaimer"], + customerCareDetails: json["customerCareDetails"], + manufacturerName: json["manufacturerName"], + manufacturerAddress: json["manufacturerAddress"], + countryOfOrigin: json["countryOfOrigin"], + expiryDate: DateTime.parse(json["expiryDate"]), + returnsAllowedDays: json["returnsAllowedDays"], + exchangeAllowedDays: json["exchangeAllowedDays"], createdAt: DateTime.parse(json["createdAt"]), updatedAt: DateTime.parse(json["updatedAt"]), storeId: json["storeId"], @@ -126,13 +769,15 @@ class Data { timeSlot: json["timeSlot"], productImages: List.from( json["productImages"].map((x) => ProductImage.fromJson(x))), - productTags: List.from(json["productTags"].map((x) => x)), + productTags: List.from( + json["productTags"].map((x) => ProductTag.fromJson(x))), zones: List.from(json["zones"].map((x) => x)), + productHighlight: List.from( + json["ProductHighlight"].map((x) => ProductHighlight.fromJson(x))), productReview: List.from( json["ProductReview"].map((x) => ProductReview.fromJson(x))), questions: List.from(json["questions"].map((x) => x)), - cartItems: List.from( - json["cartItems"].map((x) => CartItem.fromJson(x))), + cartItems: List.from(json["cartItems"].map((x) => x)), wishlistItem: List.from( json["WishlistItem"].map((x) => WishlistItem.fromJson(x))), applicableCoupons: @@ -155,6 +800,14 @@ class Data { "averageRating": averageRating, "isInStock": isInStock, "isActive": isActive, + "disclaimer": disclaimer, + "customerCareDetails": customerCareDetails, + "manufacturerName": manufacturerName, + "manufacturerAddress": manufacturerAddress, + "countryOfOrigin": countryOfOrigin, + "expiryDate": expiryDate, + "returnsAllowedDays": returnsAllowedDays, + "exchangeAllowedDays": exchangeAllowedDays, "createdAt": createdAt, "updatedAt": updatedAt, "storeId": storeId, @@ -167,11 +820,13 @@ class Data { "timeSlot": timeSlot, "productImages": List.from(productImages!.map((x) => x.toJson())), - "productTags": List.from(productTags!.map((x) => x)), + "productTags": List.from(productTags!.map((x) => x.toJson())), "zones": List.from(zones!.map((x) => x)), + "ProductHighlight": + List.from(productHighlight!.map((x) => x.toJson())), "ProductReview": List.from(productReview!.map((x) => x)), "questions": List.from(questions!.map((x) => x)), - "cartItems": List.from(cartItems!.map((x) => x.toJson())), + "cartItems": List.from(cartItems!.map((x) => x)), "WishlistItem": List.from(wishlistItem!.map((x) => x.toJson())), "applicableCoupons": @@ -180,60 +835,17 @@ class Data { }; } -class CartItem { - dynamic id; - dynamic quantity; - dynamic priceSnapshot; - dynamic cartId; - dynamic productId; - dynamic storeId; - DateTime? createdAt; - DateTime? updatedAt; - - CartItem({ - this.id, - this.quantity, - this.priceSnapshot, - this.cartId, - this.productId, - this.storeId, - this.createdAt, - this.updatedAt, - }); - - factory CartItem.fromJson(Map json) => CartItem( - id: json["id"], - quantity: json["quantity"], - priceSnapshot: json["priceSnapshot"], - cartId: json["cartId"], - productId: json["productId"], - storeId: json["storeId"], - createdAt: DateTime.parse(json["createdAt"]), - updatedAt: DateTime.parse(json["updatedAt"]), - ); - - Map toJson() => { - "id": id, - "quantity": quantity, - "priceSnapshot": priceSnapshot, - "cartId": cartId, - "productId": productId, - "storeId": storeId, - "createdAt": createdAt, - "updatedAt": updatedAt, - }; -} - class Category { dynamic id; dynamic name; dynamic description; dynamic image; dynamic slug; - dynamic level; + int? level; bool? isActive; DateTime? createdAt; DateTime? updatedAt; + dynamic commissionPercentage; dynamic parentCategoryId; dynamic path; @@ -247,6 +859,7 @@ class Category { this.isActive, this.createdAt, this.updatedAt, + this.commissionPercentage, this.parentCategoryId, this.path, }); @@ -261,6 +874,7 @@ class Category { isActive: json["isActive"], createdAt: DateTime.parse(json["createdAt"]), updatedAt: DateTime.parse(json["updatedAt"]), + commissionPercentage: json["commissionPercentage"], parentCategoryId: json["parentCategoryId"], path: json["path"], ); @@ -275,11 +889,49 @@ class Category { "isActive": isActive, "createdAt": createdAt, "updatedAt": updatedAt, + "commissionPercentage": commissionPercentage, "parentCategoryId": parentCategoryId, "path": path, }; } +class ProductHighlight { + dynamic id; + dynamic key; + dynamic value; + dynamic productId; + DateTime? createdAt; + DateTime? updatedAt; + + ProductHighlight({ + this.id, + this.key, + this.value, + this.productId, + this.createdAt, + this.updatedAt, + }); + + factory ProductHighlight.fromJson(Map json) => + ProductHighlight( + id: json["id"], + key: json["key"], + value: json["value"], + productId: json["productId"], + createdAt: DateTime.parse(json["createdAt"]), + updatedAt: DateTime.parse(json["updatedAt"]), + ); + + Map toJson() => { + "id": id, + "key": key, + "value": value, + "productId": productId, + "createdAt": createdAt, + "updatedAt": updatedAt, + }; +} + class ProductImage { dynamic id; dynamic url; @@ -308,67 +960,111 @@ class ProductImage { }; } +class ProductTag { + dynamic id; + dynamic name; + dynamic description; + bool? isActive; + DateTime? createdAt; + DateTime? updatedAt; + + ProductTag({ + this.id, + this.name, + this.description, + this.isActive, + this.createdAt, + this.updatedAt, + }); + + factory ProductTag.fromJson(Map json) => ProductTag( + id: json["id"], + name: json["name"], + description: json["description"], + isActive: json["isActive"], + createdAt: DateTime.parse(json["createdAt"]), + updatedAt: DateTime.parse(json["updatedAt"]), + ); + + Map toJson() => { + "id": id, + "name": name, + "description": description, + "isActive": isActive, + "createdAt": createdAt, + "updatedAt": updatedAt, + }; +} + class Store { dynamic id; dynamic storeName; - dynamic storeDescription; - dynamic officialPhoneNumber; - dynamic storeAddress; - dynamic gstNumber; - dynamic gumastaNumber; dynamic storePicture; - DateTime? createdAt; - DateTime? updatedAt; - dynamic vendorId; - bool? isActive; - dynamic couponId; + dynamic storeAddress; + dynamic officialPhoneNumber; + dynamic sellerLicenseNumber; + Vendor? vendor; Store({ this.id, this.storeName, - this.storeDescription, - this.officialPhoneNumber, - this.storeAddress, - this.gstNumber, - this.gumastaNumber, this.storePicture, - this.createdAt, - this.updatedAt, - this.vendorId, - this.isActive, - this.couponId, + this.storeAddress, + this.officialPhoneNumber, + this.sellerLicenseNumber, + this.vendor, }); factory Store.fromJson(Map json) => Store( id: json["id"], storeName: json["storeName"], - storeDescription: json["storeDescription"], - officialPhoneNumber: json["officialPhoneNumber"], - storeAddress: json["storeAddress"], - gstNumber: json["gstNumber"], - gumastaNumber: json["gumastaNumber"], storePicture: json["storePicture"], - createdAt: DateTime.parse(json["createdAt"]), - updatedAt: DateTime.parse(json["updatedAt"]), - vendorId: json["vendorId"], - isActive: json["isActive"], - couponId: json["couponId"], + storeAddress: json["storeAddress"], + officialPhoneNumber: json["officialPhoneNumber"], + sellerLicenseNumber: json["sellerLicenseNumber"], + vendor: Vendor.fromJson(json["vendor"]), ); Map toJson() => { "id": id, "storeName": storeName, - "storeDescription": storeDescription, - "officialPhoneNumber": officialPhoneNumber, - "storeAddress": storeAddress, - "gstNumber": gstNumber, - "gumastaNumber": gumastaNumber, "storePicture": storePicture, - "createdAt": createdAt, - "updatedAt": updatedAt, - "vendorId": vendorId, - "isActive": isActive, - "couponId": couponId, + "storeAddress": storeAddress, + "officialPhoneNumber": officialPhoneNumber, + "sellerLicenseNumber": sellerLicenseNumber, + "vendor": vendor!.toJson(), + }; +} + +class Vendor { + dynamic id; + dynamic email; + dynamic firstName; + dynamic lastName; + dynamic phone; + + Vendor({ + this.id, + this.email, + this.firstName, + this.lastName, + this.phone, + }); + + factory Vendor.fromJson(Map json) => Vendor( + id: json["id"], + email: json["email"], + firstName: json["firstName"], + lastName: json["lastName"], + phone: json["phone"], + ); + + Map toJson() => { + "id": id, + "email": email, + "firstName": firstName, + "lastName": lastName, + "phone": phone, }; } diff --git a/lib/src/logic/provider/addTocart_provider.dart b/lib/src/logic/provider/addTocart_provider.dart index 524ae28..d52960e 100644 --- a/lib/src/logic/provider/addTocart_provider.dart +++ b/lib/src/logic/provider/addTocart_provider.dart @@ -7,6 +7,8 @@ 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/address.dart'; import 'package:grocery_app/src/data/all_cart_items.dart'; +import 'package:grocery_app/src/data/coupon_model.dart'; +import 'package:grocery_app/src/data/coupon_response.dart'; import 'package:grocery_app/src/logic/repo/product_repo.dart'; import 'package:grocery_app/src/ui/payment/payment_webView.dart'; import 'package:grocery_app/utils/extensions/extensions.dart'; @@ -125,6 +127,16 @@ class AddtocartProvider extends ChangeNotifier { } } + double _totalPrice = 0.0; + double _grandPrice = 0.0; + double _discount = 0.0; + + double get totalPrice => _totalPrice; + + double get grandPrice => _grandPrice; + + double get discount => _discount; + final _homeRepo = getIt(); AllCartItems allitem = AllCartItems(); @@ -144,6 +156,9 @@ class AddtocartProvider extends ChangeNotifier { }, (response) { allitem = response!; + _totalPrice = double.parse(response.subtotal.toString()); + _grandPrice = double.parse(response.subtotal.toString()); + isLoaddcartItem = false; notifyListeners(); }, @@ -154,36 +169,118 @@ class AddtocartProvider extends ChangeNotifier { notifyListeners(); } } + //////////////////////////////////// coupon //////////////////////////// + + bool iscouponLoading = true; + + CouponDataModel couponDataModel = CouponDataModel(); + Future offerCoupon(BuildContext context) async { + iscouponLoading = true; + notifyListeners(); + var data = {}; + try { + var result = await _homeRepo.offerCoupon(data); + + return result.fold( + (error) { + iscouponLoading = false; + notifyListeners(); + }, + (response) { + couponDataModel = response!; + iscouponLoading = false; + notifyListeners(); + }, + ); + } catch (e) { + iscouponLoading = false; + notifyListeners(); + } + } + + bool isCouponApply = false; + CouponResponse couponResponse = CouponResponse(); + + String _couponId = ''; + String get couponId => _couponId; + + Future applyCoupon( + BuildContext context, String cartId, String couponscode, id) async { + context.showLoader(show: true); + isCouponApply = true; + + notifyListeners(); + + var data = {"couponCode": couponscode, "cartId": cartId}; + try { + var result = await _homeRepo.applyCoupon(data); + + return result.fold( + (error) { + context.showLoader(show: false); + isCouponApply = false; + Fluttertoast.showToast( + msg: "Coupon Code invalid!", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + backgroundColor: Colors.red, + textColor: Colors.white, + fontSize: 14.0, + ); + notifyListeners(); + return false; + }, + (response) { + if (response != null) { + couponResponse = response; + _couponId = id; + _grandPrice = double.parse(response.finalPrice.toString()); + _discount = double.parse(response.discountAmount.toString()); + context.showLoader(show: false); + isCouponApply = false; + notifyListeners(); + return true; + } else { + context.showLoader(show: false); + isCouponApply = false; + notifyListeners(); + return false; + } + }, + ); + } catch (e) { + context.showLoader(show: false); + Fluttertoast.showToast( + msg: "Coupon Code invalid!", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + backgroundColor: Colors.red, + textColor: Colors.white, + fontSize: 14.0, + ); + isCouponApply = false; + notifyListeners(); + return false; // Return false on exception + } + } ///////////////////////////////////orderPaymnet/////////////////////////// bool ispaymentLoader = false; Future orderPaymnet( BuildContext context, - double amount, - String currency, double originalAmount, - String name, - String phone, - String email, - String userI, String cartId, String addressId, - String remarks, + String couponId, ) async { ispaymentLoader = true; notifyListeners(); var data = { - "amount": amount, - "currency": currency, - "originalAmount": amount, - "name": name, - "phone": phone, - "email": email, - "userId": userI, - "cartId": cartId, + "amount": originalAmount, "addressId": addressId, - "remarks": remarks + "cartId": cartId, + "couponId": couponId }; try { @@ -221,16 +318,13 @@ class AddtocartProvider extends ChangeNotifier { BuildContext context, double subtotal, double deliverCharge, - double discountPrice, - double grandTotal, String couponId, String addressId, ) async { - print("sdkjfhgkjdfhgjkldfkjghkdf"); ispaymentLoader = true; notifyListeners(); var data; - if (couponId != '00') { + if (couponId.isNotEmpty) { data = { "addressId": addressId, "paymentMethod": "COD", @@ -238,12 +332,10 @@ class AddtocartProvider extends ChangeNotifier { "orderStatus": "PENDING", "subtotal": subtotal, "deliveryCharge": deliverCharge, - "discount": discountPrice, - "grandTotal": grandTotal, + "transactionId": "phonepe_transaction_123", "couponId": couponId }; } else { - print("skfdjdsjfg"); data = { "addressId": addressId, "paymentMethod": "COD", @@ -251,8 +343,6 @@ class AddtocartProvider extends ChangeNotifier { "orderStatus": "PENDING", "subtotal": subtotal, "deliveryCharge": deliverCharge, - "discount": discountPrice, - "grandTotal": grandTotal, }; } diff --git a/lib/src/logic/provider/home_provider.dart b/lib/src/logic/provider/home_provider.dart index e197881..305f652 100644 --- a/lib/src/logic/provider/home_provider.dart +++ b/lib/src/logic/provider/home_provider.dart @@ -254,15 +254,16 @@ class ProductProvider extends ChangeNotifier { } } - void toggleWishlist1(String productId) { - for (var product in products) { - if (product.id == productId) { - product.isInWishlist = !product.isInWishlist; // Toggle value - notifyListeners(); // Refresh UI - break; - } - } - } + // void toggleWishlist1(String productId) + // { + // for (var product in products) { + // if (product.id == productId) { + // product.isInWishlist = !product.isInWishlist; // Toggle value + // notifyListeners(); // Refresh UI + // break; + // } + // } + // } // Future addToCart(BuildContext context, String productId) async // { diff --git a/lib/src/logic/repo/product_repo.dart b/lib/src/logic/repo/product_repo.dart index a99cf65..2b1ca33 100644 --- a/lib/src/logic/repo/product_repo.dart +++ b/lib/src/logic/repo/product_repo.dart @@ -13,6 +13,8 @@ import 'package:grocery_app/src/data/banners.dart'; import 'package:grocery_app/src/data/best_dealProduct.dart'; import 'package:grocery_app/src/data/check_pin_response.dart'; import 'package:grocery_app/src/data/cod_order_response.dart'; +import 'package:grocery_app/src/data/coupon_model.dart'; +import 'package:grocery_app/src/data/coupon_response.dart'; import 'package:grocery_app/src/data/login_response.dart'; import 'package:grocery_app/src/data/order_paymnet.dart'; import 'package:grocery_app/src/data/product_category.dart'; @@ -53,7 +55,7 @@ class ProductRepo { var response = await _productService.getProductDetails(data, id); ProductDetailsData loginResponse = - productDetailsdataFromJson(response.toString()); + productDetailsDataFromJson(response.toString()); final String model = response.toString(); @@ -102,7 +104,7 @@ class ProductRepo { try { var response = await _productService.paymentOrder(data); print("kjdfglkjfdgjklfgkldj${data} ${response} "); - + OrderPaymnet productCategory = orderPaymnetFromJson(response.toString()); print("lkjdflkjfhgdkhfgkd "); @@ -115,13 +117,11 @@ class ProductRepo { } } - FutureResult paymentCODOrder(data) async { + FutureResult paymentCODOrder(data) async { try { - var response = await _productService.paymentCODOrder(data); - CodOrderResponse productCategory = codOrderResponseFromJson(response.toString()); - - + CodOrderResponse productCategory = + codOrderResponseFromJson(response.toString()); return right(productCategory); } on DioException catch (e) { @@ -130,11 +130,6 @@ class ProductRepo { } } - - - - - FutureResult> similarProduct( data, BuildContext context, id) async { try { @@ -165,6 +160,34 @@ class ProductRepo { } } + FutureResult offerCoupon(data) async { + try { + var response = await _productService.offerCoupon(data); + + CouponDataModel couponmodel = couponDataFromJson(response.toString()); + return right(couponmodel); + } on DioException catch (e) { + var error = CustomDioExceptions.handleError(e); + return left(error); + } + } + + FutureResult applyCoupon(data) async { + try { + var response = await _productService.applyCoupon(data); + + CouponResponse couponresponse = couponResponseFromJson(response.toString()); + return right(couponresponse); + } on DioException catch (e) { + var error = CustomDioExceptions.handleError(e); + return left(error); + } + } + + + + + FutureResult getAddress(data) async { try { var response = await _productService.getAddress(data); diff --git a/lib/src/logic/services/home_locator.dart b/lib/src/logic/services/home_locator.dart index 3daa61b..16a3dfb 100644 --- a/lib/src/logic/services/home_locator.dart +++ b/lib/src/logic/services/home_locator.dart @@ -80,6 +80,22 @@ class ProductService extends ApiService { return response; } + Future offerCoupon(data) async { + var response = await api.get(APIURL.offerCoupon, data: jsonEncode(data)); + + return response; + } + + Future applyCoupon(data) async { + var response = await api.post(APIURL.applyCoupon, data: jsonEncode(data)); + + return response; + } + + + + + Future checkPin(data, pin) async { var response = await api.get(APIURL.checkPin + pin, data: jsonEncode(data)); diff --git a/lib/src/ui/bestdeal/bestdeal_screen.dart b/lib/src/ui/bestdeal/bestdeal_screen.dart index eb0e5e1..65fc1e7 100644 --- a/lib/src/ui/bestdeal/bestdeal_screen.dart +++ b/lib/src/ui/bestdeal/bestdeal_screen.dart @@ -184,6 +184,7 @@ class _BestDealScreenState extends State { } else if (provider.bestdeal.isEmpty) { return Center(child: Text('No products available')); } else { + print("kjhfgjkdfkjghdhjfgk ${provider.bestdeal.first.additionalInfo}"); return Padding( padding: const EdgeInsets.all(15), child: GridView.builder( @@ -273,8 +274,6 @@ class _BestDealScreenState extends State { overflow: TextOverflow.ellipsis, style: context.customMedium(APPCOLOR.balck1A1A1A, 16), ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.005), Text( bestdealproduct.unit ?? "", textAlign: TextAlign.left, @@ -285,7 +284,7 @@ class _BestDealScreenState extends State { 12, ), ), - if (provider.productDetails.data!.quantity > 0) + if (bestdealproduct!.quantity > 0) Text("In Stock ", style: TextStyle(color: Colors.green, fontSize: 14)), @@ -381,142 +380,6 @@ class _BestDealScreenState extends State { }, ), ); - - // Padding( - // padding: const EdgeInsets.all(15), - // child: GridView.builder( - // itemCount: provider.bestdeal.length, - // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - // crossAxisCount: 2, - // childAspectRatio: MediaQuery.of(context).size.width / - // (MediaQuery.of(context).size.height / 1.5), - // crossAxisSpacing: 10, - // mainAxisSpacing: 10), - // itemBuilder: (context, index) { - // var bestdealproduct = provider.bestdeal[index]; - // return Container( - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.circular(15), - // boxShadow: [ - // BoxShadow( - // color: Colors.grey.withOpacity(0.1), - // blurRadius: 1, - // offset: const Offset(5, 5), - // ), - // ]), - // child: Padding( - // padding: const EdgeInsets.all(5), - // child: - // Column( - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // height: 100.h, - // width: MediaQuery.sizeOf(context).width, - // // width: 150, - // decoration: BoxDecoration( - // color: APPCOLOR.bgGrey, - // borderRadius: BorderRadius.circular(15)), - // child: Stack( - // alignment: Alignment.center, - // children: [ - // AppNetworkImage( - // height: 90.h, - // width: 140, - // imageUrl: - // bestdealproduct.productImages?.first.url ?? - // "", - // backGroundColor: Colors.transparent), - // Positioned( - // right: 5, - // top: 5, - // child: Icon(Icons.favorite_border)) - // ], - // ), - // ), - - // Text( - // bestdealproduct.name ?? "", - // textAlign: TextAlign.left, - // maxLines: 2, - // overflow: TextOverflow.ellipsis, - // style: context.customMedium(APPCOLOR.balck1A1A1A, 16), - // ), - // const SizedBox( - // height: 5, - // ), - // Text( - // bestdealproduct.unit ?? "", - // textAlign: TextAlign.left, - // maxLines: 1, - // overflow: TextOverflow.ellipsis, - // style: context.customMedium( - // Colors.grey.withOpacity(0.8), 12), - // ), - // const SizedBox( - // height: 3, - // ), - // SizedBox( - // height: MediaQuery.of(context).size.height * 0.005, - // ), - // Spacer(), - // Row( - // children: [ - // Row( - // children: [ - // Text( - // "\$${bestdealproduct.discountPrice ?? ""} ", - // textAlign: TextAlign.left, - // maxLines: 1, - // overflow: TextOverflow.ellipsis, - // style: context.customSemiBold(Colors.black, 12), - // ), - // Text( - // "\$${bestdealproduct.basePrice ?? ""}", - // textAlign: TextAlign.left, - // maxLines: 1, - // overflow: TextOverflow.ellipsis, - // style: context - // .customMedium( - // Colors.grey.withOpacity(0.8), - // 12, - // ) - // .copyWith( - // decoration: TextDecoration.lineThrough, - // ), - // ), - // ], - // ), - // const Spacer(), - // Align( - // alignment: Alignment.centerRight, - // child: Container( - // height: - // MediaQuery.of(context).size.height * 0.035, - // width: MediaQuery.of(context).size.width * 0.1, - // decoration: BoxDecoration( - // color: APPCOLOR.lightGreen, - // borderRadius: BorderRadius.circular(5), - // ), - // child: Center( - // child: Text( - // 'Add', - // style: - // context.customRegular(Colors.white, 12), - // ), - // ), - // ), - // ), - // ], - // ), - // ], - // ), - // ), - // ); - // }, - // ), - // ); } }); } diff --git a/lib/src/ui/bottomnavigation/bottom_bar_widget.dart b/lib/src/ui/bottomnavigation/bottom_bar_widget.dart index b6444de..d3b9b35 100644 --- a/lib/src/ui/bottomnavigation/bottom_bar_widget.dart +++ b/lib/src/ui/bottomnavigation/bottom_bar_widget.dart @@ -153,8 +153,6 @@ class _BottomBarState extends State { ], ), ), - - ); } } diff --git a/lib/src/ui/card_checkout/card_checkout_screen.dart b/lib/src/ui/card_checkout/card_checkout_screen.dart index aa371a8..e0ccf7e 100644 --- a/lib/src/ui/card_checkout/card_checkout_screen.dart +++ b/lib/src/ui/card_checkout/card_checkout_screen.dart @@ -9,34 +9,33 @@ import 'package:grocery_app/utils/extensions/uicontext.dart'; import 'package:provider/provider.dart'; class CardCheckoutScreen extends StatefulWidget { - double amount; - String currency; + // double amount; + // String currency; double originalAmount; - String name; - String phone; - String email; - String userId; + // String name; + // String phone; + // String email; + // String userId; String cartId; String addressId; - String remarks; + // String remarks; double deliverCharge; - double discountPrice; + String? couponId; CardCheckoutScreen( {super.key, - required this.amount, - required this.currency, + // required this.amount, + // required this.currency, required this.originalAmount, - required this.name, - required this.phone, - required this.email, - required this.userId, + // required this.name, + // required this.phone, + // required this.email, + // required this.userId, required this.cartId, required this.addressId, - required this.remarks, + // required this.remarks, required this.deliverCharge, - required this.discountPrice, this.couponId}); @override @@ -88,28 +87,19 @@ class _CardCheckoutScreenState extends State { child: InkWell( onTap: () { if (paymentProvider.selectedPaymentMethod == "Online") { + print("dsjfkhkdfhgdkfghdfg"); paymentProvider.orderPaymnet( context, - widget.amount, - widget.currency, widget.originalAmount, - widget.name, - widget.phone, - widget.email, - widget.userId, widget.cartId, widget.addressId, - widget.remarks); + widget.couponId!); } else { - print("ldksjfgkljdfghljkfdg"); paymentProvider.paymentCODOrder( context, - widget.amount, - widget.deliverCharge, - widget.discountPrice, widget.originalAmount, - // widget.couponId!, - '00', + widget.deliverCharge, + widget.couponId!, widget.addressId, ); } diff --git a/lib/src/ui/cart/cartview_screen.dart b/lib/src/ui/cart/cartview_screen.dart index b8d4cb1..37f5bf9 100644 --- a/lib/src/ui/cart/cartview_screen.dart +++ b/lib/src/ui/cart/cartview_screen.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; + import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_svg/svg.dart'; @@ -37,13 +37,15 @@ class Mycart extends StatefulWidget { class _MycartState extends State { @override void initState() { - Provider.of(context, listen: false) - .getItemCards(context); - - Provider.of(context, listen: false) - .getCurrentLocation(context); - Provider.of(context, listen: false).getAddress(context); + Future.microtask(() { + final addToCartProvider = + Provider.of(context, listen: false); + addToCartProvider.getItemCards(context); + addToCartProvider.offerCoupon(context); + addToCartProvider.getCurrentLocation(context); + addToCartProvider.getAddress(context); + }); super.initState(); } @@ -165,38 +167,13 @@ class _MycartState extends State { ), child: Center( child: Text( - "${calculateDiscountPercentage(double.parse(provider.productDetails.data!.basePrice), double.parse(provider.productDetails.data!.discountPrice))}% OFF", + "${calculateDiscountPercentage(double.parse(bestdealproduct!.basePrice), double.parse(bestdealproduct!.discountPrice))}% OFF", style: TextStyle( color: Colors.white, fontSize: 12)), ), ), ) - // Positioned( - // right: 5, - // top: 5, - // child: InkWell( - // onTap: () async { - // if (await SharedPrefUtils.getToken() != - // null) { - // provider.toggleWishlist( - // context, bestdealproduct.id!); - // } else { - // context.push(MyRoutes.LOGIN); - // } - // }, - // child: Icon( - // provider.wishlist - // .contains(bestdealproduct.id) - // ? Icons.favorite - // : Icons.favorite_border, - // color: provider.wishlist - // .contains(bestdealproduct.id) - // ? Colors.red - // : Colors.grey, - // ), - // ), - // ), ], ), ), @@ -749,7 +726,6 @@ class _MycartState extends State { ), )); } else { - print("kldjhgjkhfgjkh "); return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -759,18 +735,29 @@ class _MycartState extends State { style: TextStyle(fontWeight: FontWeight.bold)), trailing: Icon(Icons.arrow_forward_ios), onTap: () { - context.push(MyRoutes.COUPONSSCREEN); + if (provider.couponDataModel.data!.isNotEmpty) { + context.push(MyRoutes.COUPONSSCREEN, + extra: provider.allitem.id); + } else { + Fluttertoast.showToast( + msg: "Coupon's not available !", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + backgroundColor: Colors.red, + textColor: Colors.white, + fontSize: 14.0, + ); + } }, ), SummaryRow( - label: 'Item Total Price', - value: '\$${provider.allitem.subtotal}'), - SummaryRow(label: 'Discount', value: '0.0'), + label: 'Item Total Price', value: '\$${provider.totalPrice}'), + SummaryRow(label: 'Discount', value: "${provider.discount}"), SummaryRow(label: 'Delivery Free', value: 'Free', isGreen: true), Divider(), SummaryRow( label: 'Grand Total', - value: '\$${provider.allitem.subtotal}', + value: '\$${provider.grandPrice}', isBold: true), ListTile( leading: Icon(Icons.home, color: Colors.green), @@ -991,32 +978,40 @@ class _AddressBottomSheetState extends State { SizedBox(height: 16), Consumer( builder: (context, paymentProvider, child) { - print( - "prxvsvxvice ${double.parse(paymentProvider.allitem.subtotal.toString())} ${paymentProvider.selecteUserName} ${paymentProvider.selectedAddress} ${paymentProvider.selecteEmail} ${paymentProvider.selecteUserPhone}"); return ElevatedButton.icon( onPressed: () { - Navigator.pop(context); - Navigator.of(context).push(MaterialPageRoute( - builder: (context) { - return CardCheckoutScreen( - amount: double.parse( - paymentProvider.allitem.subtotal.toString()), - currency: "INR", - originalAmount: double.parse( - paymentProvider.allitem.subtotal.toString()), - name: paymentProvider.selecteUserName, - phone: paymentProvider.selecteUserPhone, - email: paymentProvider.selecteEmail, - userId: paymentProvider.allitem.userId!, - cartId: paymentProvider.allitem.id!, - addressId: paymentProvider.selectedAddress, - remarks: paymentProvider.selecteUserName, - deliverCharge: 0, - discountPrice: 0, - couponId: '', - ); - }, - )); + if (paymentProvider.selectedAddress.isNotEmpty) { + Navigator.pop(context); + Navigator.of(context).push(MaterialPageRoute( + builder: (context) { + return CardCheckoutScreen( + // amount: double.parse( + // paymentProvider.allitem.subtotal.toString()), + // currency: "INR", + originalAmount: paymentProvider.grandPrice, + + // name: paymentProvider.selecteUserName, + // phone: paymentProvider.selecteUserPhone, + // email: paymentProvider.selecteEmail, + // userId: paymentProvider.allitem.userId!, + cartId: paymentProvider.allitem.id!, + addressId: paymentProvider.selectedAddress, + // remarks: paymentProvider.selecteUserName, + deliverCharge: 0, + couponId: paymentProvider.couponId, + ); + }, + )); + } else { + Fluttertoast.showToast( + msg: "Please add a delivery address", + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.BOTTOM, + backgroundColor: Colors.green, + textColor: Colors.white, + fontSize: 14.0, + ); + } }, label: Text( "Continue", @@ -1049,13 +1044,6 @@ class _AddressBottomSheetState extends State { itemBuilder: (context, index) { var address = addressProvider.addresslist[index]; - // // if (addressProvider.addresslist.length == 1) { - // // addressProvider.bydefaultSetAddress( - // // address.phoneNumber, address.name, address.user!.email); - // // } - - // print("sdhfjdjkfhg ${address.id} ${index}"); - return Card( elevation: 0, shape: RoundedRectangleBorder( diff --git a/lib/src/ui/coupons/coupons_screen.dart b/lib/src/ui/coupons/coupons_screen.dart index 5dd39ce..8fb49ef 100644 --- a/lib/src/ui/coupons/coupons_screen.dart +++ b/lib/src/ui/coupons/coupons_screen.dart @@ -1,26 +1,17 @@ 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:provider/provider.dart'; class CouponsScreen extends StatelessWidget { - final List> coupons = [ - { - "title": "Flat 10% OFF on Standard Chartered Digismart Credit Cards", - "description": "No Minimum Order Value", - "code": "DIGISMART" - }, - { - "title": "Flat 10% OFF upto \$10 on HSBC Cashback Credit Card", - "description": "Total Value of Items Must be \$3 or More", - "code": "HSBC10" - }, - { - "title": "Get Upto 50 OFF on Your First Payment", - "description": "Total Value of Items Must be \$10 or More", - "code": "PAYMENT50" - } - ]; + String cartId; + CouponsScreen({super.key, required this.cartId}); + TextEditingController inpucode = TextEditingController(); + final _formKey = GlobalKey(); @override Widget build(BuildContext context) { + print("kldfjgdfkljgdf ${cartId}"); return Scaffold( appBar: AppBar( backgroundColor: Colors.white, @@ -34,99 +25,141 @@ class CouponsScreen extends StatelessWidget { padding: EdgeInsets.all(16.0), child: Column( children: [ - TextField( - cursorHeight: 20, - decoration: InputDecoration( - hintText: "Enter Coupon Code", - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(12), - ), - suffixIcon: Padding( - padding: const EdgeInsets.all(8.0), - child: ElevatedButton( - onPressed: () { - Navigator.pop(context); - }, - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), + Form( + key: _formKey, + child: Consumer( + builder: (context, provider, child) { + return TextFormField( + controller: inpucode, + cursorHeight: 20, + readOnly: false, + decoration: InputDecoration( + hintText: "Enter Coupon Code", + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12), ), - ), - child: Text("Apply"), - ), - ), - ), - ), - SizedBox(height: 16), - Expanded( - child: ListView.builder( - itemCount: coupons.length, - itemBuilder: (context, index) { - final coupon = coupons[index]; - return Card( - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - elevation: 2, - child: Padding( - padding: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - coupon["title"]!, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.bold, + suffixIcon: Padding( + padding: const EdgeInsets.all(8.0), + child: ElevatedButton( + onPressed: () async { + if (_formKey.currentState!.validate()) { + // var status = await provider.applyCoupon( + // context, + // cartId, + // inpucode.text, + // ); + + // if (status) { + // Navigator.pop(context); + // } + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.green, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), ), ), - SizedBox(height: 5), - Text( - coupon["description"]!, - 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: () { - Navigator.pop(context); - }, - style: ElevatedButton.styleFrom( - backgroundColor: Colors.green, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), - ), - child: Text("Apply"), - ) - ], - ) - ], + child: Text("Apply"), + ), ), ), + validator: (value) { + if (value == null || value.trim().isEmpty) { + return "Please enter a coupon code"; + } + return null; + }, ); }, ), ), + SizedBox(height: 16), + Consumer(builder: (context, provider, child) { + if (provider.iscouponLoading) { + return Center(child: CircularProgressIndicator()); + } else if (provider.couponDataModel.data!.isEmpty) { + return SizedBox.shrink(); + } else { + return Expanded( + child: ListView.builder( + itemCount: provider.couponDataModel.data!.length, + itemBuilder: (context, index) { + final coupon = provider.couponDataModel.data![index]; + return Card( + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + elevation: 2, + child: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + coupon.description!, + 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: () 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), + ), + ), + child: Text("Apply"), + ) + ], + ) + ], + ), + ), + ); + }, + ), + ); + } + }), ], ), ), diff --git a/lib/src/ui/myOrder/my_order.dart b/lib/src/ui/myOrder/my_order.dart index 548c253..8a036cd 100644 --- a/lib/src/ui/myOrder/my_order.dart +++ b/lib/src/ui/myOrder/my_order.dart @@ -33,10 +33,8 @@ class _MyOrderScreenState extends State { height: 20, width: 20, child: InkWell( - onTap: () - { - context.clearAndPush(routePath: MyRoutes.BOTTOMNAV); - + onTap: () { + context.clearAndPush(routePath: MyRoutes.BOTTOMNAV); }, child: SvgPicture.asset( APPASSETS.back, @@ -71,7 +69,8 @@ class _MyOrderScreenState extends State { final order = orderProvider.orderList[index]; return InkWell( - onTap: () { + onTap: () + { context.pushNamed(MyRoutes.ORDERDETAILS, extra: order); //context.push(MyRoutes.ORDERDETAILS); }, @@ -155,7 +154,7 @@ class _MyOrderScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text("\$" + order.grandTotal, + Text("\$" + order.subtotal, style: TextStyle(fontWeight: FontWeight.bold)), Row( @@ -185,8 +184,8 @@ class _MyOrderScreenState extends State { ElevatedButton( onPressed: () { print("lkdhgkjdfgj"); - _makePhoneCall( - order.stores!.first.vendor!.phone); + // _makePhoneCall( + // order.stores!.first.vendor!.phone); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.green, diff --git a/lib/src/ui/productdetails/product_details.dart b/lib/src/ui/productdetails/product_details.dart index 9534635..7c6d3a8 100644 --- a/lib/src/ui/productdetails/product_details.dart +++ b/lib/src/ui/productdetails/product_details.dart @@ -10,7 +10,7 @@ import 'package:gap/gap.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/allProduct_model.dart'; + import 'package:grocery_app/src/data/product_details.dart'; import 'package:grocery_app/src/logic/provider/bottom_navbar_provider.dart'; import 'package:grocery_app/src/logic/provider/home_provider.dart'; @@ -327,62 +327,61 @@ class _ProductDetailsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - Text("Highlights", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold)), - Gap(2), - Expanded( - child: Container( - color: Colors.grey, - height: 0.4, - ), - ) - ], - ), - AnimatedSize( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - if (provider.productDetails.data!.brand != - null) - _buildText( - "Brand ", - '${provider.productDetails.data!.brand ?? ''}', - ), - // if (isHilightsExpanded) - _buildText( - "Weight", - '${provider.productDetails.data!.unit ?? ""}', + if (provider.productDetails.data!.productHighlight! + .isNotEmpty) ...{ + Row( + children: [ + Text("Highlights", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold)), + Gap(2), + Expanded( + child: Container( + color: Colors.grey, + height: 0.4, ), - if (isHilightsExpanded) - _buildText( - "Product Type", - '${provider.productDetails.data!.productType ?? ""}', - ), - ], + ) + ], + ), + AnimatedSize( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: isHilightsExpanded + ? provider.productDetails.data! + .productHighlight!.length + : 2, + itemBuilder: (context, index) { + final item = provider.productDetails.data! + .productHighlight![index]; + return _buildText( + item.key ?? '', item.value ?? ''); + }, + ), ), ), - ), + Center( + child: TextButton( + onPressed: () { + setState(() { + isHilightsExpanded = !isHilightsExpanded; + }); + }, + child: Text( + isHilightsExpanded + ? "View Less" + : "View More", + style: TextStyle(color: APPCOLOR.appGreen), + ), + ), + ), + }, - Center( - child: TextButton( - onPressed: () { - setState(() { - isHilightsExpanded = !isHilightsExpanded; - }); - }, - child: Text( - isHilightsExpanded ? "View Less" : "View More", - style: TextStyle(color: APPCOLOR.appGreen), - ), - ), - ), Row( children: [ Text("Information", @@ -419,11 +418,12 @@ class _ProductDetailsState extends State { "Seller Address", '${provider.productDetails.data!.store!.storeAddress ?? ""}', ), - if (isExpanded) - _buildText( - "GST Number", - '${provider.productDetails.data!.store!.gstNumber ?? ""}', - ), + // if (isExpanded) + // _buildText( + // "GST Number", + // '${provider.productDetails.data!.store!.gstNumber ?? ""}', + + // ), ], ), ),