This commit is contained in:
Felipe
2023-11-02 18:00:11 -05:00
parent d2e8817103
commit 2993d00f84
4 changed files with 38 additions and 87 deletions
+1 -7
View File
@@ -16,9 +16,7 @@ class UserProvider extends ChangeNotifier {
void initUserProvider() { void initUserProvider() {
var uid = FirebaseAuth.instance.currentUser?.uid; var uid = FirebaseAuth.instance.currentUser?.uid;
print('DesdeProvider $uid');
if (uid == null) return; if (uid == null) return;
print('initUserProvider');
_stream = _firestore.collection('users').doc(uid).snapshots(); _stream = _firestore.collection('users').doc(uid).snapshots();
_stream?.listen((documentSnapshot) async { _stream?.listen((documentSnapshot) async {
if (documentSnapshot.exists) { if (documentSnapshot.exists) {
@@ -27,11 +25,7 @@ class UserProvider extends ChangeNotifier {
_score = await ScoresModel.scoreTo(uid, false, false); _score = await ScoresModel.scoreTo(uid, false, false);
notifyListeners(); notifyListeners();
} }
}, onDone: () { }, onDone: () {}, onError: (error) {});
print("Task Done");
}, onError: (error) {
print("Some Error");
});
} }
void setNullUser() { void setNullUser() {
+5 -5
View File
@@ -18,7 +18,6 @@ import 'package:url_launcher/url_launcher.dart';
import 'package:community_material_icon/community_material_icon.dart'; import 'package:community_material_icon/community_material_icon.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/gestures.dart';
class CitaScreen extends StatefulWidget { class CitaScreen extends StatefulWidget {
final Event evento; final Event evento;
@@ -291,7 +290,7 @@ class _CitaScreenState extends State<CitaScreen> {
const SizedBox(height: 15), const SizedBox(height: 15),
Text( Text(
textAlign: TextAlign.center, textAlign: TextAlign.center,
'" ${widget.evento.description} "', '" ${widget.evento.description?.trim()} "',
style: const TextStyle( style: const TextStyle(
color: Colors.grey, fontStyle: FontStyle.italic), color: Colors.grey, fontStyle: FontStyle.italic),
), ),
@@ -481,7 +480,7 @@ class _CitaScreenState extends State<CitaScreen> {
final snackBar = SnackBar( final snackBar = SnackBar(
backgroundColor: Colors.blue, backgroundColor: Colors.blue,
content: const Text( content: const Text(
'Primero acepta la solicitud', 'El profesional no ha aceptado tu solicitud',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@@ -583,8 +582,9 @@ class _CitaScreenState extends State<CitaScreen> {
), ),
const SizedBox(width: 20), const SizedBox(width: 20),
SizedBox( SizedBox(
width: 200, width: 200,
child: Text('${widget.evento.address}')) child: Text('${widget.evento.address}'),
)
], ],
), ),
), ),
+22 -71
View File
@@ -102,7 +102,11 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
await AuthenticationRepository.instance await AuthenticationRepository.instance
.signInWithGoogle(); .signInWithGoogle()
.then((value) => {
Provider.of<UserProvider>(context)
.initUserProvider()
});
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC), backgroundColor: const Color(0xFF2BA4EC),
@@ -315,60 +319,6 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 0, vertical: 20), horizontal: 0, vertical: 20),
child: Column(children: [ child: Column(children: [
// Padding(
// padding: const EdgeInsets.only(bottom: 20),
// child: ElevatedButton(
// onPressed: () async {
// await AuthenticationRepository.instance
// .signInWithGoogle();
// },
// style: ElevatedButton.styleFrom(
// backgroundColor: const Color(0xFF2BA4EC),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(50),
// ),
// elevation: 0,
// minimumSize: const Size(230, 60),
// ),
// child: const Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Text(
// 'Entrar con Google ',
// style: TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// fontSize: 18,
// ),
// ),
// SizedBox(width: 5),
// FaIcon(FontAwesomeIcons.google),
// ],
// )),
// ),
// const Padding(
// padding: EdgeInsets.symmetric(vertical: 5),
// child: Row(
// children: [
// Expanded(
// child: Divider(
// color: Colors.black38,
// thickness: 1,
// ),
// ),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 10),
// child: Text("ó"),
// ),
// Expanded(
// child: Divider(
// color: Colors.black38,
// thickness: 1,
// ),
// ),
// ],
// ),
// ),
const Padding( const Padding(
padding: EdgeInsets.only(bottom: 5), padding: EdgeInsets.only(bottom: 5),
child: Align( child: Align(
@@ -453,7 +403,7 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
padding: const EdgeInsets.symmetric(vertical: 20), padding: const EdgeInsets.symmetric(vertical: 20),
child: TextButton( child: TextButton(
onPressed: () { onPressed: () {
// Agrega aquí la lógica para manejar la recuperación de contraseña Navigator.pushNamed(context, '/resetpassword');
}, },
child: const Text( child: const Text(
'Olvidé la contraseña', 'Olvidé la contraseña',
@@ -554,21 +504,22 @@ class PaddingButtomBottom extends StatelessWidget {
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 40), padding: const EdgeInsets.only(bottom: 40),
child: Center( child: Center(
child: PrimaryButtom( child: PrimaryButtom(
onPressed: () { onPressed: () {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
LoginEmailController.instance LoginEmailController.instance
.loginUser( .loginUser(
controller.email.text.trim(), controller.email.text.trim(),
controller.password.text.trim(), controller.password.text.trim(),
) )
.then((value) { .then((value) {
Provider.of<UserProvider>(context).initUserProvider(); Provider.of<UserProvider>(context, listen: false)
}); .initUserProvider();
} });
}, }
label: 'Iniciar'), },
), label: 'Iniciar',
)),
); );
} }
} }
+10 -4
View File
@@ -104,10 +104,16 @@ class MyServicesProScreen extends StatelessWidget {
); );
}, },
leading: event.status == 'aprobado' leading: event.status == 'aprobado'
? const Icon( ? const Column(
Icons.check, mainAxisAlignment: MainAxisAlignment.center,
color: Colors.blue, children: [
size: 40, Icon(
Icons.check,
color: Colors.blue,
size: 30,
),
Text('Aceptado', style: TextStyle(fontSize: 12)),
],
) )
: event.status == 'iniciado' : event.status == 'iniciado'
? const Icon( ? const Icon(