Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Add Apple Sign In #13

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion example/lib/main.dart
Expand Up @@ -15,12 +15,14 @@ class MyApp extends StatelessWidget {
title: Text("flutter_auth_buttons"),
),
backgroundColor: Color.fromARGB(0xFF, 0xF0, 0xF0, 0xF0),
body: Center(
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Heading("Natural size"),
Column(
children: <Widget>[
AppleSignInButton(onPressed: () {}),
AppleSignInButton(onPressed: () {}, darkMode: true),
GoogleSignInButton(onPressed: () {}),
GoogleSignInButton(onPressed: () {}, darkMode: true),
FacebookSignInButton(onPressed: () {}),
Expand All @@ -36,6 +38,8 @@ class MyApp extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
AppleSignInButton(onPressed: () {}),
AppleSignInButton(onPressed: () {}, darkMode: true),
GoogleSignInButton(onPressed: () {}),
GoogleSignInButton(onPressed: () {}, darkMode: true),
FacebookSignInButton(onPressed: () {}),
Expand Down
Binary file added fonts/SF-Pro-Medium.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions lib/flutter_auth_buttons.dart
Expand Up @@ -2,3 +2,4 @@ export 'src/facebook.dart';
export 'src/google.dart';
export 'src/microsoft.dart';
export 'src/twitter.dart';
export 'src/apple.dart';
Binary file added lib/graphics/apple_logo_black.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/graphics/apple_logo_white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions lib/src/apple.dart
@@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
import 'package:flutter_auth_buttons/src/button.dart';

const double defaultBorderRadius = 3.0;

/// A sign in button that matches Apple's design guidelines.
class AppleSignInButton extends StatelessWidget {
final String text;
final bool darkMode;
final double borderRadius;
final VoidCallback onPressed;

/// Creates a new button. Set [darkMode] to `true` to use the dark
/// black background variant with white text, otherwise an all-white background
/// with dark text is used.
AppleSignInButton(
{this.onPressed,
// 'Continue with Apple' is also an available variant depdening on App's sign-in experience.
this.text = 'Sign in with Apple',
this.darkMode = false,
// Apple doesn't specify a border radius, but this looks about right.
this.borderRadius = defaultBorderRadius,
Key key})
: assert(text != null),
super(key: key);

@override
Widget build(BuildContext context) {
return StretchableButton(
buttonColor: darkMode ? Colors.black : Colors.white,
borderRadius: borderRadius,
onPressed: onPressed,
buttonPadding: 0.0,
children: <Widget>[
Center(
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 28.0),
child: Container(
height: 38.0,
width: 38.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(this.borderRadius),
),
child: Center(
child: Image(
image: AssetImage(
"graphics/apple_logo_${darkMode ? "white" : "black"}.png",
package: "flutter_auth_buttons",
),
height: 16.0,
width: 16.0,
),
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(0.0, 12.0, 36.0, 8.0),
child: Text(
text,
style: TextStyle(
fontSize: 15.0,
fontFamily: "SF Pro",
fontWeight: FontWeight.w500,
color: darkMode ? Colors.white : Colors.black,
),
),
),
],
),
)
],
);
}
}
6 changes: 6 additions & 0 deletions pubspec.yaml
Expand Up @@ -22,9 +22,15 @@ flutter:
- packages/flutter_auth_buttons/graphics/flogo-HexRBG-Wht-100.png
- packages/flutter_auth_buttons/graphics/Twitter_Logo_Blue.png
- packages/flutter_auth_buttons/graphics/ms-symbollockup_mssymbol_19.png
- packages/flutter_auth_buttons/graphics/apple_logo_black.png
- packages/flutter_auth_buttons/graphics/apple_logo_white.png

fonts:
- family: Roboto
fonts:
- asset: fonts/Roboto-Medium.ttf
weight: 500
- family: SF Pro
fonts:
- asset: fonts/SF-Pro-Medium.ttf
weight: 500