Skip to content

Update dependencies and add textWidget parameter to SignInWithAppleButton #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class SignInWithAppleButton extends StatelessWidget {
super.key,
required this.onPressed,
this.text = 'Sign in with Apple',
this.textWidget,
this.height = 44,
this.style = SignInWithAppleButtonStyle.black,
this.borderRadius = const BorderRadius.all(Radius.circular(8.0)),
Expand Down Expand Up @@ -49,6 +50,11 @@ class SignInWithAppleButton extends StatelessWidget {
/// This defaults to [IconAlignment.center].
final IconAlignment iconAlignment;

/// The text widget to display next to the Apple logo.
///
/// If this is set, the [text] parameter will be ignored.
final Widget? textWidget;

/// Returns the background color of the button based on the current [style].
Color get _backgroundColor {
switch (style) {
Expand Down Expand Up @@ -95,19 +101,20 @@ class SignInWithAppleButton extends StatelessWidget {
// per Apple's guidelines
final fontSize = height * 0.43;

final textWidget = Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
inherit: false,
fontSize: fontSize,
color: _contrastColor,
// defaults styles aligned with https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/cupertino/text_theme.dart#L16
fontFamily: '.SF Pro Text',
letterSpacing: -0.41,
),
);

// The text widget to display next to the Apple logo
final textWidget = this.textWidget ??
Text(
text,
textAlign: TextAlign.center,
style: TextStyle(
inherit: false,
fontSize: fontSize,
color: _contrastColor,
// defaults styles aligned with https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/cupertino/text_theme.dart#L16
fontFamily: '.SF Pro Text',
letterSpacing: -0.41,
),
);
final appleIcon = Container(
width: _appleIconSizeScale * height,
height: _appleIconSizeScale * height + 2,
Expand Down