Skip to content

Start Here!

Use the starter project styles

afib_bootstrap provides app-starter-signin and app-starter-signin-firebase project styles which integrate AFib signin. These project styles provide initial state tests and other code which would be time consuming to write yourself.

I strongly recommend that if you plan to use AFib Signin, you do it by creating a new AFib project using one of those project styles. I think you are unlikely to achieve better results by trying to use AFib Signin from scratch as described below.

Integrating AFib Signin Manually

In order to integrate AFib Signin manually, you should first add afib_signin to your existing afib project:

flutter pub add afib_signin

Then, run the AFib Integrate command to integrate it into your AFib project:

dart bin/xxx_afib.dart integrate library --package-name afib_signin --package-code afsi

Having done so, if you rebuild your app and enter prototype mode, you should see afsi integrated under the Libraries section.

Using AFib Signin

In order to use AFib Signin, you need to do several things.

Make the Signin Screen Your Startup Screen

In xxx_define_core.dart, you will need to make AFib's signin screen your initial screen, like this:

context.defineStartupScreen(AFSIScreenID.signin, () => SigninScreenRouteParam.createSigninLoading());

Use AFSIManipulateStateLPI to update the screen status

In the response to your check signin query, you will need to add lines like this if the user is not signed in. These will move your signin screen from its 'loading' state to its 'ready for signin state':

    final lpi = context.accessLPI<AFSIManipulateStateLPI>(AFSILibraryProgrammingInterfaceID.manipulateState);
    lpi.updateSigninScreenStatus(status: AFSISigninStatus.ready, storedEmail: cred.validStoredEmailOrEmpty);

Override AFSIDefaultTheme

You can override AFSIDefaultTheme to change the appearance of the signin screen, or to add additional custom widgets to the signin screen, using a command like:

dart bin/xxx_afib.dart generate override XXXSigninTheme --parent-type AFSIDefaultTheme

Override AFSISigninActionsLPI

You will override AFSISigninActionsLPI to implement the behaviors of AFib Signins various screens. For example, you would override the onSignin or onSignup methods.