Merge branch 'sultan' into 'master'

login changes

See merge request Cloud_Solution/diplomatic-quarter!11
merge-update-with-lab-changes
Mohammad Aljammal 6 years ago
commit dc4c7ef067

@ -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,55 +52,71 @@ 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(
child: TextFields( margin: EdgeInsets.only(bottom: 10),
hintText: registerInfo.idNumber, child: TextFields(
prefixIcon: hintText: registerInfo.idNumber,
Icon(Icons.chrome_reader_mode, color: Colors.red), prefixIcon: Icon(Icons.chrome_reader_mode,
padding: EdgeInsets.only( color: Colors.red),
top: 20, bottom: 20, left: 10, right: 10), padding: EdgeInsets.only(
readOnly: true, top: 20, bottom: 20, left: 10, right: 10),
)), readOnly: true,
Container( )),
child: TextFields( AppText('Name'),
hintText: registerInfo.firstNameEn + Container(
' ' + margin: EdgeInsets.only(bottom: 10),
registerInfo.lastNameEn, child: TextFields(
padding: EdgeInsets.only( hintText: registerInfo.firstNameEn +
top: 20, bottom: 20, left: 10, right: 10), ' ' +
readOnly: true, registerInfo.lastNameEn,
)), padding: EdgeInsets.only(
Container( top: 20, bottom: 20, left: 10, right: 10),
child: TextFields( readOnly: true,
hintText: registerInfo.maritalStatusCode, )),
padding: EdgeInsets.only( AppText('Gender'),
top: 20, bottom: 20, left: 10, right: 10), Container(
readOnly: true, margin: EdgeInsets.only(bottom: 10),
)), child: TextFields(
Container( hintText: registerInfo.maritalStatusCode == 'U'
child: TextFields( ? 'Unknown'
prefixIcon: : registerInfo.maritalStatusCode == 'M'
Icon(Icons.chrome_reader_mode, color: Colors.red), ? 'Male'
padding: EdgeInsets.only( : 'Female',
top: 20, bottom: 20, left: 10, right: 10), padding: EdgeInsets.only(
hintText: TranslationBase.of(context).nationalID, top: 20, bottom: 20, left: 10, right: 10),
)), readOnly: true,
Container( )),
child: TextFields( AppText('Nationality'),
padding: EdgeInsets.only( Container(
top: 20, bottom: 20, left: 10, right: 10), margin: EdgeInsets.only(bottom: 10),
hintText: TranslationBase.of(context).nationalID, child: TextFields(
)), hintText: registerInfo.nationalityCode,
], padding: EdgeInsets.only(
), top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText('Date of Birth'),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.dateOfBirth,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
],
) )
: SizedBox(), : registerInfo != null && page == 2
? Column(
children: <Widget>[],
)
: SizedBox(),
Expanded( Expanded(
flex: 2, flex: 2,
child: Column( child: Column(
@ -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,42 +43,46 @@ class Utils {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
} }
bool isSAUDIIDValid(String id) { bool isSAUDIIDValid(String id, type) {
if (id == null) { if (type == 1) {
return false; if (id == null) {
} return false;
try { }
id = id.toString(); try {
id = id.trim(); id = id.toString();
var returnValue = int.parse(id); id = id.trim();
var sum = 0; var returnValue = int.parse(id);
if (returnValue > 0) { var sum = 0;
var type = int.parse(id[0]); if (returnValue > 0) {
var type = int.parse(id[0]);
if (id.length != 10) { if (id.length != 10) {
return false; return false;
} }
if (type != 2 && type != 1) { if (type != 2 && type != 1) {
return false; return false;
} }
for (var i = 0; i < 10; i++) { for (var i = 0; i < 10; i++) {
if (i % 2 == 0) { if (i % 2 == 0) {
var a = id[i]; var a = id[i];
var x = int.parse(a) * 2; var x = int.parse(a) * 2;
var b = x.toString(); var b = x.toString();
if (b.length == 1) { if (b.length == 1) {
b = "0" + b; b = "0" + b;
}
sum += int.parse(b[0]) + int.parse(b[1]);
} else {
sum += int.parse(id[i]);
} }
sum += int.parse(b[0]) + int.parse(b[1]);
} else {
sum += int.parse(id[i]);
} }
return sum % 10 == 0;
} }
return sum % 10 == 0; } catch (err) {}
} return false;
} catch (err) {} } else {
return false; return true;
}
} }
bool validateIDBox(String value, type) { bool validateIDBox(String value, type) {

Loading…
Cancel
Save