Merge branch 'sultan' into 'master'

login changes

See merge request Cloud_Solution/diplomatic-quarter!11
merge-requests/13/merge
Mohammad Aljammal 5 years ago
commit dc4c7ef067

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

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

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

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

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

@ -43,42 +43,46 @@ class Utils {
FocusScope.of(context).unfocus();
}
bool isSAUDIIDValid(String id) {
if (id == null) {
return false;
}
try {
id = id.toString();
id = id.trim();
var returnValue = int.parse(id);
var sum = 0;
if (returnValue > 0) {
var type = int.parse(id[0]);
bool isSAUDIIDValid(String id, type) {
if (type == 1) {
if (id == null) {
return false;
}
try {
id = id.toString();
id = id.trim();
var returnValue = int.parse(id);
var sum = 0;
if (returnValue > 0) {
var type = int.parse(id[0]);
if (id.length != 10) {
return false;
}
if (type != 2 && type != 1) {
return false;
}
if (id.length != 10) {
return false;
}
if (type != 2 && type != 1) {
return false;
}
for (var i = 0; i < 10; i++) {
if (i % 2 == 0) {
var a = id[i];
var x = int.parse(a) * 2;
var b = x.toString();
if (b.length == 1) {
b = "0" + b;
for (var i = 0; i < 10; i++) {
if (i % 2 == 0) {
var a = id[i];
var x = int.parse(a) * 2;
var b = x.toString();
if (b.length == 1) {
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) {}
return false;
} else {
return true;
}
}
bool validateIDBox(String value, type) {

Loading…
Cancel
Save