SocialButton class

A highly customizable button for social login interactions.

Provides sensible defaults for popular providers (Google, Apple, Facebook), but allows full customization of colors, icons, labels, and styling.

Example - Default Branding:

SocialButton(
  provider: SocialProvider.google,
  onPressed: () => signInWithGoogle(),
);

Example - Custom Styling:

SocialButton(
  provider: SocialProvider.google,
  onPressed: () => signInWithGoogle(),
  label: 'Sign in with Google',
  bgColor: Colors.blue,
  textColor: Colors.white,
  borderRadius: 20,
  iconWidget: Icon(Icons.g_mobiledata, color: Colors.white),
);
Inheritance

Constructors

SocialButton({Key? key, required SocialProvider provider, required VoidCallback? onPressed, String? label, Color? bgColor, Color? textColor, Widget? iconWidget, double? iconSize, double? width, double? height, double? borderRadius, BorderSide? borderSide, EdgeInsetsGeometry? padding, double? fontSize, FontWeight? fontWeight, double? elevation, bool isLoading = false, bool enabled = true, SocialButtonStyle style = SocialButtonStyle.filled, SocialIconVariant iconVariant = SocialIconVariant.theme, double? iconSpacing})
const

Properties

bgColor → Color?
Custom background color. Overrides provider default.
final
borderRadius → double?
Border radius. Default: 10.
final
borderSide → BorderSide?
Border side. Overrides provider default.
final
elevation → double?
Elevation. Default: 0.
final
enabled → bool
Enable/disable the button.
final
fontSize → double?
Font size for the label. Default: 15.
final
fontWeight → FontWeight?
Font weight for the label. Default: FontWeight.w600.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
Button height. Default: 50.
final
iconSize → double?
Icon size if using default icon. Default: 20.
final
iconSpacing → double?
Spacing between icon and text. Default: 12.
final
iconVariant → SocialIconVariant
Controls whether the provider icon uses the theme, a light icon, or a dark icon.
final
iconWidget → Widget?
Custom icon widget. Overrides the default SVG/icon for the provider.
final
isLoading → bool
Show loading indicator.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String?
Custom label text. Defaults to "Continue with {Provider}".
final
onPressed → VoidCallback?
Callback when button is pressed.
final
padding → EdgeInsetsGeometry?
Padding inside the button.
final
provider → SocialProvider
The social provider (determines default branding if no overrides).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
style → SocialButtonStyle
The visual style of the button. Default: SocialButtonStyle.filled.
final
textColor → Color?
Custom text color. Overrides provider default.
final
width → double?
Button width. Default: full width.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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