|
|
|
@ -16,7 +16,6 @@ import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../../widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LoginScreen extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_LoginScreenState createState() => _LoginScreenState();
|
|
|
|
@ -55,151 +54,127 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
//TODO Use App Text rather than text
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start, children: [
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.welcomeTo,
|
|
|
|
|
TranslationBase.of(context).welcomeTo,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight
|
|
|
|
|
.w600,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontFamily: 'Poppins'),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.drSulaimanAlHabib,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color:Color(0xFF2B353E),
|
|
|
|
|
fontWeight: FontWeight
|
|
|
|
|
.bold,
|
|
|
|
|
fontSize: SizeConfig
|
|
|
|
|
.isMobile
|
|
|
|
|
color: Color(0xFF2B353E),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.isMobile
|
|
|
|
|
? 24
|
|
|
|
|
: SizeConfig
|
|
|
|
|
.realScreenWidth *
|
|
|
|
|
0.029,
|
|
|
|
|
: SizeConfig.realScreenWidth *
|
|
|
|
|
0.029,
|
|
|
|
|
fontFamily: 'Poppins'),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
"Doctor App",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize:
|
|
|
|
|
SizeConfig.isMobile
|
|
|
|
|
fontSize: SizeConfig.isMobile
|
|
|
|
|
? 16
|
|
|
|
|
: SizeConfig
|
|
|
|
|
.realScreenWidth *
|
|
|
|
|
0.030,
|
|
|
|
|
fontWeight: FontWeight
|
|
|
|
|
.w600,
|
|
|
|
|
: SizeConfig.realScreenWidth *
|
|
|
|
|
0.030,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xFFD02127)),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
),
|
|
|
|
|
Form(
|
|
|
|
|
key: loginFormKey,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment
|
|
|
|
|
.spaceBetween,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
width: SizeConfig
|
|
|
|
|
.realScreenWidth * 0.90,
|
|
|
|
|
height: SizeConfig
|
|
|
|
|
.realScreenHeight * 0.65,
|
|
|
|
|
child:
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
|
|
|
.start, children: [
|
|
|
|
|
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).enterId,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
controller: userIdController,
|
|
|
|
|
onChanged: (value){
|
|
|
|
|
if (value != null)
|
|
|
|
|
setState(() {
|
|
|
|
|
authenticationViewModel.userInfo
|
|
|
|
|
.userID =
|
|
|
|
|
value
|
|
|
|
|
.trim();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).enterPassword,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
isSecure: true,
|
|
|
|
|
controller: passwordController,
|
|
|
|
|
onChanged: (value){
|
|
|
|
|
if (value != null)
|
|
|
|
|
setState(() {
|
|
|
|
|
authenticationViewModel.userInfo
|
|
|
|
|
.password =
|
|
|
|
|
value
|
|
|
|
|
.trim();
|
|
|
|
|
});
|
|
|
|
|
// if(allowCallApi) {
|
|
|
|
|
this.getProjects(
|
|
|
|
|
authenticationViewModel.userInfo
|
|
|
|
|
.userID);
|
|
|
|
|
// setState(() {
|
|
|
|
|
// allowCallApi = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
onClick: (){
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).selectYourProject,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
controller: projectIdController,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
enabled: false,
|
|
|
|
|
onClick: (){
|
|
|
|
|
Helpers
|
|
|
|
|
.showCupertinoPicker(
|
|
|
|
|
context,
|
|
|
|
|
projectsList,
|
|
|
|
|
'facilityName',
|
|
|
|
|
onSelectProject,
|
|
|
|
|
authenticationViewModel);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox()
|
|
|
|
|
]),
|
|
|
|
|
width: SizeConfig.realScreenWidth * 0.90,
|
|
|
|
|
height: SizeConfig.realScreenHeight * 0.65,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).enterId,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
controller: userIdController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
if (value != null)
|
|
|
|
|
setState(() {
|
|
|
|
|
authenticationViewModel.userInfo
|
|
|
|
|
.userID = value.trim();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.enterPassword,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
isSecure: true,
|
|
|
|
|
controller: passwordController,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
if (value != null)
|
|
|
|
|
setState(() {
|
|
|
|
|
authenticationViewModel.userInfo
|
|
|
|
|
.password = value.trim();
|
|
|
|
|
});
|
|
|
|
|
// if(allowCallApi) {
|
|
|
|
|
this.getProjects(
|
|
|
|
|
authenticationViewModel
|
|
|
|
|
.userInfo.userID);
|
|
|
|
|
// setState(() {
|
|
|
|
|
// allowCallApi = false;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
onClick: () {},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.selectYourProject,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
controller: projectIdController,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
enabled: false,
|
|
|
|
|
onClick: () {
|
|
|
|
|
Helpers.showCupertinoPicker(
|
|
|
|
|
context,
|
|
|
|
|
projectsList,
|
|
|
|
|
'facilityName',
|
|
|
|
|
onSelectProject,
|
|
|
|
|
authenticationViewModel);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox()
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -210,7 +185,6 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
|
|
|
|
|
height: 90,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Center(
|
|
|
|
@ -220,26 +194,23 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.login,
|
|
|
|
|
title: TranslationBase.of(context).login,
|
|
|
|
|
color: Color(0xFFD02127),
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
disabled: authenticationViewModel.userInfo
|
|
|
|
|
.userID == null ||
|
|
|
|
|
authenticationViewModel.userInfo
|
|
|
|
|
.password ==
|
|
|
|
|
null,
|
|
|
|
|
disabled: authenticationViewModel.userInfo.userID == null ||
|
|
|
|
|
authenticationViewModel.userInfo.password == null,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
login(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(height: 25,)
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 25,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -249,7 +220,9 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
login(context,) async {
|
|
|
|
|
login(
|
|
|
|
|
context,
|
|
|
|
|
) async {
|
|
|
|
|
if (loginFormKey.currentState.validate()) {
|
|
|
|
|
loginFormKey.currentState.save();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
@ -259,7 +232,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
Helpers.showErrorToast(authenticationViewModel.error);
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
authenticationViewModel.setUnverified(true,isFromLogin: true);
|
|
|
|
|
authenticationViewModel.setUnverified(true, isFromLogin: true);
|
|
|
|
|
// Navigator.of(context).pushReplacement(
|
|
|
|
|
// MaterialPageRoute(
|
|
|
|
|
// builder: (BuildContext context) =>
|
|
|
|
@ -275,22 +248,25 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
|
|
|
|
|
onSelectProject(index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
authenticationViewModel.userInfo.projectID = projectsList[index].facilityId;
|
|
|
|
|
authenticationViewModel.userInfo.projectID =
|
|
|
|
|
projectsList[index].facilityId;
|
|
|
|
|
projectIdController.text = projectsList[index].facilityName;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
primaryFocus.unfocus();
|
|
|
|
|
}
|
|
|
|
|
String memberID ="";
|
|
|
|
|
getProjects(memberID)async {
|
|
|
|
|
|
|
|
|
|
String memberID = "";
|
|
|
|
|
getProjects(memberID) async {
|
|
|
|
|
if (memberID != null && memberID != '') {
|
|
|
|
|
if (this.memberID !=memberID) {
|
|
|
|
|
if (this.memberID != memberID) {
|
|
|
|
|
this.memberID = memberID;
|
|
|
|
|
await authenticationViewModel.getHospitalsList(memberID);
|
|
|
|
|
if(authenticationViewModel.state == ViewState.Idle) {
|
|
|
|
|
if (authenticationViewModel.state == ViewState.Idle) {
|
|
|
|
|
projectsList = authenticationViewModel.hospitals;
|
|
|
|
|
setState(() {
|
|
|
|
|
authenticationViewModel.userInfo.projectID = projectsList[0].facilityId;
|
|
|
|
|
authenticationViewModel.userInfo.projectID =
|
|
|
|
|
projectsList[0].facilityId;
|
|
|
|
|
projectIdController.text = projectsList[0].facilityName;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|