From f9e234b2eaba0248de86cfd6f318a66c5751bfce Mon Sep 17 00:00:00 2001 From: zahraaapz Date: Wed, 7 Feb 2024 20:31:11 +0330 Subject: [PATCH] add feature to registerScreen --- .flutter-plugins-dependencies | 2 +- .../register/cubit/register_cubit.dart | 31 +++++ .../register/cubit/register_state.dart | 6 + lib/screens/register/register_screen.dart | 110 +++++++++++++++--- pubspec.lock | 32 +++++ pubspec.yaml | 1 + 6 files changed, 167 insertions(+), 15 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 61ba23d..075390b 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":"flutter_osm_plugin","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_osm_plugin-0.70.4\\\\","native_build":true,"dependencies":[]},{"name":"image_cropper","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper-4.0.1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_ios-0.8.9+1\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.3.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.3.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.5\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_ios-6.2.4\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_osm_plugin","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_osm_plugin-0.70.4\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_plugin_android_lifecycle-2.0.17\\\\","native_build":true,"dependencies":[]},{"name":"image_cropper","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper-4.0.1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_android-0.8.9+3\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider_android","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.2\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-12.0.3\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.2.1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_android-6.2.2\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"file_selector_macos","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_macos-0.9.3+3\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_macos-0.2.1+1\\\\","native_build":false,"dependencies":["file_selector_macos"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.3.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.5\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_macos-3.1.0\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"file_selector_linux","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_linux-0.9.2+1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_linux-0.2.1+1\\\\","native_build":false,"dependencies":["file_selector_linux"]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.3.2\\\\","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_linux-3.1.1\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"file_selector_windows","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_windows-0.9.3+1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_windows-0.2.1+1\\\\","native_build":false,"dependencies":["file_selector_windows"]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.2.1\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.3.2\\\\","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_windows-3.1.1\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"flutter_osm_web","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_osm_web-0.6.2\\\\","dependencies":[]},{"name":"image_cropper_for_web","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper_for_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_for_web-3.0.2\\\\","dependencies":[]},{"name":"permission_handler_html","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_html-0.1.1\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.2.2\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\Users\\\\sasan\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_web-2.2.3\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_osm_plugin","dependencies":["flutter_plugin_android_lifecycle","permission_handler","url_launcher","flutter_osm_web"]},{"name":"flutter_osm_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_cropper","dependencies":["image_cropper_for_web"]},{"name":"image_cropper_for_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":"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":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_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":"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":"2024-02-04 17:25:05.515782","version":"3.16.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_osm_plugin","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_osm_plugin-0.70.4\\\\","native_build":true,"dependencies":[]},{"name":"geocoding_ios","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\geocoding_ios-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"image_cropper","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper-4.0.1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_ios","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_ios-0.8.9+1\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.3.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.3.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.5\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_ios-6.2.4\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_osm_plugin","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_osm_plugin-0.70.4\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_plugin_android_lifecycle-2.0.17\\\\","native_build":true,"dependencies":[]},{"name":"geocoding_android","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\geocoding_android-2.1.2\\\\","native_build":true,"dependencies":[]},{"name":"image_cropper","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper-4.0.1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_android-0.8.9+3\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider_android","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.2\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-12.0.3\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.2.1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_android-6.2.2\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"file_selector_macos","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_macos-0.9.3+3\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_macos","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_macos-0.2.1+1\\\\","native_build":false,"dependencies":["file_selector_macos"]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.3.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.3.5\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_macos-3.1.0\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"file_selector_linux","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_linux-0.9.2+1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_linux-0.2.1+1\\\\","native_build":false,"dependencies":["file_selector_linux"]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.3.2\\\\","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_linux-3.1.1\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"file_selector_windows","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\file_selector_windows-0.9.3+1\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_windows","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_windows-0.2.1+1\\\\","native_build":false,"dependencies":["file_selector_windows"]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.2.1\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.3.2\\\\","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_windows-3.1.1\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"flutter_osm_web","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_osm_web-0.6.2\\\\","dependencies":[]},{"name":"image_cropper_for_web","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_cropper_for_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\image_picker_for_web-3.0.2\\\\","dependencies":[]},{"name":"permission_handler_html","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_html-0.1.1\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.2.2\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\Users\\\\Ns\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_web-2.2.3\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"flutter_osm_plugin","dependencies":["flutter_plugin_android_lifecycle","permission_handler","url_launcher","flutter_osm_web"]},{"name":"flutter_osm_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"geocoding","dependencies":["geocoding_android","geocoding_ios"]},{"name":"geocoding_android","dependencies":[]},{"name":"geocoding_ios","dependencies":[]},{"name":"image_cropper","dependencies":["image_cropper_for_web"]},{"name":"image_cropper_for_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":"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":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_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":"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":"2024-02-07 20:21:51.022733","version":"3.16.9"} \ No newline at end of file diff --git a/lib/screens/register/cubit/register_cubit.dart b/lib/screens/register/cubit/register_cubit.dart index ffbd91e..13ded13 100644 --- a/lib/screens/register/cubit/register_cubit.dart +++ b/lib/screens/register/cubit/register_cubit.dart @@ -1,6 +1,10 @@ +import 'dart:io'; + import 'package:bloc/bloc.dart'; import 'package:dio/dio.dart'; import 'package:flutter_osm_plugin/flutter_osm_plugin.dart'; +import 'package:image_cropper/image_cropper.dart'; +import 'package:image_picker/image_picker.dart'; import 'package:meta/meta.dart'; import 'package:watch_store/data/constants.dart'; import 'package:watch_store/data/model/user.dart'; @@ -53,4 +57,31 @@ class RegisterCubit extends Cubit { emit(ErrorState()); } } + + + + Future pickAndCropImage({required ImageSource source}) async { + File _image; + try { + final image = await ImagePicker().pickImage(source: source); + if (image == null) { + emit(CancelImageState()); + } + File? img = File(image!.path); + img = await _cropImage(imageFile: img); + _image = img!; + emit(IntialImageState(image: _image)); + } catch (e) { + emit(CancelImageState()); + } + } + + Future _cropImage({required File imageFile}) async { + CroppedFile? croppedImage = + await ImageCropper().cropImage(sourcePath: imageFile.path); + if (imageFile == null){ + emit(CancelImageState()); + } + return File(croppedImage!.path); + } } diff --git a/lib/screens/register/cubit/register_state.dart b/lib/screens/register/cubit/register_state.dart index 01b5d36..f04cace 100644 --- a/lib/screens/register/cubit/register_state.dart +++ b/lib/screens/register/cubit/register_state.dart @@ -9,6 +9,12 @@ final class LoadingState extends RegisterState {} final class ErrorState extends RegisterState {} +final class IntialImageState extends RegisterState { + File image; + IntialImageState({required this.image}); +} + +final class CancelImageState extends RegisterState {} final class OkResponseState extends RegisterState {} final class LocationPickedState extends RegisterState { diff --git a/lib/screens/register/register_screen.dart b/lib/screens/register/register_screen.dart index 8f15b93..96f00fc 100644 --- a/lib/screens/register/register_screen.dart +++ b/lib/screens/register/register_screen.dart @@ -3,18 +3,19 @@ import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/container.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:image_picker/image_picker.dart'; -import 'package:watch_store/component/text_style.dart'; +import 'package:watch_store/component/button_style.dart'; import 'package:watch_store/data/model/user.dart'; import 'package:watch_store/res/dimens.dart'; import 'package:watch_store/res/strings.dart'; import 'package:watch_store/screens/register/cubit/register_cubit.dart'; -import 'package:watch_store/utils/image_handler.dart'; import 'package:watch_store/widgets/app_text_field.dart'; import 'package:watch_store/widgets/avatar.dart'; import 'package:watch_store/widgets/main_button.dart'; import 'package:watch_store/component/extention.dart'; import 'package:watch_store/widgets/registeration_app_bar.dart'; - +import 'package:geocoding/geocoding.dart'; +import '../../component/text_style.dart'; +import '../../res/colors.dart'; import '../../route/names.dart'; //sasansafari_dev @@ -34,8 +35,7 @@ class _RegisterScreenState extends State { TextEditingController _controllerLocation = TextEditingController(); double lat = 0.0; double lng = 0.0; - - ImageHandler imageHandler = ImageHandler(); + var image = null; @override Widget build(BuildContext context) { @@ -54,11 +54,24 @@ class _RegisterScreenState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ AppDimens.large.height, - Avatar( - onTap: () async => await imageHandler - .pickAndCropImage(source: ImageSource.gallery) - .then((value) => setState(() {})), - file: imageHandler.getImage), + BlocConsumer( + listener: (contxt, state) { + if (state is IntialImageState) { + image = state.image; + } + if (state is CancelImageState) { + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar(content: Text('Cancel'))); + } + }, + builder: (contxt, state) { + return Avatar( + onTap: () { + galleryOrcamera(context, size, contxt); + }, + file: image); + }, + ), AppTextField( lable: AppStrings.nameLastName, hint: AppStrings.hintNameLastName, @@ -76,11 +89,10 @@ class _RegisterScreenState extends State { hint: AppStrings.hintPostalCode, controller: _controllerPostalCode), BlocConsumer( - listener: (context, state) { + listener: (context, state) async { if (state is LocationPickedState) { if (state.location != null) { - _controllerLocation.text = - '${state.location!.latitude} - ${state.location!.longitude}'; + _controllerLocation.text =await getAddress(state.location!.longitude ,state.location!.latitude); lat = state.location!.latitude; lng = state.location!.longitude; @@ -126,7 +138,7 @@ class _RegisterScreenState extends State { address: _controllerAddress.text, postalCode: _controllerPostalCode.text, image: await MultipartFile.fromFile( - imageHandler.getImage!.path), + image.path), lat: lat, lng: lng); @@ -146,4 +158,74 @@ class _RegisterScreenState extends State { ), ); } +Future getAddress(double lng, double lat) async { + String address = ''; + try { + await placemarkFromCoordinates(lat,lng,localeIdentifier: 'fa') + .then((value) { + Placemark first = value.first; + + address = '${first.street}' '${first.locality}' '${first.country}'; + }); + print(lat.toString()); + print(lng.toString()); + return address; + } catch (e) { + return 'آدرس یافت نشد'; + } + } + +Future galleryOrcamera( + BuildContext context, Size size, BuildContext contxt) { + return showModalBottomSheet( + context: context, + builder: (context) => Container( + height: size.height / 5, + width: double.infinity, + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + topRight: Radius.circular(30), topLeft: Radius.circular(30)), + color: Colors.white), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + width: size.width / 1.8, + child: ElevatedButton( + style: AppButtonStyles.mainButtonStyle.copyWith( + backgroundColor: const MaterialStatePropertyAll( + AppColors.primaryColor)), + onPressed: () async => + await BlocProvider.of(contxt) + .pickAndCropImage(source: ImageSource.gallery), + child: const Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon(Icons.photo_library, color: Colors.white), + Text('انتخاب عکس از گالری', + style: AppTextStyles.mainbuttn), + ], + ))), + SizedBox( + width: size.width / 1.8, + child: ElevatedButton( + style: AppButtonStyles.mainButtonStyle.copyWith( + backgroundColor: const MaterialStatePropertyAll( + AppColors.primaryColor)), + onPressed: () async => + await BlocProvider.of(contxt) + .pickAndCropImage(source: ImageSource.camera), + child: const Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Icon(Icons.camera_alt_outlined, color: Colors.white), + Text('انتخاب عکس از دوربین', + style: AppTextStyles.mainbuttn), + ], + )), + ), + ], + )), + ); + } } diff --git a/pubspec.lock b/pubspec.lock index a169f49..27c8845 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -384,6 +384,38 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + geocoding: + dependency: "direct main" + description: + name: geocoding + sha256: e1dc0ac56666d9ed1d5a9ae5543ce9eb5986db6209cc7600103487d09192059c + url: "https://pub.dev" + source: hosted + version: "2.1.1" + geocoding_android: + dependency: transitive + description: + name: geocoding_android + sha256: "609db1d71bc364dd9d0616f72a41c01e0c74f3a3807efb85e0d5a67e57baf50f" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + geocoding_ios: + dependency: transitive + description: + name: geocoding_ios + sha256: "8f79e380abb640ef4d88baee8bb65390058c802601158d0813dc990b36b189d2" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + geocoding_platform_interface: + dependency: transitive + description: + name: geocoding_platform_interface + sha256: "8848605d307d844d89937cdb4b8ad7dfa880552078f310fa24d8a460f6dddab4" + url: "https://pub.dev" + source: hosted + version: "2.0.1" glob: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 7181898..77b5a4f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,7 @@ dependencies: image_cropper: ^4.0.1 image_picker: ^1.0.7 flutter_osm_plugin: ^0.70.4 + geocoding: ^2.1.1