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

@ -128,58 +128,48 @@ class _LoginFormState extends State<LoginForm> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
// TextFormField( DropdownButtonFormField(
// 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(
value: userInfo.ProjectID, value: userInfo.ProjectID,
iconSize: 24, isExpanded: false,
elevation: 16, decoration: InputDecoration(
selectedItemBuilder: (BuildContext context) { contentPadding: EdgeInsets.all(10),
return projectsList.map((item) { isDense: true,
return Text(item['Desciption']); prefixIcon:
}).toList(); 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) { items: projectsList.map((item) {
return DropdownMenuItem( return DropdownMenuItem(
child: Text('${item['Desciption']}'), child: Text(
'${item['Desciption']}',
),
value: item['ID'], value: item['ID'],
); );
}).toList(), }).toList(),
onChanged: (val) { onChanged: (value) {
userInfo.ProjectID = val; userInfo.ProjectID = value;
}, }),
),
),
SizedBox( SizedBox(
height: 20, height: 20,
@ -241,21 +231,22 @@ class _LoginFormState extends State<LoginForm> {
} }
login(context, AuthProvider authProv) { login(context, AuthProvider authProv) {
loginFormKey.currentState.validate(); if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save(); loginFormKey.currentState.save();
authProv.login(userInfo).then((res) { authProv.login(userInfo).then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
insertDeviceImei(res, authProv); insertDeviceImei(res, authProv);
} else { } else {
// handel error // handel error
// widget.showCenterShortLoadingToast("watting"); // widget.showCenterShortLoadingToast("watting");
showLoginError(res['ErrorEndUserMessage']); showLoginError(res['ErrorEndUserMessage']);
} }
// Navigator.of(context).pushNamed(HOME); // Navigator.of(context).pushNamed(HOME);
}).catchError((err) { }).catchError((err) {
print('$err'); print('$err');
showLoginError(); showLoginError();
}); });
}
} }
insertDeviceImei(res, AuthProvider authProv) { insertDeviceImei(res, AuthProvider authProv) {

Loading…
Cancel
Save