refactoriåtion

wala_plus_with_dialog_removal
FaizHashmi 3 weeks ago
parent 825845b4c3
commit e134e8d4e5

@ -807,6 +807,7 @@
"locationServicesRequiredForAttendance": "يجب تفعيل خدمة الموقع لتسجيل الحضور",
"pleaseProvideLocationPermission": "الرجاء منح إذن الموقع",
"microphoneAccessRequired": "يحتاج التطبيق إلى إذن الوصول إلى الميكروفون لتسجيل الصوت.",
"shareAccessGuide": "مشاركة دليل الوصول"
"shareAccessGuide": "مشاركة دليل الوصول",
"nationalIdOrIqamaNumber": "رقم الهوية الوطنية أو الإقامة"
}

@ -807,7 +807,8 @@
"locationServicesRequiredForAttendance": "You need to enable location services to mark attendance",
"pleaseProvideLocationPermission": "Please provide location permission",
"microphoneAccessRequired": "The app needs microphone access to be able to record audio.",
"shareAccessGuide": "Share Access Guide"
"shareAccessGuide": "Share Access Guide",
"nationalIdOrIqamaNumber": "National ID or Iqama Number"
}

@ -819,7 +819,8 @@ class CodegenLoader extends AssetLoader{
"locationServicesRequiredForAttendance": "يجب تفعيل خدمة الموقع لتسجيل الحضور",
"pleaseProvideLocationPermission": "الرجاء منح إذن الموقع",
"microphoneAccessRequired": "يحتاج التطبيق إلى إذن الوصول إلى الميكروفون لتسجيل الصوت.",
"shareAccessGuide": "مشاركة دليل الوصول"
"shareAccessGuide": "مشاركة دليل الوصول",
"nationalIdOrIqamaNumber": "رقم الهوية الوطنية أو الإقامة"
};
static const Map<String,dynamic> _en_US = {
"mohemm": "Mohemm",
@ -1626,7 +1627,8 @@ static const Map<String,dynamic> _en_US = {
"locationServicesRequiredForAttendance": "You need to enable location services to mark attendance",
"pleaseProvideLocationPermission": "Please provide location permission",
"microphoneAccessRequired": "The app needs microphone access to be able to record audio.",
"shareAccessGuide": "Share Access Guide"
"shareAccessGuide": "Share Access Guide",
"nationalIdOrIqamaNumber": "National ID or Iqama Number"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US};
}

@ -792,5 +792,6 @@ abstract class LocaleKeys {
static const pleaseProvideLocationPermission = 'pleaseProvideLocationPermission';
static const microphoneAccessRequired = 'microphoneAccessRequired';
static const shareAccessGuide = 'shareAccessGuide';
static const nationalIdOrIqamaNumber = 'nationalIdOrIqamaNumber';
}

@ -366,9 +366,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
await Utils.saveStringFromPrefs("P_DEP_MOBILE_NUMBER", mobile);
}
String tokenID =
(AppState().postParamsObject?.tokenID != null && AppState().postParamsObject!.tokenID!.isNotEmpty)
? AppState().postParamsObject!.tokenID!
: (AppState().authenticationTokenID ?? "");
(AppState().postParamsObject?.tokenID != null && AppState().postParamsObject!.tokenID!.isNotEmpty) ? AppState().postParamsObject!.tokenID! : (AppState().authenticationTokenID ?? "");
if (tokenID.isNotEmpty) {
await Utils.saveStringFromPrefs("P_DEP_TOKEN_ID", tokenID);
}
@ -409,7 +407,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
message: LocaleKeys.areYouSureWantToLogOut.tr(),
confirmText: LocaleKeys.yes.tr(),
cancelText: LocaleKeys.no.tr(),
isDestructive: true,
isDestructive: false,
onConfirm: () async {
if (ApiConsts.isDependetLogin) {
await _clearDependentPrefs();
@ -497,11 +495,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
}
},
),
if (ApiConsts.isDependetLogin) IconButton(
icon: const Icon(Icons.logout_rounded, size: 24, color: Color(0xFF1E293B)),
tooltip: LocaleKeys.logout.tr(),
onPressed: _performLogout,
),
if (ApiConsts.isDependetLogin) InkWell(onTap: _performLogout, child: SvgPicture.asset('assets/images/drawer/logout.svg', height: 20, width: 20)),
],
),
],

@ -244,7 +244,7 @@ class _LoginScreenState extends State<LoginScreen> {
bool autoLoggedIn = await _tryDependentAutoLogin();
if (autoLoggedIn) {
return;
}else {
} else {
dependentLoginInfo = await LoginApiClient().getMobileLoginInfoNEWDependent(devToken, devType, memberType: MemberType.dependent.value);
Utils.hideLoading(context);
if (dependentLoginInfo != null) {
@ -790,9 +790,7 @@ class _LoginScreenState extends State<LoginScreen> {
String savedLoginType = await Utils.getStringFromPrefs("P_DEP_LOGIN_TYPE");
int loginType = int.tryParse(savedLoginType) ?? 1;
String effectiveToken = savedAuthToken.isNotEmpty
? savedAuthToken
: (savedToken.isNotEmpty ? savedToken : savedLoginToken);
String effectiveToken = savedAuthToken.isNotEmpty ? savedAuthToken : (savedToken.isNotEmpty ? savedToken : savedLoginToken);
if (nationalId.text.isEmpty) {
nationalId.text = savedNid;
@ -847,13 +845,7 @@ class _LoginScreenState extends State<LoginScreen> {
String devType = Platform.isAndroid ? "android" : "ios";
try {
GenericResponseModel? depLoginResponse = await LoginApiClient().memberLoginDependent(
nationalId: savedNid,
birthDate: savedDob,
deviceToken: devToken,
deviceType: devType,
context: context,
);
GenericResponseModel? depLoginResponse = await LoginApiClient().memberLoginDependent(nationalId: savedNid, birthDate: savedDob, deviceToken: devToken, deviceType: devType, context: context);
if (depLoginResponse?.errorMessage != null && depLoginResponse!.errorMessage!.isNotEmpty) {
if (Utils.isMazayaAccessRevoked(depLoginResponse.errorMessage)) {
@ -866,22 +858,14 @@ class _LoginScreenState extends State<LoginScreen> {
}
if (depLoginResponse != null) {
String? authToken = (depLoginResponse.authenticationTokenID != null && depLoginResponse.authenticationTokenID!.trim().isNotEmpty)
? depLoginResponse.authenticationTokenID!.trim()
: null;
String? authToken = (depLoginResponse.authenticationTokenID != null && depLoginResponse.authenticationTokenID!.trim().isNotEmpty) ? depLoginResponse.authenticationTokenID!.trim() : null;
String? logInTokenID = depLoginResponse.logInTokenID;
String? mobileNumber = depLoginResponse.getWalaplusDepInfoModel?.pEmpMobileNumber ?? savedMobile;
if (authToken != null && authToken.isNotEmpty) {
if (mounted) {
Utils.hideLoading(context);
_completeDependentLogin(
depLoginResponse,
logInTokenID ?? authToken,
mobileNumber,
loginType: loginType,
navigateToDashboard: true,
);
_completeDependentLogin(depLoginResponse, logInTokenID ?? authToken, mobileNumber, loginType: loginType, navigateToDashboard: true);
}
return true;
}
@ -1043,7 +1027,7 @@ class _LoginScreenState extends State<LoginScreen> {
20.height,
_buildDependentCtaCard(context),
] else ...[
InputWidget(LocaleKeys.nationalId.tr(), "1234567890", nationalId, isInputTypeNum: true),
InputWidget(LocaleKeys.nationalIdOrIqamaNumber.tr(), "1234567890", nationalId, isInputTypeNum: true),
12.height,
GestureDetector(
behavior: HitTestBehavior.opaque,

@ -65,10 +65,7 @@ class _InputWidgetState extends State<InputWidget> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: widget.isBackgroundEnable ? Color(0xffF7F7F7) : Colors.white,
border: Border.all(
color: widget.isEnableBorder ? Color(0xffefefef) : Colors.transparent,
width: 1,
),
border: Border.all(color: widget.isEnableBorder ? Color(0xffefefef) : Colors.transparent, width: 1),
),
child: InkWell(
onTap: widget.hasSelection ? () {} : null,
@ -79,15 +76,7 @@ class _InputWidgetState extends State<InputWidget> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.labelText,
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
Text(widget.labelText, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44)),
TextField(
enabled: widget.isEnable,
scrollPadding: EdgeInsets.zero,
@ -97,23 +86,11 @@ class _InputWidgetState extends State<InputWidget> {
obscuringCharacter: "*",
obscureText: isObscureText,
onChanged: widget.onChange,
style: const TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
style: const TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, color: Color(0xff2B353E), letterSpacing: -0.44),
decoration: InputDecoration(
isDense: true,
hintText: widget.hintText,
hintStyle: const TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
hintStyle: const TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, color: Color(0xff575757), letterSpacing: -0.56),
suffixIconConstraints: const BoxConstraints(minWidth: 50),
suffixIcon: widget.suffixTap == null ? null : IconButton(icon: const Icon(Icons.mic, color: MyColors.darkTextColor), onPressed: widget.suffixTap),
contentPadding: EdgeInsets.zero,
@ -131,7 +108,7 @@ class _InputWidgetState extends State<InputWidget> {
setState(() {
isObscureText = !isObscureText;
});
})
}),
],
if (widget.hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
],

Loading…
Cancel
Save