SignInWidget class
A widget that provides a complete authentication onboarding experience.
This widget automatically detects which authentication providers are available on the server by checking for their endpoint implementations, and displays the appropriate sign-in options.
Currently supports:
- Email authentication (via
EndpointEmailIdpBase) - Google Sign-In (via
EndpointGoogleIdpBase) - Apple Sign-In (via
EndpointAppleIdpBase) - GitHub Sign-In (via
EndpointGitHubIdpBase) - Microsoft Sign-In (via
EndpointMicrosoftIdpBase) - External providers registered via ExternalIdpRegistry
The widget separates email authentication from other providers with a visual divider showing "Or continue with" text.
Example usage:
SignInWidget(
client: client,
onAuthenticated: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (_) => HomePage()),
);
},
onError: (error) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Authentication failed: $error')),
);
},
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SignInWidget
Constructors
- SignInWidget({required ServerpodClientShared client, VoidCallback? onAuthenticated, dynamic onError(Object error)?, bool disableAnonymousSignInWidget = false, bool disableEmailSignInWidget = false, bool disableGoogleSignInWidget = false, bool disableAppleSignInWidget = false, bool disableGitHubSignInWidget = false, bool disableMicrosoftSignInWidget = false, bool disableFacebookSignInWidget = false, AnonymousSignInWidget? anonymousSignInWidget, EmailSignInWidget? emailSignInWidget, GoogleSignInWidget? googleSignInWidget, AppleSignInWidget? appleSignInWidget, GitHubSignInWidget? githubSignInWidget, MicrosoftSignInWidget? microsoftSignInWidget, SignInButtonStyle? buttonStyle, Key? key})
-
Creates an authentication onboarding widget.
const
Properties
- anonymousSignInWidget → AnonymousSignInWidget?
-
Customized widget to use for anonymous sign-in.
final
- appleSignInWidget → AppleSignInWidget?
-
Customized widget to use for Apple sign-in.
final
-
Customizes the common styling applied to every sign-in button.
final
- client → ServerpodClientShared
-
The Serverpod client instance.
final
- disableAnonymousSignInWidget → bool
-
Whether to disable the anonymous sign-in widget if it is available.
final
- disableAppleSignInWidget → bool
-
Whether to disable the Apple sign-in widget if it is available.
final
- disableEmailSignInWidget → bool
-
Whether to disable the email sign-in widget if it is available.
final
- disableFacebookSignInWidget → bool
-
Whether to disable the Facebook sign-in widget if it is available.
final
- disableGitHubSignInWidget → bool
-
Whether to disable the GitHub sign-in widget if it is available.
final
- disableGoogleSignInWidget → bool
-
Whether to disable the Google sign-in widget if it is available.
final
- disableMicrosoftSignInWidget → bool
-
Whether to disable the Microsoft sign-in widget if it is available.
final
- emailSignInWidget → EmailSignInWidget?
-
Customized widget to use for email sign-in.
final
- githubSignInWidget → GitHubSignInWidget?
-
Customized widget to use for GitHub sign-in.
final
- googleSignInWidget → GoogleSignInWidget?
-
Customized widget to use for Google sign-in.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- microsoftSignInWidget → MicrosoftSignInWidget?
-
Customized widget to use for Microsoft sign-in.
final
- onAuthenticated → VoidCallback?
-
Callback when authentication is successful.
final
- onError → dynamic Function(Object error)?
-
Callback when an error occurs during authentication.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SignInWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited