Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Navigate between cards programmatically #428

Open
lucaloiacono opened this issue Jun 15, 2023 · 0 comments
Open

[FEATURE] Navigate between cards programmatically #428

lucaloiacono opened this issue Jun 15, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@lucaloiacono
Copy link
Contributor

Is your feature request related to a problem? Please describe.
It would be great to have the ability to navigate between cards programmatically, using my own logic instead of the standard flow, here there is one use-case:

  • User is forced to change password or password has expired: currently i can only deny the user to login and show a message like:Your password has expired. Please click on "Forgot password?" and follow the procedure to set a new one.
    It works but, you know, that's not so good in terms of user experience.
    I'd like to redirect the user to the reset-password card directly when then backend claims the user needs to change password.

Describe the solution you'd like

  • Make FlutterLoginState public
  • Make _changeCard method into lib/src/widgets/cards/auth_card_builder.dart public
  • Add new public method in FlutterLoginState
void changeCard(int index) {
    return authCardKey.currentState!.changeCard(index);
}
  • Now we can declare the GlobalKey in our class
class LoginScreen extends StatelessWidget {
  final GlobalKey<FlutterLoginState> flutterLoginKey = GlobalKey();
...

And call the method wherever we want, e.g:

Future<String?> onLogin(LoginData data) async {
  // Auth logic
  ...
  if (passwordExpired) {
    flutterLoginKey.currentState!.changeCard({card_index});
  }
}

Additional context

@lucaloiacono lucaloiacono added the enhancement New feature or request label Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant