improve dropdown design in login page

merge-requests/1/merge
Elham Rababah 6 years ago
parent c0168cb8fb
commit 1abdf8e721

@ -21,14 +21,7 @@ class _LoginsreenState extends State<Loginsreen> {
Future<void> getSharedPref() async {
final SharedPreferences prefs = await _prefs;
final int counter = (prefs.getInt('counter') ?? 0) + 1;
platformImei = prefs.getString('platformImei');
// setState(() {
print(platformImei);
prefs.setInt("counter", counter).then((bool success) {
return counter;
// });
});
}
@override
@ -41,7 +34,6 @@ class _LoginsreenState extends State<Loginsreen> {
@override
Widget build(BuildContext context) {
// prefs.setInt("counter", 1);
getSharedPref();
return Scaffold(
backgroundColor: Colors.white,

@ -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) {

Loading…
Cancel
Save