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

Forgot password UI 🖌️ #124

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

TreavVasu
Copy link
Collaborator

@TreavVasu TreavVasu commented Mar 5, 2021

Fixes #18

Description

#18

Type of Change: (Delete irrelevant options)

  • Code
  • Documentation

Code/Quality Assurance Only (Delete irrelevant options)

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

Describe the tests you ran to verify your changes. Provide instructions or GIFs so we can reproduce. List any relevant details for your test.

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged
  • I have added one/more required dependencies
  • I have formatted the code using dart format (dartfmt)

Code/Quality Assurance

  • My changes generate no new warnings
  • My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Mention the dependencies/packages/plugins that have been added (if any)

@TreavVasu TreavVasu marked this pull request as draft March 5, 2021 01:20
@TreavVasu TreavVasu marked this pull request as ready for review March 11, 2021 08:37
@TreavVasu
Copy link
Collaborator Author

Currently: Defragmentation of code.

@TreavVasu
Copy link
Collaborator Author

@werainkhatri Currently the states do not wait for each other they just redirect from one another. Giving no time for Entering email or top and showing error afterward! Can you describe what is the problem here?
I will resolve it tomorrow

Copy link
Member

@werainkhatri werainkhatri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes. More required. Test the code, fix other bugs and I'll review later.

  1. Code improvement
replace lines 44-119 with the code below
    body: Stack(
      children: [
        ScreenBackground(elementId: 0),
        BlocConsumer(
          listener: (context, state) {
            if (state is ForgotPasswordError) {
              Scaffold.of(context).showSnackBar(
                SnackBar(content: Text(state.message)),
              );
            }
          },
          builder: (context, state) {
            if (state is ForgotLoading)
              return _buildLoading(context);
            else if (state is ForgotPasswordError)
              return _stepScreen(context, state.state);
            else if (state is ForgotResetSuccess)
              return _passwordResetSuccess();
            else
              return _stepScreen(context, state);
          },
        ),
      ],
    ),
  );
}

Widget _stepScreen(BuildContext context, ForgotPasswordState state) { if (state is ForgotEmailInitial) return AskEmailScreen( emailController: emailController, onSubmit: () => _sendOTP(context, state), ); else if (state is ForgotOTPInitial) return EnterOTPScreen( numSelected: _onNumSelected, otp: otpEntered, toVerify: () => _verifyOtp(context, state), ); else if (state is ForgotResetInitial) return ResetPassword( onConfirm: () => _changePassword(context, state), confirmPasswordController: confirmPasswordController, passwordController: passwordController, ); else return AskEmailScreen( emailController: emailController, onSubmit: () => _sendOTP(context, state), ); }
  1. Add scroll feature (when user opens keyboard, screen scrolls, as in loginscreen)
  2. Update the delayed duration in FakeRepository to 1s.

lib/screens/login/login.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/forgot_password.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/ask_email.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/ask_email.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/ask_email.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/ask_email.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/ask_email.dart Outdated Show resolved Hide resolved
lib/screens/forgot_password/enter_otp.dart Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ForgetPassword Screen -> UI and Linking
2 participants