|
|
|
|
@ -128,58 +128,48 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
// TextFormField(
|
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
|
// prefixIcon: Image.asset('assets/images/hospital_icon.png'),
|
|
|
|
|
// hintText: 'Select Project',
|
|
|
|
|
// hintStyle: TextStyle(
|
|
|
|
|
// fontSize:
|
|
|
|
|
// isSmallScreen ? 14 : constraints.maxWidth * 0.024),
|
|
|
|
|
// enabledBorder: OutlineInputBorder(
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
|
|
|
// borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
|
|
|
// ),
|
|
|
|
|
// focusedBorder: OutlineInputBorder(
|
|
|
|
|
// borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
|
// borderSide:
|
|
|
|
|
// BorderSide(color: Theme.of(context).primaryColor),
|
|
|
|
|
// )
|
|
|
|
|
// //BorderRadius.all(Radius.circular(20));
|
|
|
|
|
// ),
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
// if (value.isEmpty) {
|
|
|
|
|
// return 'Please enter some text';
|
|
|
|
|
// }
|
|
|
|
|
// return null;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
//
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
|
// border: Border.all(color: Theme.of(context).primaryColor),
|
|
|
|
|
),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: DropdownButton(
|
|
|
|
|
DropdownButtonFormField(
|
|
|
|
|
value: userInfo.ProjectID,
|
|
|
|
|
iconSize: 24,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
selectedItemBuilder: (BuildContext context) {
|
|
|
|
|
return projectsList.map((item) {
|
|
|
|
|
return Text(item['Desciption']);
|
|
|
|
|
}).toList();
|
|
|
|
|
isExpanded: false,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
contentPadding: EdgeInsets.all(10),
|
|
|
|
|
isDense: true,
|
|
|
|
|
prefixIcon:
|
|
|
|
|
Image.asset('assets/images/hospital_icon.png'),
|
|
|
|
|
// hintText: 'Enter Password',
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
fontSize: isSmallScreen
|
|
|
|
|
? 14
|
|
|
|
|
: constraints.maxWidth * 0.024),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
|
|
|
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
|
|
|
|
|
),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
|
borderSide:
|
|
|
|
|
BorderSide(color: Theme.of(context).primaryColor),
|
|
|
|
|
)
|
|
|
|
|
//BorderRadius.all(Radius.circular(20));
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
print(value);
|
|
|
|
|
if (value == null) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
items: projectsList.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
child: Text('${item['Desciption']}'),
|
|
|
|
|
child: Text(
|
|
|
|
|
'${item['Desciption']}',
|
|
|
|
|
),
|
|
|
|
|
value: item['ID'],
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
userInfo.ProjectID = val;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
userInfo.ProjectID = value;
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
@ -241,21 +231,22 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
login(context, AuthProvider authProv) {
|
|
|
|
|
loginFormKey.currentState.validate();
|
|
|
|
|
loginFormKey.currentState.save();
|
|
|
|
|
authProv.login(userInfo).then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
insertDeviceImei(res, authProv);
|
|
|
|
|
} else {
|
|
|
|
|
// handel error
|
|
|
|
|
// widget.showCenterShortLoadingToast("watting");
|
|
|
|
|
showLoginError(res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
// Navigator.of(context).pushNamed(HOME);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('$err');
|
|
|
|
|
showLoginError();
|
|
|
|
|
});
|
|
|
|
|
if (loginFormKey.currentState.validate()) {
|
|
|
|
|
loginFormKey.currentState.save();
|
|
|
|
|
authProv.login(userInfo).then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
insertDeviceImei(res, authProv);
|
|
|
|
|
} else {
|
|
|
|
|
// handel error
|
|
|
|
|
// widget.showCenterShortLoadingToast("watting");
|
|
|
|
|
showLoginError(res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
// Navigator.of(context).pushNamed(HOME);
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('$err');
|
|
|
|
|
showLoginError();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertDeviceImei(res, AuthProvider authProv) {
|
|
|
|
|
|