build method
The build function is used to build the widget which will switch to
desired widget based on the enum class Buttons
Implementation
@override
Widget build(BuildContext context) {
switch (button) {
case SocialButtons.google:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Google'),
text: text ?? 'Sign in with Google',
textStyle: textStyle,
textColor: const Color(0xFF1F1F1F),
icon: FontAwesomeIcons.google,
backgroundColor: const Color(0xFFFFFFFF),
onPressed: onPressed,
padding: padding,
innerPadding: EdgeInsets.zero,
shape: shape,
height: 36.0,
clipBehavior: clipBehavior,
);
case SocialButtons.facebook:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Facebook'),
mini: mini,
text: text ?? 'Sign in with Facebook',
textStyle: textStyle,
icon: FontAwesomeIcons.facebookF,
backgroundColor: const Color(0xFF1877f2),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.gitHub:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('GitHub'),
mini: mini,
text: text ?? 'Sign in with GitHub',
textStyle: textStyle,
icon: FontAwesomeIcons.github,
backgroundColor: const Color(0xFF444444),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.apple:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Apple'),
mini: mini,
text: text ?? 'Sign in with Apple',
textStyle: textStyle,
textColor: const Color.fromRGBO(0, 0, 0, 0.9),
icon: FontAwesomeIcons.apple,
iconColor:
button == SocialButtons.apple ? Colors.black : Colors.white,
backgroundColor: button == SocialButtons.apple
? const Color(0xFFFFFFFF)
: const Color(0xFF000000),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.linkedIn:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('LinkedIn'),
mini: mini,
text: text ?? 'Sign in with LinkedIn',
textStyle: textStyle,
icon: FontAwesomeIcons.linkedinIn,
backgroundColor: const Color(0xFF007BB6),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.pinterest:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Pinterest'),
mini: mini,
text: text ?? 'Sign in with Pinterest',
textStyle: textStyle,
icon: FontAwesomeIcons.pinterest,
backgroundColor: const Color(0xFFCB2027),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.tumblr:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Tumblr'),
mini: mini,
text: text ?? 'Sign in with Tumblr',
textStyle: textStyle,
icon: FontAwesomeIcons.tumblr,
backgroundColor: const Color(0xFF34526f),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.twitter:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Twitter'),
mini: mini,
text: text ?? 'Sign in with Twitter',
textStyle: textStyle,
icon: FontAwesomeIcons.twitter,
backgroundColor: const Color(0xFF1DA1F2),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.reddit:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Reddit'),
mini: mini,
text: text ?? 'Sign in with Reddit',
textStyle: textStyle,
icon: FontAwesomeIcons.reddit,
backgroundColor: const Color(0xFFFF4500),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.quora:
return SignInButtonBuilder(
key: const ValueKey('Quora'),
mini: mini,
text: text ?? 'Sign in with Quora',
textStyle: textStyle,
icon: FontAwesomeIcons.quora,
backgroundColor: const Color(0x00a40a00),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.yahoo:
return SignInButtonBuilder(
key: const ValueKey('Yahoo'),
mini: mini,
text: text ?? 'Sign in with Yahoo',
textStyle: textStyle,
icon: FontAwesomeIcons.yahoo,
backgroundColor: const Color(0x006001d2),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.hotmail:
return SignInButtonBuilder(
key: const ValueKey('Hotmail'),
mini: mini,
text: text ?? 'Sign in with Hotmail',
textStyle: textStyle,
icon: FontAwesomeIcons.commentSms,
backgroundColor: const Color(0x000072c6),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.xbox:
return SignInButtonBuilder(
key: const ValueKey('Xbox'),
mini: mini,
text: text ?? 'Sign in with Xbox',
textStyle: textStyle,
icon: FontAwesomeIcons.xbox,
backgroundColor: const Color(0x00107c0f),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.microsoft:
return SignInButtonBuilder(
key: const ValueKey('Microsoft'),
mini: mini,
text: text ?? 'Sign in with Microsoft',
textStyle: textStyle,
icon: FontAwesomeIcons.microsoft,
backgroundColor: const Color(0xff235A9F),
onPressed: onPressed,
padding: padding,
shape: shape,
clipBehavior: clipBehavior,
);
case SocialButtons.anonymous:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Anonymous'),
mini: mini,
text: text ?? 'Anonymous',
textStyle: textStyle,
textColor: const Color.fromRGBO(0, 0, 0, 0.9),
icon: Icons.account_circle,
iconColor: Colors.grey,
backgroundColor: const Color(0xFFFFFFFF),
onPressed: onPressed,
padding: padding,
shape: shape,
height: 36.0,
clipBehavior: clipBehavior,
);
case SocialButtons.email:
default:
return SignInButtonBuilder(
elevation: elevation,
key: const ValueKey('Email'),
mini: mini,
text: text ?? 'Sign in with Email',
textStyle: textStyle,
icon: Icons.email,
onPressed: onPressed,
padding: padding,
backgroundColor: Colors.grey[700]!,
shape: shape,
clipBehavior: clipBehavior,
);
}
}