fix : exit logic -> chicken
chore : profile page -> poultry science
This commit is contained in:
@@ -98,7 +98,7 @@ Future<void> newSetupAuthDI(String newUrl) async {
|
|||||||
// await tokenService.saveAccessToken(newToken);
|
// await tokenService.saveAccessToken(newToken);
|
||||||
},
|
},
|
||||||
clearTokenCallback: () async {
|
clearTokenCallback: () async {
|
||||||
await tokenService.deleteAllTokens();
|
await tokenService.deleteModuleTokens(Module.chicken);
|
||||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:rasadyar_core/core.dart';
|
|||||||
|
|
||||||
class ProfileLogic extends GetxController {
|
class ProfileLogic extends GetxController {
|
||||||
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
StewardRootLogic rootLogic = Get.find<StewardRootLogic>();
|
||||||
|
GService gService = Get.find<GService>();
|
||||||
RxInt selectedInformationType = 0.obs;
|
RxInt selectedInformationType = 0.obs;
|
||||||
Rxn<Jalali> birthDate = Rxn<Jalali>();
|
Rxn<Jalali> birthDate = Rxn<Jalali>();
|
||||||
|
|
||||||
@@ -2,11 +2,10 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:flutter/cupertino.dart' hide Image;
|
import 'package:flutter/cupertino.dart' hide Image;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/chicken.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
|
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
|
||||||
import 'package:rasadyar_core/core.dart' hide Image;
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
import 'logic.dart';
|
import 'logic.dart';
|
||||||
|
|
||||||
@@ -613,9 +612,12 @@ class ProfilePage extends GetView<ProfileLogic> {
|
|||||||
text: 'خروج',
|
text: 'خروج',
|
||||||
backgroundColor: AppColor.error,
|
backgroundColor: AppColor.error,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await controller.rootLogic.tokenService.deleteAllTokens().then((value){
|
await Future.wait([
|
||||||
Get.back();
|
controller.rootLogic.tokenService.deleteModuleTokens(Module.chicken),
|
||||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
controller.gService.clearSelectedModule(),
|
||||||
|
]).then((value) async {
|
||||||
|
await removeChickenDI();
|
||||||
|
Get.offAllNamed("/moduleList");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
class PoultryScienceProfileLogic extends GetxController {
|
|
||||||
PoultryScienceRootLogic rootLogic = Get.find<PoultryScienceRootLogic>();
|
|
||||||
RxInt selectedInformationType = 0.obs;
|
|
||||||
Rxn<Jalali> birthDate = Rxn<Jalali>();
|
|
||||||
|
|
||||||
Rx<Resource<UserProfile>> userProfile = Rx<Resource<UserProfile>>(
|
|
||||||
Resource.loading(),
|
|
||||||
);
|
|
||||||
|
|
||||||
TextEditingController nameController = TextEditingController();
|
|
||||||
TextEditingController lastNameController = TextEditingController();
|
|
||||||
TextEditingController nationalCodeController = TextEditingController();
|
|
||||||
TextEditingController nationalIdController = TextEditingController();
|
|
||||||
TextEditingController birthdayController = TextEditingController();
|
|
||||||
|
|
||||||
TextEditingController oldPasswordController = TextEditingController();
|
|
||||||
TextEditingController newPasswordController = TextEditingController();
|
|
||||||
TextEditingController retryNewPasswordController = TextEditingController();
|
|
||||||
|
|
||||||
RxList<IranProvinceCityModel> cites = <IranProvinceCityModel>[].obs;
|
|
||||||
Rxn<IranProvinceCityModel> selectedProvince = Rxn();
|
|
||||||
Rxn<IranProvinceCityModel> selectedCity = Rxn();
|
|
||||||
|
|
||||||
GlobalKey<FormState> formKey = GlobalKey();
|
|
||||||
ImagePicker imagePicker = ImagePicker();
|
|
||||||
Rxn<XFile> selectedImage = Rxn<XFile>();
|
|
||||||
RxnString _base64Image = RxnString();
|
|
||||||
RxBool isOnLoading = false.obs;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
ever(selectedImage, (data) async {
|
|
||||||
if (data?.path != null) {
|
|
||||||
_base64Image.value = await convertImageToBase64(data!.path);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onReady() {
|
|
||||||
super.onReady();
|
|
||||||
getUserProfile();
|
|
||||||
selectedProvince.listen((p0) => getCites());
|
|
||||||
userProfile.listen((data) {
|
|
||||||
nameController.text = data.data?.firstName ?? '';
|
|
||||||
lastNameController.text = data.data?.lastName ?? '';
|
|
||||||
nationalCodeController.text = data.data?.nationalCode ?? '';
|
|
||||||
nationalIdController.text = data.data?.nationalId ?? '';
|
|
||||||
birthdayController.text =
|
|
||||||
data.data?.birthday?.toJalali.formatCompactDate() ?? '';
|
|
||||||
birthDate.value = data.data?.birthday?.toJalali;
|
|
||||||
selectedProvince.value = IranProvinceCityModel(
|
|
||||||
name: data.data?.province ?? '',
|
|
||||||
id: data.data?.provinceNumber ?? 0,
|
|
||||||
);
|
|
||||||
|
|
||||||
selectedCity.value = IranProvinceCityModel(
|
|
||||||
name: data.data?.city ?? '',
|
|
||||||
id: data.data?.cityNumber ?? 0,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getUserProfile() async {
|
|
||||||
/* userProfile.value = Resource.loading();
|
|
||||||
await safeCall<UserProfile?>(
|
|
||||||
call: () async => await rootLogic.poultryRepository.getUserProfile(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null) {
|
|
||||||
userProfile.value = Resource.success(result);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {},
|
|
||||||
);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> getCites() async {
|
|
||||||
/* await safeCall(
|
|
||||||
call: () =>
|
|
||||||
rootLogic.chickenRepository.getCity(provinceName: selectedProvince.value?.name ?? ''),
|
|
||||||
onSuccess: (result) {
|
|
||||||
if (result != null && result.isNotEmpty) {
|
|
||||||
cites.value = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updateUserProfile() async {
|
|
||||||
/* UserProfile userProfile = UserProfile(
|
|
||||||
firstName: nameController.text,
|
|
||||||
lastName: lastNameController.text,
|
|
||||||
nationalCode: nationalCodeController.text,
|
|
||||||
nationalId: nationalIdController.text,
|
|
||||||
birthday: birthDate.value?.toDateTime().formattedDashedGregorian.toString(),
|
|
||||||
image: _base64Image.value,
|
|
||||||
personType: 'self',
|
|
||||||
type: 'self_profile',
|
|
||||||
);
|
|
||||||
isOnLoading.value = true;
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.updateUserProfile(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
userProfile: userProfile,
|
|
||||||
),
|
|
||||||
onSuccess: (result) {
|
|
||||||
isOnLoading.value = false;
|
|
||||||
},
|
|
||||||
onError: (error, stackTrace) {
|
|
||||||
isOnLoading.value = false;
|
|
||||||
},
|
|
||||||
);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updatePassword() async {
|
|
||||||
/*if (formKey.currentState?.validate() ?? false) {
|
|
||||||
ChangePasswordRequestModel model = ChangePasswordRequestModel(
|
|
||||||
username: userProfile.value.data?.mobile,
|
|
||||||
password: newPasswordController.text,
|
|
||||||
);
|
|
||||||
|
|
||||||
await safeCall(
|
|
||||||
call: () async => await rootLogic.chickenRepository.updatePassword(
|
|
||||||
token: rootLogic.tokenService.accessToken.value!,
|
|
||||||
model: model,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearPasswordForm() {
|
|
||||||
oldPasswordController.clear();
|
|
||||||
newPasswordController.clear();
|
|
||||||
retryNewPasswordController.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,609 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart' hide Image;
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:rasadyar_chicken/chicken.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
|
||||||
import 'package:rasadyar_chicken/data/models/response/user_profile/user_profile.dart';
|
|
||||||
import 'package:rasadyar_core/core.dart';
|
|
||||||
|
|
||||||
import 'logic.dart';
|
|
||||||
|
|
||||||
class PoultryScienceProfilePage extends GetView<PoultryScienceProfileLogic> {
|
|
||||||
const PoultryScienceProfilePage({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
spacing: 30,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: Container(
|
|
||||||
color: AppColor.blueNormal,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(),
|
|
||||||
ObxValue((data) {
|
|
||||||
final status = data.value.status;
|
|
||||||
|
|
||||||
if (status == ResourceStatus.loading) {
|
|
||||||
return Container(
|
|
||||||
width: 128.w,
|
|
||||||
height: 128.h,
|
|
||||||
child: Center(child: CupertinoActivityIndicator(color: AppColor.greenNormal)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == ResourceStatus.error) {
|
|
||||||
return Container(
|
|
||||||
width: 128.w,
|
|
||||||
height: 128.h,
|
|
||||||
child: Center(child: Text('خطا در دریافت اطلاعات')),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default UI
|
|
||||||
return Container(
|
|
||||||
width: 128.w,
|
|
||||||
height: 128.h,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: AppColor.blueLightActive,
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: CircleAvatar(
|
|
||||||
radius: 64.w,
|
|
||||||
backgroundImage: NetworkImage(data.value.data!.image!),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.userProfile),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 10),
|
|
||||||
child: userProfileInformation(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
Center(
|
|
||||||
child: Wrap(
|
|
||||||
alignment: WrapAlignment.center,
|
|
||||||
spacing: 20,
|
|
||||||
runSpacing: 10,
|
|
||||||
children: [
|
|
||||||
cardActionWidget(
|
|
||||||
title: 'تغییر رمز عبور',
|
|
||||||
selected: true,
|
|
||||||
onPressed: () {
|
|
||||||
Get.bottomSheet(changePasswordBottomSheet(), isScrollControlled: true);
|
|
||||||
},
|
|
||||||
icon: Assets.vec.lockSvg.path,
|
|
||||||
),
|
|
||||||
cardActionWidget(
|
|
||||||
title: 'خروج',
|
|
||||||
selected: true,
|
|
||||||
color: ColorFilter.mode(Colors.redAccent, BlendMode.srcIn),
|
|
||||||
cardColor: Color(0xFFEFEFEF),
|
|
||||||
textColor: AppColor.redDarkerText,
|
|
||||||
onPressed: () {
|
|
||||||
Get.bottomSheet(exitBottomSheet(), isScrollControlled: true);
|
|
||||||
},
|
|
||||||
icon: Assets.vec.logoutSvg.path,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(height: 100),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Container invoiceIssuanceInformation() => Container();
|
|
||||||
|
|
||||||
Widget bankInformationWidget() => Column(
|
|
||||||
spacing: 16,
|
|
||||||
children: [
|
|
||||||
itemList(title: 'نام بانک', content: 'سامان'),
|
|
||||||
itemList(title: 'نام صاحب حساب', content: 'رضا رضایی'),
|
|
||||||
itemList(title: 'شماره کارت ', content: '54154545415'),
|
|
||||||
itemList(title: 'شماره حساب', content: '62565263263652'),
|
|
||||||
itemList(title: 'شماره شبا', content: '62565263263652'),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget userProfileInformation() {
|
|
||||||
return ObxValue((data) {
|
|
||||||
if (data.value.status == ResourceStatus.loading) {
|
|
||||||
return LoadingWidget();
|
|
||||||
} else if (data.value.status == ResourceStatus.error) {
|
|
||||||
return ErrorWidget('خطا در دریافت اطلاعات کاربر');
|
|
||||||
} else if (data.value.status == ResourceStatus.success) {
|
|
||||||
UserProfile item = data.value.data!;
|
|
||||||
return Column(
|
|
||||||
spacing: 6,
|
|
||||||
children: [
|
|
||||||
buildRowOnTapped(
|
|
||||||
onTap: () {
|
|
||||||
Get.bottomSheet(
|
|
||||||
userInformationBottomSheet(),
|
|
||||||
isScrollControlled: true,
|
|
||||||
ignoreSafeArea: false,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
titleWidget: Column(
|
|
||||||
spacing: 3,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'اطلاعات هویتی',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
Container(width: 37.w, height: 1.h, color: AppColor.greenNormal),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
valueWidget: Assets.vec.editSvg.svg(
|
|
||||||
width: 24.w,
|
|
||||||
height: 24.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
itemList(
|
|
||||||
title: 'نام و نام خانوادگی',
|
|
||||||
content: item.fullname ?? 'نامشخص',
|
|
||||||
icon: Assets.vec.userSvg.path,
|
|
||||||
hasColoredBox: true,
|
|
||||||
),
|
|
||||||
itemList(
|
|
||||||
title: 'موبایل',
|
|
||||||
content: item.mobile ?? 'نامشخص',
|
|
||||||
icon: Assets.vec.callSvg.path,
|
|
||||||
),
|
|
||||||
itemList(
|
|
||||||
title: 'کدملی',
|
|
||||||
content: item.nationalId ?? 'نامشخص',
|
|
||||||
icon: Assets.vec.tagUserSvg.path,
|
|
||||||
),
|
|
||||||
itemList(
|
|
||||||
title: 'شماره شناسنامه',
|
|
||||||
content: item.nationalCode ?? 'نامشخص',
|
|
||||||
icon: Assets.vec.userSquareSvg.path,
|
|
||||||
),
|
|
||||||
itemList(
|
|
||||||
title: 'تاریخ تولد',
|
|
||||||
content: item.birthday?.toJalali.formatCompactDate() ?? 'نامشخص',
|
|
||||||
icon: Assets.vec.calendarSvg.path,
|
|
||||||
),
|
|
||||||
itemList(
|
|
||||||
title: 'استان',
|
|
||||||
content: item.province ?? 'نامشخص',
|
|
||||||
icon: Assets.vec.pictureFrameSvg.path,
|
|
||||||
),
|
|
||||||
itemList(title: 'شهر', content: item.city ?? 'نامشخص', icon: Assets.vec.mapSvg.path),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return SizedBox.shrink();
|
|
||||||
}
|
|
||||||
}, controller.userProfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget itemList({
|
|
||||||
required String title,
|
|
||||||
required String content,
|
|
||||||
String? icon,
|
|
||||||
bool hasColoredBox = false,
|
|
||||||
}) => Container(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 6.h),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: hasColoredBox ? AppColor.greenLight : Colors.transparent,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: hasColoredBox
|
|
||||||
? Border.all(width: 0.25, color: AppColor.bgDark)
|
|
||||||
: Border.all(width: 0, color: Colors.transparent),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
if (icon != null)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
|
||||||
child: SvgGenImage.vec(icon).svg(
|
|
||||||
width: 20.w,
|
|
||||||
height: 20.h,
|
|
||||||
colorFilter: ColorFilter.mode(AppColor.mediumGreyNormalActive, BlendMode.srcIn),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(title, style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyNormalActive)),
|
|
||||||
Spacer(),
|
|
||||||
Text(content, style: AppFonts.yekan13.copyWith(color: AppColor.mediumGreyNormalHover)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
Widget cardActionWidget({
|
|
||||||
required String title,
|
|
||||||
required VoidCallback onPressed,
|
|
||||||
required String icon,
|
|
||||||
bool selected = false,
|
|
||||||
ColorFilter? color,
|
|
||||||
Color? cardColor,
|
|
||||||
Color? textColor,
|
|
||||||
}) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: onPressed,
|
|
||||||
child: Column(
|
|
||||||
spacing: 4,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
width: 52,
|
|
||||||
height: 52,
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: ShapeDecoration(
|
|
||||||
color: cardColor ?? AppColor.blueLight,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
),
|
|
||||||
child: SvgGenImage.vec(icon).svg(
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
colorFilter:
|
|
||||||
color ??
|
|
||||||
ColorFilter.mode(
|
|
||||||
selected ? AppColor.blueNormal : AppColor.whiteLight,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: 2),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: AppFonts.yekan10.copyWith(
|
|
||||||
color: textColor ?? (selected ? AppColor.blueNormal : AppColor.blueLightActive),
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget userInformationBottomSheet() {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: 750.h,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'ویرایش اطلاعات هویتی',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
|
|
||||||
),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 12,
|
|
||||||
children: [
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nameController,
|
|
||||||
label: 'نام',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.lastNameController,
|
|
||||||
label: 'نام خانوادگی',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nationalCodeController,
|
|
||||||
label: 'شماره شناسنامه',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.nationalIdController,
|
|
||||||
label: 'کد ملی',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
),
|
|
||||||
|
|
||||||
ObxValue((data) {
|
|
||||||
return RTextField(
|
|
||||||
controller: controller.birthdayController,
|
|
||||||
label: 'تاریخ تولد',
|
|
||||||
initText: data.value?.formatCompactDate() ?? '',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
onTap: () {},
|
|
||||||
);
|
|
||||||
}, controller.birthDate),
|
|
||||||
|
|
||||||
SizedBox(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(),
|
|
||||||
|
|
||||||
Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(color: AppColor.darkGreyLight, width: 1),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'عکس پروفایل',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal),
|
|
||||||
),
|
|
||||||
ObxValue((data) {
|
|
||||||
return Container(
|
|
||||||
width: Get.width,
|
|
||||||
height: 270,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColor.lightGreyNormal,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(width: 1, color: AppColor.blackLight),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: data.value == null
|
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(30, 10, 10, 30),
|
|
||||||
child: Image.network(
|
|
||||||
controller.userProfile.value.data?.image ?? '',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Image.file(File(data.value!.path), fit: BoxFit.cover),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}, controller.selectedImage),
|
|
||||||
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
RElevated(
|
|
||||||
text: 'گالری',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: Colors.white),
|
|
||||||
onPressed: () async {
|
|
||||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
|
||||||
source: ImageSource.gallery,
|
|
||||||
imageQuality: 60,
|
|
||||||
maxWidth: 1080,
|
|
||||||
maxHeight: 720,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(width: 16),
|
|
||||||
ROutlinedElevated(
|
|
||||||
text: 'دوربین',
|
|
||||||
width: 150.w,
|
|
||||||
height: 40.h,
|
|
||||||
textStyle: AppFonts.yekan20.copyWith(color: AppColor.blueNormal),
|
|
||||||
onPressed: () async {
|
|
||||||
controller.selectedImage.value = await controller.imagePicker.pickImage(
|
|
||||||
source: ImageSource.camera,
|
|
||||||
imageQuality: 60,
|
|
||||||
maxWidth: 1080,
|
|
||||||
maxHeight: 720,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
ObxValue((data) {
|
|
||||||
return RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'ویرایش',
|
|
||||||
isLoading: data.value,
|
|
||||||
onPressed: () async {
|
|
||||||
await controller.updateUserProfile();
|
|
||||||
controller.getUserProfile();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}, controller.isOnLoading),
|
|
||||||
ROutlinedElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'انصراف',
|
|
||||||
borderColor: AppColor.blueNormal,
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget changePasswordBottomSheet() {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: 400.h,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Form(
|
|
||||||
key: controller.formKey,
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'تغییر رمز عبور',
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.darkGreyDarkHover),
|
|
||||||
),
|
|
||||||
SizedBox(),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.oldPasswordController,
|
|
||||||
hintText: 'رمز عبور قبلی',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'رمز عبور را وارد کنید';
|
|
||||||
} else if (controller.userProfile.value.data?.password != value) {
|
|
||||||
return 'رمز عبور صحیح نیست';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.newPasswordController,
|
|
||||||
hintText: 'رمز عبور جدید',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'رمز عبور را وارد کنید';
|
|
||||||
} else if (value.length < 6) {
|
|
||||||
return 'رمز عبور باید بیش از 6 کارکتر باشد.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RTextField(
|
|
||||||
controller: controller.retryNewPasswordController,
|
|
||||||
hintText: 'تکرار رمز عبور جدید',
|
|
||||||
borderColor: AppColor.darkGreyLight,
|
|
||||||
filledColor: AppColor.bgLight,
|
|
||||||
filled: true,
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'رمز عبور را وارد کنید';
|
|
||||||
} else if (value.length < 6) {
|
|
||||||
return 'رمز عبور باید بیش از 6 کارکتر باشد.';
|
|
||||||
} else if (controller.newPasswordController.text != value) {
|
|
||||||
return 'رمز عبور جدید یکسان نیست';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(),
|
|
||||||
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'ویرایش',
|
|
||||||
onPressed: () async {
|
|
||||||
if (controller.formKey.currentState?.validate() != true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await controller.updatePassword();
|
|
||||||
controller.getUserProfile();
|
|
||||||
controller.clearPasswordForm();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ROutlinedElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'انصراف',
|
|
||||||
borderColor: AppColor.blueNormal,
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget exitBottomSheet() {
|
|
||||||
return BaseBottomSheet(
|
|
||||||
height: 220.h,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: Form(
|
|
||||||
key: controller.formKey,
|
|
||||||
child: Column(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Text('خروج', style: AppFonts.yekan16Bold.copyWith(color: AppColor.error)),
|
|
||||||
SizedBox(),
|
|
||||||
Text(
|
|
||||||
'آیا مطمئن هستید که میخواهید از حساب کاربری خود خارج شوید؟',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: AppFonts.yekan16Bold.copyWith(color: AppColor.textColor),
|
|
||||||
),
|
|
||||||
|
|
||||||
SizedBox(),
|
|
||||||
|
|
||||||
Row(
|
|
||||||
spacing: 16,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
RElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'خروج',
|
|
||||||
backgroundColor: AppColor.error,
|
|
||||||
onPressed: () async {
|
|
||||||
await controller.rootLogic.tokenService.deleteAllTokens().then((value) {
|
|
||||||
Get.back();
|
|
||||||
Get.offAllNamed(ChickenRoutes.auth, arguments: Module.chicken);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ROutlinedElevated(
|
|
||||||
height: 40.h,
|
|
||||||
text: 'انصراف',
|
|
||||||
borderColor: AppColor.blueNormal,
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||||
import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_science_repository.dart';
|
import 'package:rasadyar_chicken/data/repositories/poultry_science/poultry_science_repository.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/home/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/home/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/profile/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
import 'package:rasadyar_chicken/presentation/utils/utils.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class PoultryScienceRootLogic extends GetxController {
|
class PoultryScienceRootLogic extends GetxController {
|
||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
List<Widget> pages = [PoultryActionPage(), PoultryScienceHomePage(), PoultryScienceProfilePage()];
|
List<Widget> pages = [PoultryActionPage(), PoultryScienceHomePage(), ProfilePage()];
|
||||||
late DioRemote dioRemote;
|
late DioRemote dioRemote;
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
late PoultryScienceRepository poultryRepository;
|
late PoultryScienceRepository poultryRepository;
|
||||||
@@ -39,7 +39,7 @@ class PoultryScienceRootLogic extends GetxController {
|
|||||||
|
|
||||||
void rootErrorHandler(DioException error) {
|
void rootErrorHandler(DioException error) {
|
||||||
handleGeneric(error, () {
|
handleGeneric(error, () {
|
||||||
tokenService.deleteAllTokens();
|
tokenService.deleteModuleTokens(Module.chicken);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import 'package:rasadyar_chicken/data/models/response/inventory/inventory_model.
|
|||||||
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
import 'package:rasadyar_chicken/data/models/response/iran_province_city/iran_province_city_model.dart';
|
||||||
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
import 'package:rasadyar_chicken/data/models/response/roles_products/roles_products.dart';
|
||||||
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
|
import 'package:rasadyar_chicken/data/repositories/chicken/chicken_repository.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/pages/common/profile/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/buy/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/buy/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/home/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/home/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/profile/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/sale/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/sale/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/segmentation/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/segmentation/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||||
@@ -114,7 +114,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
|
|
||||||
void rootErrorHandler(DioException error) {
|
void rootErrorHandler(DioException error) {
|
||||||
handleGeneric(error, () {
|
handleGeneric(error, () {
|
||||||
tokenService.deleteAllTokens();
|
tokenService.deleteModuleTokens(Module.chicken);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ export 'buy_out_of_province/logic.dart';
|
|||||||
export 'buy_out_of_province/view.dart';
|
export 'buy_out_of_province/view.dart';
|
||||||
export 'home/logic.dart';
|
export 'home/logic.dart';
|
||||||
export 'home/view.dart';
|
export 'home/view.dart';
|
||||||
export 'profile/logic.dart';
|
|
||||||
export 'profile/view.dart';
|
|
||||||
export 'root/logic.dart';
|
export 'root/logic.dart';
|
||||||
export 'root/view.dart';
|
export 'root/view.dart';
|
||||||
export 'sale/logic.dart';
|
export 'sale/logic.dart';
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import 'package:rasadyar_chicken/presentation/pages/common/auth/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/common/auth/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/common/auth/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/common/auth/view.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/pages/common/profile/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/pages/common/role/logic.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/pages/common/role/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/active_hatching/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/farm/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/farm/logic.dart';
|
||||||
@@ -9,11 +12,8 @@ import 'package:rasadyar_chicken/presentation/pages/poultry_science/inspection/l
|
|||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/inspection/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/inspection/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/poultry_action/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/profile/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/logic.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/view.dart';
|
import 'package:rasadyar_chicken/presentation/pages/poultry_science/root/view.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/pages/common/role/logic.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/pages/common/role/view.dart';
|
|
||||||
import 'package:rasadyar_chicken/presentation/pages/steward/steward.dart';
|
import 'package:rasadyar_chicken/presentation/pages/steward/steward.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||||
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
import 'package:rasadyar_chicken/presentation/widget/base_page/logic.dart';
|
||||||
@@ -159,7 +159,7 @@ sealed class ChickenPages {
|
|||||||
Get.lazyPut(() => SearchLogic());
|
Get.lazyPut(() => SearchLogic());
|
||||||
Get.lazyPut(() => PoultryScienceRootLogic());
|
Get.lazyPut(() => PoultryScienceRootLogic());
|
||||||
Get.lazyPut(() => PoultryScienceHomeLogic());
|
Get.lazyPut(() => PoultryScienceHomeLogic());
|
||||||
Get.lazyPut(() => PoultryScienceProfileLogic());
|
Get.lazyPut(() => ProfileLogic());
|
||||||
Get.lazyPut(() => PoultryActionLogic());
|
Get.lazyPut(() => PoultryActionLogic());
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ class GService extends GetxService {
|
|||||||
await model.save();
|
await model.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> clearSelectedModule() async {
|
||||||
|
AppModel model = box.values.first;
|
||||||
|
model.selectedModule = null;
|
||||||
|
await model.save();
|
||||||
|
}
|
||||||
|
|
||||||
TargetPage? getTargetPage(Module? module) {
|
TargetPage? getTargetPage(Module? module) {
|
||||||
if (isFirstTime()) {
|
if (isFirstTime()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -40,11 +46,11 @@ class GService extends GetxService {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> saveSelectedRole(Module module,String route) async {
|
Future<void> saveSelectedRole(Module module, String route) async {
|
||||||
AppModel model = box.values.first;
|
AppModel model = box.values.first;
|
||||||
TargetPage? targetPage = model.targetPages?.firstWhere((element) => element.module == module);
|
TargetPage? targetPage = model.targetPages?.firstWhere((element) => element.module == module);
|
||||||
if(targetPage!=null){
|
if (targetPage != null) {
|
||||||
targetPage.route =route;
|
targetPage.route = route;
|
||||||
model.save();
|
model.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,10 @@ class TokenStorageService extends GetxService {
|
|||||||
|
|
||||||
Future<void> deleteModuleTokens(Module module) async {
|
Future<void> deleteModuleTokens(Module module) async {
|
||||||
UserLocalModel? user = getUserLocal(module);
|
UserLocalModel? user = getUserLocal(module);
|
||||||
await user?.delete();
|
user?.token = null;
|
||||||
|
user?.refreshToken = null;
|
||||||
|
user?.backend = null;
|
||||||
|
await user?.save();
|
||||||
accessToken.value = null;
|
accessToken.value = null;
|
||||||
refreshToken.value = null;
|
refreshToken.value = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Future<void> setupInspectionDI() async {
|
|||||||
// await tokenService.saveAccessToken(newToken);
|
// await tokenService.saveAccessToken(newToken);
|
||||||
},
|
},
|
||||||
clearTokenCallback: () async {
|
clearTokenCallback: () async {
|
||||||
await tokenService.deleteAllTokens();
|
await tokenService.deleteModuleTokens(Module.inspection);
|
||||||
Get.offAllNamed(InspectionRoutes.auth, arguments: Module.inspection);
|
Get.offAllNamed(InspectionRoutes.auth, arguments: Module.inspection);
|
||||||
},
|
},
|
||||||
authArguments: Module.inspection,
|
authArguments: Module.inspection,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Future<void> setupLiveStockDI() async {
|
|||||||
// await tokenService.saveAccessToken(newToken);
|
// await tokenService.saveAccessToken(newToken);
|
||||||
},
|
},
|
||||||
clearTokenCallback: () async {
|
clearTokenCallback: () async {
|
||||||
await tokenService.deleteAllTokens();
|
await tokenService.deleteModuleTokens(Module.liveStocks);
|
||||||
Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.liveStocks);
|
Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.liveStocks);
|
||||||
},
|
},
|
||||||
authArguments: Module.liveStocks,
|
authArguments: Module.liveStocks,
|
||||||
|
|||||||
@@ -683,10 +683,12 @@ class ProfilePage extends GetView<ProfileLogic> {
|
|||||||
text: 'خروج',
|
text: 'خروج',
|
||||||
backgroundColor: AppColor.error,
|
backgroundColor: AppColor.error,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await controller.rootLogic.tokenService.deleteAllTokens().then((value) {
|
await controller.rootLogic.tokenService
|
||||||
Get.back();
|
.deleteModuleTokens(Module.liveStocks)
|
||||||
Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.chicken);
|
.then((value) {
|
||||||
});
|
Get.back();
|
||||||
|
Get.offAllNamed(LiveStockRoutes.auth, arguments: Module.chicken);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ROutlinedElevated(
|
ROutlinedElevated(
|
||||||
|
|||||||
Reference in New Issue
Block a user