main_auth 0.0.20

SDKflutter
Platformandroidioswindowslinuxmacos

This package offers a customizable Login and Sign-Up screen for Flutter apps, facilitating integration of forms and social login buttons

Main Auth

This package provides a customizable Login and Sign-Up screen for Flutter applications. It allows easy integration of login forms, social login buttons, and customization of titles, styles, and layouts.

Table of Contents

Features

  • LoginScreen: A customizable login screen with configurable top, middle, and bottom sections.
  • SignUpScreen: A customizable sign-up screen with support for additional fields such as phone number and confirm password.
  • Social Login Integration: Provides easy-to-use social login buttons for Google, Apple, Facebook, and Twitter (X).
  • Customizable Styles: You can apply custom button styles, titles, and layout configurations.
  • Callback Support: Handle actions such as login, sign-up, and social login button presses via callbacks.

Installation

  1. Add the following to your pubspec.yaml:
dependencies:
  main_auth: <latest_version>

Localization

To enable validation message localization in the Factory Constructors, add ValidationLocalizations.delegate to your app's list of delegates:

  MaterialApp(
    localizationsDelegates: [
      ValidationLocalizations.delegate,
      AuthLocalizations.delegate,
   
      // other delegates...
    ],
    // other app configurations...
  )

Constructor Parameters For Login

ParameterTypeDefaultDescription
hideAppBarboolfalseControls whether the AppBar is visible or hidden.
titleString?nullThe title to be displayed at the top of the screen. If null, a default "Login" title is used.
imageWidget?nullAn optional image widget, typically used for displaying a logo.
buttonSocialTypeButtonSocialTypeButtonSocialType.defaultTypeDefines the type of social login buttons in the bottom section.
buttonStyleButtonDecorationButtonDecoration.defaultStyleDefines the decoration and style for social login buttons.
titleStyleTextStyle?nullOptional style for the title. If null, the default text style is used.
hideTopLoginboolfalseControls whether the top login section is hidden.
topLoginWidgetWidget?nullOptional widget to replace the default top login section.
hideMiddleLoginboolfalseControls whether the middle login section is hidden.
middleLoginWidgetWidget?nullOptional widget to replace the default middle login section.
hideBottomLoginboolfalseControls whether the bottom login section is hidden.
bottomLoginWidgetWidget?nullOptional widget to replace the default bottom login section.
paddingEdgeInsets?EdgeInsets.all(12)Padding around the body content.
onLoginPressedvoid Function(String email, String password)?nullCallback function triggered when the login button is pressed, passing the entered email and password.

Example Usage Login

    LoginScreen(
      title: 'Welcome Back',
      image: Image.asset('assets/logo.png'),
      hideAppBar: true,
      onLoginPressed: (email, password) {
        // Handle login action
      },
      hideTopLogin: false,
      hideMiddleLogin: false,
      hideBottomLogin: false,
      buttonSocialType: ButtonSocialType.google,
      buttonStyle: ButtonDecoration.rounded,
    )

Constructor Parameters For SignUp

ParameterTypeDefaultDescription
hideAppBarboolfalseControls whether the AppBar is visible or hidden.
titleString?nullOptional title displayed at the top of the screen. If null, a default localized title ("Sign up") is shown.
imageWidget?nullAn optional image widget, commonly used for displaying a logo or branding.
buttonSocialTypeButtonSocialTypeButtonSocialType.defaultTypeDefines the type of social login buttons in the bottom section.
buttonStyleButtonDecorationButtonDecoration.defaultStyleDefines the decoration and style of social login buttons.
titleStyleTextStyle?nullOptional style applied to the title. If not provided, the default text style is used.
hideTopSignUpboolfalseControls whether the top sign-up section is hidden.
topSignUpWidgetWidget?nullAn optional widget to replace the default top sign-up section.
hideMiddleSignUpboolfalseControls whether the middle sign-up section is hidden.
middleSignUpWidgetWidget?nullAn optional widget to replace the default middle sign-up section.
hideBottomSignUpboolfalseControls whether the bottom sign-up section is hidden.
hideConfirmPasswordFieldboolfalseControls whether the "Confirm Password" field is hidden.
hidePhoneFieldboolfalseControls whether the phone number field is hidden.
bottomSignUpWidgetWidget?nullAn optional widget to replace the default bottom sign-up section, typically for social login buttons or additional options.
paddingEdgeInsets?EdgeInsets.all(12)Padding applied around the body content.
onSignUpPressedvoid Function(String email, String password, {String? phone, String? confirmPassword})?nullCallback function triggered when the "Sign up" button is pressed, providing the entered email, password, and optionally phone number and confirm password.
onTapGoogleVoidCallback?nullCallback function triggered when the Google login button is pressed.
onTapXVoidCallback?nullCallback function triggered when the X (Twitter) login button is pressed.
onTapAppleVoidCallback?nullCallback function triggered when the Apple login button is pressed.
onTapFacebookVoidCallback?nullCallback function triggered when the Facebook login button is pressed.
onTermsTapVoidCallback?nullCallback function triggered when the "Terms and Conditions" link is pressed.

Example Usage SignUp

    SignUpScreen(
      title: 'Create Your Account',
      image: Image.asset('assets/logo.png'),
      hideAppBar: true,
      onSignUpPressed: (email, password, {phone, confirmPassword}) {
        // Handle sign-up logic here
      },
      onTapGoogle: () {
        // Handle Google sign-up
      },
      onTapFacebook: () {
        // Handle Facebook sign-up
      },
      hideConfirmPasswordField: false,
      hidePhoneField: true, // Hide phone number field
      buttonSocialType: ButtonSocialType.google,
      buttonStyle: ButtonDecoration.rounded,
    )

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

Made with contrib.rocks.