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( value: userInfo.ProjectID,
// prefixIcon: Image.asset('assets/images/hospital_icon.png'), isExpanded: false,
// hintText: 'Select Project', decoration: InputDecoration(
// hintStyle: TextStyle( contentPadding: EdgeInsets.all(10),
// fontSize: isDense: true,
// isSmallScreen ? 14 : constraints.maxWidth * 0.024), prefixIcon:
// enabledBorder: OutlineInputBorder( Image.asset('assets/images/hospital_icon.png'),
// borderRadius: BorderRadius.all(Radius.circular(20)), // hintText: 'Enter Password',
// borderSide: BorderSide(color: Hexcolor('#CCCCCC')), hintStyle: TextStyle(
// ), fontSize: isSmallScreen
// focusedBorder: OutlineInputBorder( ? 14
// borderRadius: BorderRadius.all(Radius.circular(10.0)), : constraints.maxWidth * 0.024),
// borderSide: enabledBorder: OutlineInputBorder(
// BorderSide(color: Theme.of(context).primaryColor), borderRadius: BorderRadius.all(Radius.circular(20)),
// ) borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
// //BorderRadius.all(Radius.circular(20)); ),
// ), focusedBorder: OutlineInputBorder(
// validator: (value) {
// if (value.isEmpty) {
// return 'Please enter some text';
// }
// return null;
// },
// ),
//
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10.0)), borderRadius: BorderRadius.all(Radius.circular(10.0)),
// border: Border.all(color: Theme.of(context).primaryColor), borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
), ),
width: double.infinity, validator: (value) {
child: DropdownButton( print(value);
value: userInfo.ProjectID, if (value == null) {
iconSize: 24, return 'Please enter some text';
elevation: 16, }
selectedItemBuilder: (BuildContext context) { return null;
return projectsList.map((item) {
return Text(item['Desciption']);
}).toList();
}, },
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,7 +231,7 @@ 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) {
@ -257,6 +247,7 @@ class _LoginFormState extends State<LoginForm> {
showLoginError(); showLoginError();
}); });
} }
}
insertDeviceImei(res, AuthProvider authProv) { insertDeviceImei(res, AuthProvider authProv) {
if (_platformImei != 'Unknown') { if (_platformImei != 'Unknown') {

Loading…
Cancel
Save