Created
July 12, 2019 08:38
-
-
Save sbis04/95c62e9321838ceb5857fd4ffd30168e to your computer and use it in GitHub Desktop.
login_demo_2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:sign_in_flutter/sign_in.dart'; | |
import 'first_screen.dart'; | |
class LoginPage extends StatefulWidget { | |
@override | |
_LoginPageState createState() => _LoginPageState(); | |
} | |
class _LoginPageState extends State<LoginPage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container( | |
color: Colors.white, | |
child: Center( | |
child: Column( | |
mainAxisSize: MainAxisSize.max, | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
FlutterLogo(size: 150), | |
SizedBox(height: 50), | |
_signInButton(), | |
], | |
), | |
), | |
), | |
); | |
} | |
Widget _signInButton() { | |
return OutlineButton( | |
splashColor: Colors.grey, | |
onPressed: () { | |
signInWithGoogle().whenComplete(() { | |
Navigator.of(context).push( | |
MaterialPageRoute( | |
builder: (context) { | |
return FirstScreen(); | |
}, | |
), | |
); | |
}); | |
}, | |
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)), | |
highlightElevation: 0, | |
borderSide: BorderSide(color: Colors.grey), | |
child: Padding( | |
padding: const EdgeInsets.fromLTRB(0, 10, 0, 10), | |
child: Row( | |
mainAxisSize: MainAxisSize.min, | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Image(image: AssetImage("assets/google_logo.png"), height: 35.0), | |
Padding( | |
padding: const EdgeInsets.only(left: 10), | |
child: Text( | |
'Sign in with Google', | |
style: TextStyle( | |
fontSize: 20, | |
color: Colors.grey, | |
), | |
), | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment