|
|
|
|
@ -54,24 +54,47 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
}
|
|
|
|
|
AuthProvider authProv = Provider.of<AuthProvider>(context);
|
|
|
|
|
|
|
|
|
|
return LayoutBuilder(builder: (ctx, constraints) {
|
|
|
|
|
var smallScreenSize = 660;
|
|
|
|
|
bool isSmallScreen = constraints.maxWidth <= smallScreenSize;
|
|
|
|
|
return Form(
|
|
|
|
|
key: loginFormKey,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: constraints.maxWidth * 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
return Form(
|
|
|
|
|
key: loginFormKey,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: SizeConfig.widthMultiplier * 90,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
TextFormField(
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
prefixIcon: Image.asset('assets/images/user_id_icon.png'),
|
|
|
|
|
hintText: 'Enter ID',
|
|
|
|
|
hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
|
|
|
|
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 your ID';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
userInfo.UserID = value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
TextFormField(
|
|
|
|
|
obscureText: true,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
prefixIcon: Image.asset('assets/images/user_id_icon.png'),
|
|
|
|
|
hintText: 'Enter ID',
|
|
|
|
|
prefixIcon: Image.asset('assets/images/password_icon.png'),
|
|
|
|
|
hintText: 'Enter Password',
|
|
|
|
|
hintStyle:
|
|
|
|
|
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
@ -87,141 +110,110 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
),
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty) {
|
|
|
|
|
return 'Please enter some text';
|
|
|
|
|
return 'Please enter your Password';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
userInfo.UserID = value;
|
|
|
|
|
userInfo.Password = value;
|
|
|
|
|
}),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
DropdownButtonFormField(
|
|
|
|
|
value: userInfo.ProjectID,
|
|
|
|
|
isExpanded: false,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
contentPadding: EdgeInsets.all(10),
|
|
|
|
|
isDense: true,
|
|
|
|
|
prefixIcon: Image.asset('assets/images/hospital_icon.png'),
|
|
|
|
|
// hintText: 'Enter Password',
|
|
|
|
|
hintStyle:
|
|
|
|
|
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
|
|
|
|
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 select your project';
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
TextFormField(
|
|
|
|
|
obscureText: true,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
prefixIcon:
|
|
|
|
|
Image.asset('assets/images/password_icon.png'),
|
|
|
|
|
hintText: 'Enter Password',
|
|
|
|
|
hintStyle:
|
|
|
|
|
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
|
|
|
|
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;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (value) {
|
|
|
|
|
userInfo.Password = value;
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
DropdownButtonFormField(
|
|
|
|
|
value: userInfo.ProjectID,
|
|
|
|
|
isExpanded: false,
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
contentPadding: EdgeInsets.all(10),
|
|
|
|
|
isDense: true,
|
|
|
|
|
prefixIcon:
|
|
|
|
|
Image.asset('assets/images/hospital_icon.png'),
|
|
|
|
|
// hintText: 'Enter Password',
|
|
|
|
|
hintStyle:
|
|
|
|
|
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
|
|
|
|
|
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']}',
|
|
|
|
|
),
|
|
|
|
|
value: item['ID'],
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
userInfo.ProjectID = value;
|
|
|
|
|
}),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: true,
|
|
|
|
|
activeColor: Theme.of(context).primaryColor,
|
|
|
|
|
onChanged: (bool newValue) {}),
|
|
|
|
|
Text("Remember me",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 2 * SizeConfig.textMultiplier)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
RaisedButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
login(context, authProv);
|
|
|
|
|
},
|
|
|
|
|
items: projectsList.map((item) {
|
|
|
|
|
return DropdownMenuItem(
|
|
|
|
|
child: Text(
|
|
|
|
|
'${item['Desciption']}',
|
|
|
|
|
),
|
|
|
|
|
value: item['ID'],
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
userInfo.ProjectID = value;
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
elevation: 0.0,
|
|
|
|
|
padding: const EdgeInsets.all(0.0),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
height:50,
|
|
|
|
|
width: SizeConfig.widthMultiplier * 30,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Checkbox(
|
|
|
|
|
value: true,
|
|
|
|
|
activeColor: Theme.of(context).primaryColor,
|
|
|
|
|
onChanged: (bool newValue) {}),
|
|
|
|
|
Text("Remember me",
|
|
|
|
|
Text('LOGIN',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 2 * SizeConfig.textMultiplier)),
|
|
|
|
|
fontSize: SizeConfig.isMobilePortrait
|
|
|
|
|
? 2.3 * SizeConfig.textMultiplier
|
|
|
|
|
: 2.3 * SizeConfig.textMultiplier)),
|
|
|
|
|
Image.asset('assets/images/login_btn_arrow_icon.png')
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
RaisedButton(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
login(context, authProv);
|
|
|
|
|
},
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
elevation: 0.0,
|
|
|
|
|
padding: const EdgeInsets.all(0.0),
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
side:
|
|
|
|
|
BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
height: 5*SizeConfig.heightMultiplier,
|
|
|
|
|
width: constraints.maxWidth * 0.30,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text('LOGIN',
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: SizeConfig.isMobilePortrait?2*SizeConfig.textMultiplier: 2.3*SizeConfig.textMultiplier)),
|
|
|
|
|
Image.asset('assets/images/login_btn_arrow_icon.png')
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SizedBox buildSizedBox() {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
login(context, AuthProvider authProv) {
|
|
|
|
|
|