diff --git a/lib/repositories/user_repo.dart b/lib/repositories/user_repo.dart index 5f5bd31..79fe915 100644 --- a/lib/repositories/user_repo.dart +++ b/lib/repositories/user_repo.dart @@ -55,6 +55,8 @@ abstract class UserRepo { Future changePassword(String currentPassword, String newPassword); + //Future updateUserInfo(String firstName, String lastName); + Future changeMobileNoOTPRequest(countryID, String mobileNo, String password); Future changeMobileNo(String userToken, String userOTP); @@ -254,6 +256,13 @@ class UserRepoImp implements UserRepo { return await injector.get().postJsonForObject((json) => ConfirmEmailRespModel.fromJson(json), ApiConsts.ChangeEmail, postParams, token: t); } + // @override + // Future updateUserInfo(String firstName, String lastName) async { + // var postParams = {"userID": "${AppState().getUser.data!.userInfo!.id}", "firstName": "${firstName}", "lastName": "${lastName}", "genderID": 0, "cityID": 0}; + // String t = AppState().getUser.data!.accessToken ?? ""; + // return await injector.get().postJsonForObject((json) => GenericRespModel.fromJson(json), ApiConsts.update, postParams, token: t); + // } + @override Future emailVerify(String email, String userID) async { var postParams = { diff --git a/lib/view_models/user_view_model.dart b/lib/view_models/user_view_model.dart index 3e5e691..2ac2825 100644 --- a/lib/view_models/user_view_model.dart +++ b/lib/view_models/user_view_model.dart @@ -164,6 +164,19 @@ class UserVM extends BaseVM { } } + // Future userDetailsUpdate(BuildContext context, String firstName, String lastName) async { + // Utils.showLoading(context); + // GenericRespModel res = await userRepo.changePassword(currentPassword, newPassword); + // Utils.hideLoading(context); + // if (res.messageStatus == 1) { + // Utils.showToast(LocaleKeys.passwordIsUpdated.tr()); + // + // Navigator.of(context).pushNamedAndRemoveUntil(AppRoutes.profileView, (Route route) => true); + // } else { + // Utils.showToast(res.message ?? ""); + // } + // } + Future performCompleteProfile( BuildContext context, { required String password, @@ -634,8 +647,6 @@ class UserVM extends BaseVM { 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 9f3178b..2db0dee 100644 --- a/lib/views/profile/profile_view.dart +++ b/lib/views/profile/profile_view.dart @@ -54,8 +54,12 @@ class _ProfileScreenState extends State { if (mySubscription!.id == 1) { freeTrialName = mySubscription!.name ?? ""; } else { - startDate = (mySubscription!.dateStart != null && mySubscription!.dateStart!.isNotEmpty) ? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateStart!))) : ""; - endDate = (mySubscription!.dateEnd != null && mySubscription!.dateEnd!.isNotEmpty) ? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateEnd!))) : ""; + startDate = (mySubscription!.dateStart != null && mySubscription!.dateStart!.isNotEmpty) + ? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateStart!))) + : ""; + endDate = (mySubscription!.dateEnd != null && mySubscription!.dateEnd!.isNotEmpty) + ? DateHelper.formatAsDayMonthYear(DateHelper.parseStringToDate(DateHelper.formatDateT(mySubscription!.dateEnd!))) + : ""; } } return Stack( @@ -101,13 +105,34 @@ class _ProfileScreenState extends State { child: ListView( children: [ 60.height, - "${AppState().getUser.data!.userInfo!.firstName} ${AppState().getUser.data!.userInfo!.lastName ?? ""}".toText(fontSize: 20).paddingOnly(left: 25), + Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + "${AppState().getUser.data!.userInfo!.firstName} ${AppState().getUser.data!.userInfo!.lastName ?? ""}".toText(fontSize: 20).paddingOnly(left: 25), + Container( + height: 40, + width: 40, + padding: const EdgeInsets.all(8), + 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); + }, + ), + ], + ).margin(left: 0, top: 0, right: 24, bottom: 0).onPress(() { + print("Change User Name Here"); + }), Column( children: [ if (AppState().currentAppType == AppType.provider && mySubscription != null) ...[ CustomProfileOptionsTile( titleText: LocaleKeys.mySubscription.tr(), - subtitleText: freeTrialName.isNotEmpty ? freeTrialName : "${startDate.isNotEmpty ? "${LocaleKeys.startDate.tr()}: $startDate" : ""} ${endDate.isNotEmpty ? "${LocaleKeys.expiresOn.tr()}: $endDate" : ""}", + subtitleText: freeTrialName.isNotEmpty + ? freeTrialName + : "${startDate.isNotEmpty ? "${LocaleKeys.startDate.tr()}: $startDate" : ""} ${endDate.isNotEmpty ? "${LocaleKeys.expiresOn.tr()}: $endDate" : ""}", needBorderBelow: true, needEditButton: false, onTap: () {}, @@ -196,7 +221,7 @@ 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 { + () async { await model.updateUserImage(context); }, ),