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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
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
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text(user!.email!), | |
Text(user!.displayName!), | |
CircleAvatar( | |
backgroundImage: NetworkImage(user!.photoURL!), | |
radius: 20, | |
) |
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
class FirebaseService { | |
final FirebaseAuth _auth = FirebaseAuth.instance; | |
final GoogleSignIn _googleSignIn = GoogleSignIn(); | |
Future<String?> signInwithGoogle() async { | |
try { | |
final GoogleSignInAccount? googleSignInAccount = | |
await _googleSignIn.signIn(); | |
final GoogleSignInAuthentication googleSignInAuthentication = | |
await googleSignInAccount!.authentication; |
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
void showMessage(String message) { | |
showDialog( | |
context: context, | |
builder: (BuildContext context) { | |
return AlertDialog( | |
title: Text("Error"), | |
content: Text(message), | |
actions: [ | |
TextButton( | |
child: Text("Ok"), |
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
class GoogleSignIn extends StatefulWidget { | |
GoogleSignIn({Key? key}) : super(key: key); | |
@override | |
_GoogleSignInState createState() => _GoogleSignInState(); | |
} | |
class _GoogleSignInState extends State<GoogleSignIn> { | |
bool isLoading = false; |
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
class SignInPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
Size size = MediaQuery.of(context).size; | |
OutlineInputBorder border = OutlineInputBorder( | |
borderSide: BorderSide(color: Constants.kBorderColor, width: 3.0)); | |
return Scaffold( | |
resizeToAvoidBottomInset: false, | |
backgroundColor: Constants.kPrimaryColor, | |
body: Center( |
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
onPressed: () { | |
result == null | |
? Navigator.pushNamed( | |
context, Constants.signInNavigate) | |
: Navigator.pushReplacementNamed( | |
context, Constants.homeNavigate); | |
}, |
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
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Image.asset("assets/images/main-img.png"), | |
RichText( | |
textAlign: TextAlign.center, | |
text: TextSpan(children: <TextSpan>[ | |
TextSpan( | |
text: Constants.textIntro, | |
style: TextStyle( |
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
static const statusBarColor = SystemUiOverlayStyle( | |
statusBarColor: Constants.kPrimaryColor, | |
statusBarIconBrightness: Brightness.dark); |
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
class WelcomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
Size size = MediaQuery.of(context).size; | |
User? result = FirebaseAuth.instance.currentUser; | |
return Scaffold( | |
backgroundColor: Constants.kPrimaryColor, | |
body: AnnotatedRegion<SystemUiOverlayStyle>( | |
value: Constants.statusBarColor, | |
child: Center( |
NewerOlder