diff --git a/lib/config/dependency_injection.dart b/lib/config/dependency_injection.dart index b7f4909..970a88a 100644 --- a/lib/config/dependency_injection.dart +++ b/lib/config/dependency_injection.dart @@ -48,7 +48,6 @@ class AppDependencies { injector.registerSingleton(() => BranchRepoImp()); injector.registerSingleton(() => ShippingRepoImp()); injector.registerSingleton(() => SettingOptionsRepoImp()); - injector.registerSingleton(() => LocationService()); // } diff --git a/lib/view_models/user_view_model.dart b/lib/view_models/user_view_model.dart index 51cf91b..3e5e691 100644 --- a/lib/view_models/user_view_model.dart +++ b/lib/view_models/user_view_model.dart @@ -24,6 +24,7 @@ import 'package:mc_common_app/models/user_models/confirm_password.dart'; import 'package:mc_common_app/models/user_models/country.dart'; import 'package:mc_common_app/models/user_models/forget_password_otp_compare.dart'; import 'package:mc_common_app/models/user_models/forget_password_otp_request.dart'; +import 'package:mc_common_app/models/user_models/image_response.dart'; import 'package:mc_common_app/models/user_models/login_password.dart'; import 'package:mc_common_app/models/user_models/register_user.dart'; import 'package:mc_common_app/models/user_models/user.dart'; @@ -435,7 +436,6 @@ class UserVM extends BaseVM { } } else { Utils.showToast("Please verify your credentials and role type."); - } } else { Utils.showToast(verifiedUser.message ?? ""); @@ -560,7 +560,8 @@ class UserVM extends BaseVM { return await userRepo.getAllCountries(); } - Future performBasicOtpRegisterPage(BuildContext context, {required String countryCode, required String phoneNum, required int role, bool isNeedToPassToken = false, VoidCallback? reloadPage}) async { + Future performBasicOtpRegisterPage(BuildContext context, + {required String countryCode, required String phoneNum, required int role, bool isNeedToPassToken = false, VoidCallback? reloadPage}) async { Utils.showLoading(context); BasicOtpRespModel basicOtp = await userRepo.basicOtp(countryCode + phoneNum, roleId: role, isNeedToPassToken: isNeedToPassToken); Utils.hideLoading(context); @@ -626,13 +627,15 @@ class UserVM extends BaseVM { Future updateUserImage(BuildContext context) async { File? myPick = await commanServices.pickFile(context, fileType: FileType.image); if (myPick != null) { - userRepo.updateUserImage(encodeBase64Image(myPick)).whenComplete(() { - AppState().getUser.data!.userInfo!.userLocalImage = myPick; - }); + await userRepo.updateUserImage(encodeBase64Image(myPick)); + AppState().getUser.data!.userInfo!.userLocalImage = myPick; + notifyListeners(); } notifyListeners(); } + + String encodeBase64Image(File file) { List imageBytes = file.readAsBytesSync(); print(imageBytes); diff --git a/lib/views/profile/profile_view.dart b/lib/views/profile/profile_view.dart index dfb243b..9f3178b 100644 --- a/lib/views/profile/profile_view.dart +++ b/lib/views/profile/profile_view.dart @@ -196,8 +196,8 @@ class _ProfileScreenState extends State { decoration: BoxDecoration(color: MyColors.white, shape: BoxShape.circle, border: Border.all(color: MyColors.darkTextColor, width: 0.1)), child: MyAssets.icEdit.buildSvg(), ).onPress( - () async { - await model.updateUserImage(context).whenComplete(() => setState(() {})); + () async { + await model.updateUserImage(context); }, ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 36040d2..affefda 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,7 +19,7 @@ dependencies: http: ^0.13.6 permission_handler: ^11.3.1 flutter_svg: ^2.0.9 - sizer: any + sizer: ^3.0.4 fluttertoast: ^8.0.8 shared_preferences: ^2.0.6 file_picker: ^8.1.2