Register con gmail y screen welcome
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"client_id": "245204384533-51jep2regc9t57m0dlhcskvh6u3o99hb.apps.googleusercontent.com",
|
"client_id": "245204384533-4lo58sle0aclpq7jp4drepabs7v1tqe2.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -35,8 +35,15 @@
|
|||||||
"appinvite_service": {
|
"appinvite_service": {
|
||||||
"other_platform_oauth_client": [
|
"other_platform_oauth_client": [
|
||||||
{
|
{
|
||||||
"client_id": "245204384533-51jep2regc9t57m0dlhcskvh6u3o99hb.apps.googleusercontent.com",
|
"client_id": "245204384533-4lo58sle0aclpq7jp4drepabs7v1tqe2.apps.googleusercontent.com",
|
||||||
"client_type": 3
|
"client_type": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"client_id": "245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn.apps.googleusercontent.com",
|
||||||
|
"client_type": 2,
|
||||||
|
"ios_info": {
|
||||||
|
"bundle_id": "com.example.prosappco"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CLIENT_ID</key>
|
||||||
|
<string>245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn.apps.googleusercontent.com</string>
|
||||||
|
<key>REVERSED_CLIENT_ID</key>
|
||||||
|
<string>com.googleusercontent.apps.245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn</string>
|
||||||
|
<key>ANDROID_CLIENT_ID</key>
|
||||||
|
<string>245204384533-7p2j0go97da4gp062s7enop0ab8q7a7p.apps.googleusercontent.com</string>
|
||||||
|
<key>API_KEY</key>
|
||||||
|
<string>AIzaSyDUhnkNkeEPkqcwVo5EWr63q3oEX6bDGic</string>
|
||||||
|
<key>GCM_SENDER_ID</key>
|
||||||
|
<string>245204384533</string>
|
||||||
|
<key>PLIST_VERSION</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>BUNDLE_ID</key>
|
||||||
|
<string>com.example.prosappco</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>prosapp-5747a</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>prosapp-5747a.appspot.com</string>
|
||||||
|
<key>IS_ADS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_GCM_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>GOOGLE_APP_ID</key>
|
||||||
|
<string>1:245204384533:ios:aeb233e55c5ddf7a9f871c</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"file_generated_by": "FlutterFire CLI",
|
||||||
|
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
|
||||||
|
"GOOGLE_APP_ID": "1:245204384533:ios:aeb233e55c5ddf7a9f871c",
|
||||||
|
"FIREBASE_PROJECT_ID": "prosapp-5747a",
|
||||||
|
"GCM_SENDER_ID": "245204384533"
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
// File generated by FlutterFire CLI.
|
||||||
|
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
|
||||||
|
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||||
|
import 'package:flutter/foundation.dart'
|
||||||
|
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||||
|
|
||||||
|
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||||
|
///
|
||||||
|
/// Example:
|
||||||
|
/// ```dart
|
||||||
|
/// import 'firebase_options.dart';
|
||||||
|
/// // ...
|
||||||
|
/// await Firebase.initializeApp(
|
||||||
|
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||||
|
/// );
|
||||||
|
/// ```
|
||||||
|
class DefaultFirebaseOptions {
|
||||||
|
static FirebaseOptions get currentPlatform {
|
||||||
|
if (kIsWeb) {
|
||||||
|
return web;
|
||||||
|
}
|
||||||
|
switch (defaultTargetPlatform) {
|
||||||
|
case TargetPlatform.android:
|
||||||
|
return android;
|
||||||
|
case TargetPlatform.iOS:
|
||||||
|
return ios;
|
||||||
|
case TargetPlatform.macOS:
|
||||||
|
return macos;
|
||||||
|
case TargetPlatform.windows:
|
||||||
|
throw UnsupportedError(
|
||||||
|
'DefaultFirebaseOptions have not been configured for windows - '
|
||||||
|
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||||
|
);
|
||||||
|
case TargetPlatform.linux:
|
||||||
|
throw UnsupportedError(
|
||||||
|
'DefaultFirebaseOptions have not been configured for linux - '
|
||||||
|
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
throw UnsupportedError(
|
||||||
|
'DefaultFirebaseOptions are not supported for this platform.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const FirebaseOptions web = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyCNpUV_4cMEL9QZx7NESXK7QAlRjRGwx_Y',
|
||||||
|
appId: '1:245204384533:web:1b8f0b4c1d9ae21d9f871c',
|
||||||
|
messagingSenderId: '245204384533',
|
||||||
|
projectId: 'prosapp-5747a',
|
||||||
|
authDomain: 'prosapp-5747a.firebaseapp.com',
|
||||||
|
storageBucket: 'prosapp-5747a.appspot.com',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions android = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyBp7vsJvD6oXz0FORBLEeIELwId4a2onHQ',
|
||||||
|
appId: '1:245204384533:android:12920d0fe3ec9b999f871c',
|
||||||
|
messagingSenderId: '245204384533',
|
||||||
|
projectId: 'prosapp-5747a',
|
||||||
|
storageBucket: 'prosapp-5747a.appspot.com',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions ios = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyDUhnkNkeEPkqcwVo5EWr63q3oEX6bDGic',
|
||||||
|
appId: '1:245204384533:ios:aeb233e55c5ddf7a9f871c',
|
||||||
|
messagingSenderId: '245204384533',
|
||||||
|
projectId: 'prosapp-5747a',
|
||||||
|
storageBucket: 'prosapp-5747a.appspot.com',
|
||||||
|
androidClientId: '245204384533-7p2j0go97da4gp062s7enop0ab8q7a7p.apps.googleusercontent.com',
|
||||||
|
iosClientId: '245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn.apps.googleusercontent.com',
|
||||||
|
iosBundleId: 'com.example.prosappco',
|
||||||
|
);
|
||||||
|
|
||||||
|
static const FirebaseOptions macos = FirebaseOptions(
|
||||||
|
apiKey: 'AIzaSyDUhnkNkeEPkqcwVo5EWr63q3oEX6bDGic',
|
||||||
|
appId: '1:245204384533:ios:aeb233e55c5ddf7a9f871c',
|
||||||
|
messagingSenderId: '245204384533',
|
||||||
|
projectId: 'prosapp-5747a',
|
||||||
|
storageBucket: 'prosapp-5747a.appspot.com',
|
||||||
|
androidClientId: '245204384533-7p2j0go97da4gp062s7enop0ab8q7a7p.apps.googleusercontent.com',
|
||||||
|
iosClientId: '245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn.apps.googleusercontent.com',
|
||||||
|
iosBundleId: 'com.example.prosappco',
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,9 +3,14 @@ import 'package:prosappco/src/provider/google_sign.dart';
|
|||||||
import 'package:prosappco/src/screens/login.dart';
|
import 'package:prosappco/src/screens/login.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
|
import 'firebase_options.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await Firebase.initializeApp(
|
||||||
|
options: DefaultFirebaseOptions.currentPlatform,
|
||||||
|
);
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:prosappco/src/provider/google_sign.dart';
|
import 'package:prosappco/src/provider/google_sign.dart';
|
||||||
import 'package:prosappco/src/screens/login.dart';
|
import 'package:prosappco/src/screens/login.dart';
|
||||||
|
import 'package:prosappco/src/screens/welcome.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
|
import 'package:google_sign_in/google_sign_in.dart';
|
||||||
import 'package:prosappco/src/screens/register.dart';
|
import 'package:prosappco/src/screens/register.dart';
|
||||||
|
|
||||||
class LoginEmailScreen extends StatefulWidget {
|
class LoginEmailScreen extends StatefulWidget {
|
||||||
@@ -12,6 +16,21 @@ class LoginEmailScreen extends StatefulWidget {
|
|||||||
State<LoginEmailScreen> createState() => _LoginEmailScreenState();
|
State<LoginEmailScreen> createState() => _LoginEmailScreenState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||||
|
final GoogleSignIn googleSignIn = GoogleSignIn();
|
||||||
|
Future<UserCredential> signInWithGoogle() async {
|
||||||
|
final GoogleSignInAccount? googleSignInAccount = await googleSignIn.signIn();
|
||||||
|
final GoogleSignInAuthentication googleSignInAuthentication =
|
||||||
|
await googleSignInAccount!.authentication;
|
||||||
|
|
||||||
|
final AuthCredential credential = GoogleAuthProvider.credential(
|
||||||
|
accessToken: googleSignInAuthentication.accessToken,
|
||||||
|
idToken: googleSignInAuthentication.idToken,
|
||||||
|
);
|
||||||
|
|
||||||
|
return await _auth.signInWithCredential(credential);
|
||||||
|
}
|
||||||
|
|
||||||
class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
||||||
bool _obscureText = true;
|
bool _obscureText = true;
|
||||||
|
|
||||||
@@ -77,10 +96,23 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 20),
|
padding: EdgeInsets.only(bottom: 20),
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
final provider = Provider.of<GoogleSignProvider>(context,
|
try {
|
||||||
listen: false);
|
final UserCredential userCredential =
|
||||||
provider.googleLogin();
|
await signInWithGoogle();
|
||||||
|
// Si la autenticación es exitosa, realiza una acción
|
||||||
|
// Por ejemplo, navegar a otra pantalla:
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => WelcomeScreen()));
|
||||||
|
} catch (e) {
|
||||||
|
// Si ocurre un error durante la autenticación, muestra un mensaje al usuario
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
|
content: Text(
|
||||||
|
'Error al iniciar sesion intentalo de nuevo'),
|
||||||
|
));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
primary: Color(0xFF2BA4EC),
|
primary: Color(0xFF2BA4EC),
|
||||||
|
|||||||
@@ -1 +1,85 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class WelcomeScreen extends StatefulWidget {
|
||||||
|
const WelcomeScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<WelcomeScreen> createState() => _WelcomeScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
resizeToAvoidBottomInset: false,
|
||||||
|
backgroundColor: Color(0xFFD6F4FF),
|
||||||
|
body: Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(top: 130),
|
||||||
|
width: double.infinity,
|
||||||
|
height: 800,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topRight: Radius.circular(50),
|
||||||
|
topLeft: Radius.circular(50))),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(top: 20, left: 30),
|
||||||
|
child: const Image(
|
||||||
|
image: AssetImage('images/logo_prosapp.png'),
|
||||||
|
width: 180,
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
|
margin: const EdgeInsets.only(top: 170),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
child: Text(
|
||||||
|
'Bienvenido',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF262626),
|
||||||
|
fontSize: 38.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||||
|
margin: const EdgeInsets.only(top: 280, left: 50, right: 50),
|
||||||
|
child: Column(children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 40),
|
||||||
|
child: Center(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
|
'Solicitar un servicio',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 18,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Color(0xFF2BA4EC),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
elevation: 0,
|
||||||
|
minimumSize: Size(260, 60),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CLIENT_ID</key>
|
||||||
|
<string>245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn.apps.googleusercontent.com</string>
|
||||||
|
<key>REVERSED_CLIENT_ID</key>
|
||||||
|
<string>com.googleusercontent.apps.245204384533-nv7e2n7d4vj5kfkc55mlmiiju0ch2qhn</string>
|
||||||
|
<key>ANDROID_CLIENT_ID</key>
|
||||||
|
<string>245204384533-7p2j0go97da4gp062s7enop0ab8q7a7p.apps.googleusercontent.com</string>
|
||||||
|
<key>API_KEY</key>
|
||||||
|
<string>AIzaSyDUhnkNkeEPkqcwVo5EWr63q3oEX6bDGic</string>
|
||||||
|
<key>GCM_SENDER_ID</key>
|
||||||
|
<string>245204384533</string>
|
||||||
|
<key>PLIST_VERSION</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>BUNDLE_ID</key>
|
||||||
|
<string>com.example.prosappco</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>prosapp-5747a</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>prosapp-5747a.appspot.com</string>
|
||||||
|
<key>IS_ADS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_GCM_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>GOOGLE_APP_ID</key>
|
||||||
|
<string>1:245204384533:ios:aeb233e55c5ddf7a9f871c</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"file_generated_by": "FlutterFire CLI",
|
||||||
|
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
|
||||||
|
"GOOGLE_APP_ID": "1:245204384533:ios:aeb233e55c5ddf7a9f871c",
|
||||||
|
"FIREBASE_PROJECT_ID": "prosapp-5747a",
|
||||||
|
"GCM_SENDER_ID": "245204384533"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user