|
|
|
|
@ -54,17 +54,15 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
initPlatformState();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
if (_isInit) {
|
|
|
|
|
if (projectsList.length == 0) {
|
|
|
|
|
getProjectsList();
|
|
|
|
|
}
|
|
|
|
|
if (projectsList.length == 0) {
|
|
|
|
|
getProjectsList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_isInit = false;
|
|
|
|
|
}
|
|
|
|
|
@ -99,8 +97,9 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
userInfo.UserID = value.trim();
|
|
|
|
|
},
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context).requestFocus(focusPass);
|
|
|
|
|
FocusScope.of(context).nextFocus();
|
|
|
|
|
},
|
|
|
|
|
autofocus: false,
|
|
|
|
|
),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
TextFormField(
|
|
|
|
|
@ -119,7 +118,7 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
userInfo.Password = value;
|
|
|
|
|
},
|
|
|
|
|
onFieldSubmitted: (_) {
|
|
|
|
|
FocusScope.of(context).requestFocus(focusProject);
|
|
|
|
|
FocusScope.of(context).nextFocus();
|
|
|
|
|
helpers.showCupertinoPicker(
|
|
|
|
|
context, projectsList, 'Name', onSelectProject);
|
|
|
|
|
},
|
|
|
|
|
@ -144,22 +143,8 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
}),
|
|
|
|
|
buildSizedBox(),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
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, widget.changeLoadingStata);
|
|
|
|
|
@ -204,17 +189,26 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
*/
|
|
|
|
|
InputDecoration buildInputDecoration(BuildContext context, hint, asset) {
|
|
|
|
|
return InputDecoration(
|
|
|
|
|
prefixIcon: Image.asset(asset),
|
|
|
|
|
hintText: hint,
|
|
|
|
|
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),
|
|
|
|
|
));
|
|
|
|
|
prefixIcon: Image.asset(asset),
|
|
|
|
|
hintText: hint,
|
|
|
|
|
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),
|
|
|
|
|
),
|
|
|
|
|
errorBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
|
borderSide: BorderSide(color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
|
|
|
|
borderSide: BorderSide(color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SizedBox buildSizedBox() {
|
|
|
|
|
@ -224,6 +218,11 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
login(context, AuthProvider authProv, Function changeLoadingStata) {
|
|
|
|
|
FocusScopeNode currentFocus = FocusScope.of(context);
|
|
|
|
|
|
|
|
|
|
// if (!currentFocus.hasPrimaryFocus) {
|
|
|
|
|
// currentFocus.unfocus();
|
|
|
|
|
// }
|
|
|
|
|
changeLoadingStata(true);
|
|
|
|
|
if (loginFormKey.currentState.validate()) {
|
|
|
|
|
loginFormKey.currentState.save();
|
|
|
|
|
@ -237,7 +236,7 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
sharedPref.setString(TOKEN, res['LogInTokenID']);
|
|
|
|
|
print("token" + res['LogInTokenID']);
|
|
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(VERIFICATION_METHODS);
|
|
|
|
|
Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS);
|
|
|
|
|
} else {
|
|
|
|
|
// handel error
|
|
|
|
|
// widget.showCenterShortLoadingToast("watting");
|
|
|
|
|
@ -247,7 +246,7 @@ class _LoginFormState extends State<LoginForm> {
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print('$err');
|
|
|
|
|
changeLoadingStata(false);
|
|
|
|
|
helpers.showErrorToast();
|
|
|
|
|
helpers.showErrorToast(err);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
changeLoadingStata(false);
|
|
|
|
|
|