NearHuscarl / flutter_login

Provides login screen with login/signup functionalities to help speed up development
MIT License
1.52k stars 808 forks source link

[FEATURE] (super fast fix) add a onAuthModeChanged callback #315

Open nathantew14 opened 2 years ago

nathantew14 commented 2 years ago

Is your feature request related to a problem? Please describe. The problem is that userValidator applies when logging in. For example, I may have an email validator for signing up, but that would prevent me from allowing users to use their username to log in (because the username is not in an email format and is thus blocked by the userValidator).

Describe the solution you'd like Ideally, this could be fixed by allowing the developer to set validators for every field, both during login mode and signup mode. However, a quick fix could just be to add a callback function parameter for the FlutterLogin widget to be called when the AuthMode is changed (line 140 here). This way, we can simply define our own variable to keep track of the AuthMode, and use it when making our own userValidator (or passwordValidator).