This commit is contained in:
Juan Felipe Duarte
2023-06-20 17:40:29 -05:00
parent 72ee055561
commit f80d0a0f30
11 changed files with 523 additions and 468 deletions
@@ -83,7 +83,7 @@ class AuthenticationRepository extends GetxController {
} on FirebaseAuthException catch (e) { } on FirebaseAuthException catch (e) {
final ex = SignUpWithEmailAndPasswordFailure.code(e.code); final ex = SignUpWithEmailAndPasswordFailure.code(e.code);
Get.snackbar( Get.snackbar(
'Correo Invalido', 'Correo ya registrado',
'Por favor pruebe con otro.', 'Por favor pruebe con otro.',
snackPosition: SnackPosition.BOTTOM, snackPosition: SnackPosition.BOTTOM,
); );
+1
View File
@@ -196,6 +196,7 @@ class Schedule {
await FirebaseFirestore.instance.collection('users').doc(uid).get(); await FirebaseFirestore.instance.collection('users').doc(uid).get();
final Map<String, dynamic>? data = snapshot.data(); final Map<String, dynamic>? data = snapshot.data();
final Map<String, dynamic>? horarioData = data?['horario']; final Map<String, dynamic>? horarioData = data?['horario'];
print('hola ${fromJson(data)}');
return fromJson(horarioData); return fromJson(horarioData);
} catch (e) { } catch (e) {
print('Error getting user: $e'); print('Error getting user: $e');
+6 -2
View File
@@ -406,7 +406,9 @@ class _CalendarScreenState extends State<CalendarScreen> {
children: [ children: [
Row( Row(
children: [ children: [
RatingBar.builder( e.professionalId == e.userId
? const SizedBox()
: RatingBar.builder(
initialRating: e.scoresModel?.average ?? 0, initialRating: e.scoresModel?.average ?? 0,
minRating: 1, minRating: 1,
direction: Axis.horizontal, direction: Axis.horizontal,
@@ -424,7 +426,9 @@ class _CalendarScreenState extends State<CalendarScreen> {
ignoreGestures: true, ignoreGestures: true,
), ),
const SizedBox(width: 5), const SizedBox(width: 5),
Text( e.professionalId == e.userId
? const SizedBox()
: Text(
'(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toStringAsFixed(1)}'), '(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toStringAsFixed(1)}'),
], ],
), ),
+70 -63
View File
@@ -28,6 +28,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
} }
Widget _mobileView(BuildContext context) { Widget _mobileView(BuildContext context) {
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: const Color(0xFFD6F4FF), backgroundColor: const Color(0xFFD6F4FF),
@@ -91,7 +93,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
margin: const EdgeInsets.only(top: 210, left: 50, right: 50), margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
child: Column( child: Column(
children: [ children: [
Padding( !isIOS
? Padding(
padding: const EdgeInsets.only(bottom: 20), padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
@@ -106,9 +109,9 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
elevation: 0, elevation: 0,
minimumSize: const Size(230, 60), minimumSize: const Size(230, 60),
), ),
child: Row( child: const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: const [ children: [
Text( Text(
'Entrar con Google ', 'Entrar con Google ',
style: TextStyle( style: TextStyle(
@@ -121,11 +124,13 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
FaIcon(FontAwesomeIcons.google), FaIcon(FontAwesomeIcons.google),
], ],
)), )),
), )
Padding( : const SizedBox(),
padding: const EdgeInsets.symmetric(vertical: 5), !isIOS
? const Padding(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row( child: Row(
children: const [ children: [
Expanded( Expanded(
child: Divider( child: Divider(
color: Colors.black38, color: Colors.black38,
@@ -133,7 +138,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 10), padding:
EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"), child: Text("ó"),
), ),
Expanded( Expanded(
@@ -144,7 +150,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
), ),
], ],
), ),
), )
: const SizedBox(),
const Padding( const Padding(
padding: EdgeInsets.only(bottom: 5), padding: EdgeInsets.only(bottom: 5),
child: Align( child: Align(
@@ -294,60 +301,60 @@ 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(
padding: const EdgeInsets.only(bottom: 20), // padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton( // child: ElevatedButton(
onPressed: () async { // onPressed: () async {
await AuthenticationRepository.instance // await AuthenticationRepository.instance
.signInWithGoogle(); // .signInWithGoogle();
}, // },
style: ElevatedButton.styleFrom( // style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC), // backgroundColor: const Color(0xFF2BA4EC),
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50), // borderRadius: BorderRadius.circular(50),
), // ),
elevation: 0, // elevation: 0,
minimumSize: const Size(230, 60), // minimumSize: const Size(230, 60),
), // ),
child: Row( // child: const Row(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: const [ // children: [
Text( // Text(
'Entrar con Google ', // 'Entrar con Google ',
style: TextStyle( // style: TextStyle(
color: Colors.white, // color: Colors.white,
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 18, // fontSize: 18,
), // ),
), // ),
SizedBox(width: 5), // SizedBox(width: 5),
FaIcon(FontAwesomeIcons.google), // FaIcon(FontAwesomeIcons.google),
], // ],
)), // )),
), // ),
Padding( // const Padding(
padding: const EdgeInsets.symmetric(vertical: 5), // padding: EdgeInsets.symmetric(vertical: 5),
child: Row( // child: Row(
children: const [ // children: [
Expanded( // Expanded(
child: Divider( // child: Divider(
color: Colors.black38, // color: Colors.black38,
thickness: 1, // thickness: 1,
), // ),
), // ),
Padding( // Padding(
padding: EdgeInsets.symmetric(horizontal: 10), // padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"), // child: Text("ó"),
), // ),
Expanded( // Expanded(
child: Divider( // child: Divider(
color: Colors.black38, // color: Colors.black38,
thickness: 1, // thickness: 1,
), // ),
), // ),
], // ],
), // ),
), // ),
const Padding( const Padding(
padding: EdgeInsets.only(bottom: 5), padding: EdgeInsets.only(bottom: 5),
child: Align( child: Align(
+3 -1
View File
@@ -97,7 +97,9 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
return Column( return Column(
children: [ children: [
...eventos.map( ...eventos.map(
(event) => ListTile( (event) => event.userId == event.professionalId
? const SizedBox()
: ListTile(
tileColor: event.status == 'denegado' tileColor: event.status == 'denegado'
? Colors.red[100] ? Colors.red[100]
: Colors.blue[100], : Colors.blue[100],
+50 -42
View File
@@ -8,6 +8,7 @@ import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/photo_view.dart'; import 'package:prosappco/src/components/photo_view.dart';
import 'package:prosappco/src/components/pop_appbar.dart'; import 'package:prosappco/src/components/pop_appbar.dart';
import 'package:prosappco/src/models/setting_model.dart'; import 'package:prosappco/src/models/setting_model.dart';
import 'package:prosappco/src/models/user_model.dart';
import 'package:prosappco/src/screens/professional_info.dart'; import 'package:prosappco/src/screens/professional_info.dart';
import '../models/scores_model.dart'; import '../models/scores_model.dart';
@@ -117,6 +118,54 @@ class Professional {
} }
class _ProfessionalScreenState extends State<ProfessionalScreen> { class _ProfessionalScreenState extends State<ProfessionalScreen> {
UserModel? userme;
SettingModel? settings;
@override
void initState() {
super.initState();
if (userme == null) {
UserModel.getUser(uid.toString()).then(
(UserModel s) => setState(() => userme = s),
);
}
if (settings == null) {
SettingModel.getSettings().then(
(SettingModel value) => setState(() {
settings = value;
}),
);
}
searchController.addListener(() {
setState(() {
if (_professionals != null) {
if (searchController.text.isEmpty) {
filteredProfessionals = _professionals!
.where((professional) => professional.id != uid)
.toList();
} else {
filteredProfessionals = _professionals!
.where((professional) =>
removeDiacritics(professional.name).toLowerCase().contains(
removeDiacritics(
searchController.text.toLowerCase())) &&
professional.id != uid)
.toList();
}
}
});
});
if (_professionals == null) {
getProfessionals().then((List<Professional> element) => setState(() {
_professionals = element;
filteredProfessionals = element;
}));
}
}
String formatCurrency(int number) { String formatCurrency(int number) {
final formatter = final formatter =
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: ''); NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
@@ -189,7 +238,7 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
.toList(); .toList();
if (widget.profession == data['profesion'] || if (widget.profession == data['profesion'] ||
widget.profession == '') { widget.profession == '' && userme?.city == data['city']) {
Professional professional = Professional( Professional professional = Professional(
id: user.id, id: user.id,
name: data['name'], name: data['name'],
@@ -216,47 +265,6 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
return professionals; return professionals;
} }
SettingModel? settings;
@override
void initState() {
super.initState();
if (settings == null) {
SettingModel.getSettings().then(
(SettingModel value) => setState(() {
settings = value;
}),
);
}
searchController.addListener(() {
setState(() {
if (_professionals != null) {
if (searchController.text.isEmpty) {
filteredProfessionals = _professionals!
.where((professional) => professional.id != uid)
.toList();
} else {
filteredProfessionals = _professionals!
.where((professional) =>
removeDiacritics(professional.name).toLowerCase().contains(
removeDiacritics(
searchController.text.toLowerCase())) &&
professional.id != uid)
.toList();
}
}
});
});
if (_professionals == null) {
getProfessionals().then((List<Professional> element) => setState(() {
_professionals = element;
filteredProfessionals = element;
}));
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (filteredProfessionals == null) { if (filteredProfessionals == null) {
+3 -2
View File
@@ -14,6 +14,7 @@ import 'package:prosappco/src/components/pop_appbar.dart';
import 'package:prosappco/src/screens/city.dart'; import 'package:prosappco/src/screens/city.dart';
import 'package:prosappco/src/screens/new_number.dart'; import 'package:prosappco/src/screens/new_number.dart';
import 'package:prosappco/src/screens/new_password.dart'; import 'package:prosappco/src/screens/new_password.dart';
import 'package:universal_html/html.dart' as html;
class ProfileWebScreen extends StatefulWidget { class ProfileWebScreen extends StatefulWidget {
const ProfileWebScreen({super.key}); const ProfileWebScreen({super.key});
@@ -197,8 +198,6 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
} else { } else {
await _uploadFile(); await _uploadFile();
updateImage(photoTemp); updateImage(photoTemp);
//image
} }
} catch (e) { } catch (e) {
print('Error al actualizar la imagen de perfil $e'); print('Error al actualizar la imagen de perfil $e');
@@ -418,6 +417,8 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
onPressed: () async { onPressed: () async {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
await updateInfo().whenComplete(() { await updateInfo().whenComplete(() {
html.window.location.reload();
Get.snackbar( Get.snackbar(
'Perfil', 'Perfil',
'Información actualizada correctamente.', 'Información actualizada correctamente.',
+70 -64
View File
@@ -7,7 +7,6 @@ import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/components/primary_btn.dart'; import 'package:prosappco/src/components/primary_btn.dart';
import 'package:prosappco/src/controllers/register_controller.dart'; import 'package:prosappco/src/controllers/register_controller.dart';
import 'package:prosappco/src/screens/login.dart'; import 'package:prosappco/src/screens/login.dart';
import 'package:provider/provider.dart';
import 'package:responsive_builder/responsive_builder.dart'; import 'package:responsive_builder/responsive_builder.dart';
class RegisterScreen extends StatefulWidget { class RegisterScreen extends StatefulWidget {
@@ -32,6 +31,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
} }
Widget _mobileView(BuildContext context) { Widget _mobileView(BuildContext context) {
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
backgroundColor: const Color(0xFFD6F4FF), backgroundColor: const Color(0xFFD6F4FF),
@@ -95,7 +96,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
margin: const EdgeInsets.only(top: 200, left: 50, right: 50), margin: const EdgeInsets.only(top: 200, left: 50, right: 50),
child: Column( child: Column(
children: [ children: [
Padding( !isIOS
? Padding(
padding: const EdgeInsets.only(bottom: 20), padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton( child: ElevatedButton(
onPressed: () async { onPressed: () async {
@@ -110,9 +112,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
elevation: 0, elevation: 0,
minimumSize: const Size(230, 60), minimumSize: const Size(230, 60),
), ),
child: Row( child: const Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: const [ children: [
Text( Text(
'Entrar con Google ', 'Entrar con Google ',
style: TextStyle( style: TextStyle(
@@ -125,11 +127,13 @@ class _RegisterScreenState extends State<RegisterScreen> {
FaIcon(FontAwesomeIcons.google), FaIcon(FontAwesomeIcons.google),
], ],
)), )),
), )
Padding( : const SizedBox(),
padding: const EdgeInsets.symmetric(vertical: 0), !isIOS
? const Padding(
padding: EdgeInsets.symmetric(vertical: 0),
child: Row( child: Row(
children: const <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Divider( child: Divider(
color: Colors.black38, color: Colors.black38,
@@ -137,7 +141,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 10), padding:
EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"), child: Text("ó"),
), ),
Expanded( Expanded(
@@ -148,7 +153,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
), ),
], ],
), ),
), )
: const SizedBox(),
Form( Form(
key: _formKey, key: _formKey,
child: Column( child: Column(
@@ -400,60 +406,60 @@ class _RegisterScreenState extends State<RegisterScreen> {
horizontal: 0, vertical: 20), horizontal: 0, vertical: 20),
child: Column( child: Column(
children: [ children: [
Padding( // Padding(
padding: const EdgeInsets.only(bottom: 20), // padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton( // child: ElevatedButton(
onPressed: () async { // onPressed: () async {
await AuthenticationRepository.instance // await AuthenticationRepository.instance
.signInWithGoogle(); // .signInWithGoogle();
}, // },
style: ElevatedButton.styleFrom( // style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2BA4EC), // backgroundColor: const Color(0xFF2BA4EC),
shape: RoundedRectangleBorder( // shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50), // borderRadius: BorderRadius.circular(50),
), // ),
elevation: 0, // elevation: 0,
minimumSize: const Size(230, 60), // minimumSize: const Size(230, 60),
), // ),
child: Row( // child: const Row(
mainAxisAlignment: MainAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
children: const [ // children: [
Text( // Text(
'Entrar con Google ', // 'Entrar con Google ',
style: TextStyle( // style: TextStyle(
color: Colors.white, // color: Colors.white,
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
fontSize: 18, // fontSize: 18,
), // ),
), // ),
SizedBox(width: 5), // SizedBox(width: 5),
FaIcon(FontAwesomeIcons.google), // FaIcon(FontAwesomeIcons.google),
], // ],
)), // )),
), // ),
Padding( // const Padding(
padding: const EdgeInsets.symmetric(vertical: 0), // padding: EdgeInsets.symmetric(vertical: 0),
child: Row( // child: Row(
children: const <Widget>[ // children: <Widget>[
Expanded( // Expanded(
child: Divider( // child: Divider(
color: Colors.black38, // color: Colors.black38,
thickness: 1, // thickness: 1,
), // ),
), // ),
Padding( // Padding(
padding: EdgeInsets.symmetric(horizontal: 10), // padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"), // child: Text("ó"),
), // ),
Expanded( // Expanded(
child: Divider( // child: Divider(
color: Colors.black38, // color: Colors.black38,
thickness: 1, // thickness: 1,
), // ),
), // ),
], // ],
), // ),
), // ),
Form( Form(
key: _formKey, key: _formKey,
child: Column( child: Column(
+44 -43
View File
@@ -236,37 +236,6 @@ class _ServiceScreenState extends State<ServiceScreen> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
TextFormField(
controller: _ubicationController,
readOnly: true,
onTap: () async {
final List<dynamic> datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return const UbicacionScreen();
},
),
);
if (datos.length == 3) {
final formattedAddress = datos[0];
final lat = datos[1];
final lng = datos[2];
setState(() {
_ubicationController.text = formattedAddress;
latUser = lat;
lngUser = lng;
});
}
},
decoration: const InputDecoration(
hintText: 'Escribe tu ubicación',
prefixIcon: Icon(Icons.location_on),
),
),
const SizedBox(height: 20.0),
TextFormField( TextFormField(
controller: _profesionalController, controller: _profesionalController,
readOnly: true, readOnly: true,
@@ -311,6 +280,37 @@ class _ServiceScreenState extends State<ServiceScreen> {
hintText: 'Seleccionar profesional'), hintText: 'Seleccionar profesional'),
), ),
const SizedBox(height: 20.0), const SizedBox(height: 20.0),
TextFormField(
controller: _ubicationController,
readOnly: true,
onTap: () async {
final List<dynamic> datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return const UbicacionScreen();
},
),
);
if (datos.length == 3) {
final formattedAddress = datos[0];
final lat = datos[1];
final lng = datos[2];
setState(() {
_ubicationController.text = formattedAddress;
latUser = lat;
lngUser = lng;
});
}
},
decoration: const InputDecoration(
hintText: 'Escribe tu ubicación',
prefixIcon: Icon(Icons.location_on),
),
),
const SizedBox(height: 20.0),
TextFormField( TextFormField(
onTap: () { onTap: () {
if (_profesionalController.text.isNotEmpty) { if (_profesionalController.text.isNotEmpty) {
@@ -671,17 +671,6 @@ class _ServiceScreenState extends State<ServiceScreen> {
children: [ children: [
Column( Column(
children: [ children: [
TextFormField(
readOnly: true,
controller: _locationController,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección',
),
),
],
),
const SizedBox(height: 15),
TextFormField( TextFormField(
controller: _profesionalController, controller: _profesionalController,
readOnly: true, readOnly: true,
@@ -691,7 +680,8 @@ class _ServiceScreenState extends State<ServiceScreen> {
CupertinoPageRoute( CupertinoPageRoute(
builder: (BuildContext context) { builder: (BuildContext context) {
return ProfessionalScreen( return ProfessionalScreen(
profession: _serviceTypeController.text, profession:
_serviceTypeController.text,
); );
}, },
), ),
@@ -751,6 +741,17 @@ class _ServiceScreenState extends State<ServiceScreen> {
suffixIcon: Icon(Icons.arrow_drop_down), suffixIcon: Icon(Icons.arrow_drop_down),
hintText: 'Seleccionar profesional'), hintText: 'Seleccionar profesional'),
), ),
],
),
const SizedBox(height: 15),
TextFormField(
readOnly: true,
controller: _locationController,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección',
),
),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
children: [ children: [
+24
View File
@@ -41,6 +41,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
charcode:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
url: "https://pub.dev"
source: hosted
version: "1.3.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@@ -917,6 +925,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.2" version: "1.3.2"
universal_html:
dependency: "direct main"
description:
name: universal_html
sha256: a5cc5a84188e5d3e58f3ed77fe3dd4575dc1f68aa7c89e51b5b4105b9aab3b9d
url: "https://pub.dev"
source: hosted
version: "2.2.3"
universal_io:
dependency: transitive
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher: url_launcher:
dependency: "direct main" dependency: "direct main"
description: description:
+1
View File
@@ -66,6 +66,7 @@ dependencies:
flutter_local_notifications: ^14.1.1 flutter_local_notifications: ^14.1.1
http: ^0.13.5 http: ^0.13.5
flutter_dialogs: ^3.0.0 flutter_dialogs: ^3.0.0
universal_html: ^2.2.3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: