login changes

merge-update-with-lab-changes
Sultan Khan 6 years ago
parent 0bc529f420
commit ecfa1756d3

@ -138,4 +138,5 @@ const Map<String, Map<String, String>> localizedValues = {
"ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟" "ar": "هل ترغب في تسجيل الدخول باسم المستخدم الحالي؟"
}, },
"another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"}, "another-acc": {"en": "Use Another Account", "ar": "استخدم حسابا آخر"},
"next": {"en": "Next", "ar": 'التالى'},
}; };

@ -125,7 +125,7 @@ class _Login extends State<Login> {
void validateForm() { void validateForm() {
if (util.validateIDBox(nationalIDorFile.text, loginType) == true && if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
mobileNo.length >= 9 && mobileNo.length >= 9 &&
util.isSAUDIIDValid(nationalIDorFile.text) == true) { util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true) {
setState(() { setState(() {
isButtonDisabled = false; isButtonDisabled = false;
}); });

@ -27,7 +27,7 @@ class _RegisterInfo extends State<RegisterInfo> {
final sharedPref = new AppSharedPreferences(); final sharedPref = new AppSharedPreferences();
RegisterInfoResponse registerInfo; RegisterInfoResponse registerInfo;
bool isLoading; bool isLoading;
int page = 1;
@override @override
void initState() { void initState() {
getRegisterInfo(); getRegisterInfo();
@ -52,22 +52,25 @@ class _RegisterInfo extends State<RegisterInfo> {
fontSize: SizeConfig.textMultiplier * 3, fontSize: SizeConfig.textMultiplier * 3,
textAlign: TextAlign.left, textAlign: TextAlign.left,
)), )),
registerInfo != null registerInfo != null && page == 1
? Expanded( ? Column(
flex: 4, crossAxisAlignment: CrossAxisAlignment.start,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[ children: <Widget>[
AppText('National ID'),
Container( Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields( child: TextFields(
hintText: registerInfo.idNumber, hintText: registerInfo.idNumber,
prefixIcon: prefixIcon: Icon(Icons.chrome_reader_mode,
Icon(Icons.chrome_reader_mode, color: Colors.red), color: Colors.red),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10), top: 20, bottom: 20, left: 10, right: 10),
readOnly: true, readOnly: true,
)), )),
AppText('Name'),
Container( Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields( child: TextFields(
hintText: registerInfo.firstNameEn + hintText: registerInfo.firstNameEn +
' ' + ' ' +
@ -76,29 +79,42 @@ class _RegisterInfo extends State<RegisterInfo> {
top: 20, bottom: 20, left: 10, right: 10), top: 20, bottom: 20, left: 10, right: 10),
readOnly: true, readOnly: true,
)), )),
AppText('Gender'),
Container( Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields( child: TextFields(
hintText: registerInfo.maritalStatusCode, hintText: registerInfo.maritalStatusCode == 'U'
? 'Unknown'
: registerInfo.maritalStatusCode == 'M'
? 'Male'
: 'Female',
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10), top: 20, bottom: 20, left: 10, right: 10),
readOnly: true, readOnly: true,
)), )),
AppText('Nationality'),
Container( Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields( child: TextFields(
prefixIcon: hintText: registerInfo.nationalityCode,
Icon(Icons.chrome_reader_mode, color: Colors.red),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10), top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID, readOnly: true,
)), )),
AppText('Date of Birth'),
Container( Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields( child: TextFields(
hintText: registerInfo.dateOfBirth,
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10), top: 20, bottom: 20, left: 10, right: 10),
hintText: TranslationBase.of(context).nationalID, readOnly: true,
)), )),
], ],
), )
: registerInfo != null && page == 2
? Column(
children: <Widget>[],
) )
: SizedBox(), : SizedBox(),
Expanded( Expanded(
@ -110,8 +126,8 @@ class _RegisterInfo extends State<RegisterInfo> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: DefaultButton( child: DefaultButton(
TranslationBase.of(context).registerNow, TranslationBase.of(context).next,
() => {registerNow()}, () => {nextPage()},
textColor: Colors.white, textColor: Colors.white,
)) ))
], ],
@ -122,6 +138,12 @@ class _RegisterInfo extends State<RegisterInfo> {
))); )));
} }
nextPage() {
setState(() {
page++;
});
}
registerNow() {} registerNow() {}
getRegisterInfo() async { getRegisterInfo() async {
registerInfo = registerInfo =

@ -204,7 +204,7 @@ class _Register extends State<Register> {
void validateForm() { void validateForm() {
if (util.validateIDBox(nationalIDorFile.text, loginType) == true && if (util.validateIDBox(nationalIDorFile.text, loginType) == true &&
mobileNo.length >= 9 && mobileNo.length >= 9 &&
util.isSAUDIIDValid(nationalIDorFile.text) == true && util.isSAUDIIDValid(nationalIDorFile.text, loginType) == true &&
isHijri != null) { isHijri != null) {
setState(() { setState(() {
isButtonDisabled = false; isButtonDisabled = false;

@ -176,6 +176,7 @@ class TranslationBase {
localizedValues['account-info'][locale.languageCode]; localizedValues['account-info'][locale.languageCode];
String get useAnotherAccount => String get useAnotherAccount =>
localizedValues['another-acc'][locale.languageCode]; localizedValues['another-acc'][locale.languageCode];
String get next => localizedValues['next'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -43,7 +43,8 @@ class Utils {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
} }
bool isSAUDIIDValid(String id) { bool isSAUDIIDValid(String id, type) {
if (type == 1) {
if (id == null) { if (id == null) {
return false; return false;
} }
@ -79,6 +80,9 @@ class Utils {
} }
} catch (err) {} } catch (err) {}
return false; return false;
} else {
return true;
}
} }
bool validateIDBox(String value, type) { bool validateIDBox(String value, type) {

Loading…
Cancel
Save