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) {
final ex = SignUpWithEmailAndPasswordFailure.code(e.code);
Get.snackbar(
'Correo Invalido',
'Correo ya registrado',
'Por favor pruebe con otro.',
snackPosition: SnackPosition.BOTTOM,
);
+1
View File
@@ -196,6 +196,7 @@ class Schedule {
await FirebaseFirestore.instance.collection('users').doc(uid).get();
final Map<String, dynamic>? data = snapshot.data();
final Map<String, dynamic>? horarioData = data?['horario'];
print('hola ${fromJson(data)}');
return fromJson(horarioData);
} catch (e) {
print('Error getting user: $e');
+6 -2
View File
@@ -406,7 +406,9 @@ class _CalendarScreenState extends State<CalendarScreen> {
children: [
Row(
children: [
RatingBar.builder(
e.professionalId == e.userId
? const SizedBox()
: RatingBar.builder(
initialRating: e.scoresModel?.average ?? 0,
minRating: 1,
direction: Axis.horizontal,
@@ -424,7 +426,9 @@ class _CalendarScreenState extends State<CalendarScreen> {
ignoreGestures: true,
),
const SizedBox(width: 5),
Text(
e.professionalId == e.userId
? const SizedBox()
: Text(
'(${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) {
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
return SafeArea(
child: Scaffold(
backgroundColor: const Color(0xFFD6F4FF),
@@ -91,7 +93,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
child: Column(
children: [
Padding(
!isIOS
? Padding(
padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton(
onPressed: () async {
@@ -106,9 +109,9 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
elevation: 0,
minimumSize: const Size(230, 60),
),
child: Row(
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
children: [
Text(
'Entrar con Google ',
style: TextStyle(
@@ -121,11 +124,13 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
FaIcon(FontAwesomeIcons.google),
],
)),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
)
: const SizedBox(),
!isIOS
? const Padding(
padding: EdgeInsets.symmetric(vertical: 5),
child: Row(
children: const [
children: [
Expanded(
child: Divider(
color: Colors.black38,
@@ -133,7 +138,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
padding:
EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
@@ -144,7 +150,8 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
),
],
),
),
)
: const SizedBox(),
const Padding(
padding: EdgeInsets.only(bottom: 5),
child: Align(
@@ -294,60 +301,60 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
padding: const EdgeInsets.symmetric(
horizontal: 0, vertical: 20),
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: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Text(
'Entrar con Google ',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
SizedBox(width: 5),
FaIcon(FontAwesomeIcons.google),
],
)),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Row(
children: const [
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
],
),
),
// 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(
padding: EdgeInsets.only(bottom: 5),
child: Align(
+3 -1
View File
@@ -97,7 +97,9 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
return Column(
children: [
...eventos.map(
(event) => ListTile(
(event) => event.userId == event.professionalId
? const SizedBox()
: ListTile(
tileColor: event.status == 'denegado'
? Colors.red[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/pop_appbar.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 '../models/scores_model.dart';
@@ -117,6 +118,54 @@ class Professional {
}
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) {
final formatter =
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
@@ -189,7 +238,7 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
.toList();
if (widget.profession == data['profesion'] ||
widget.profession == '') {
widget.profession == '' && userme?.city == data['city']) {
Professional professional = Professional(
id: user.id,
name: data['name'],
@@ -216,47 +265,6 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
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
Widget build(BuildContext context) {
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/new_number.dart';
import 'package:prosappco/src/screens/new_password.dart';
import 'package:universal_html/html.dart' as html;
class ProfileWebScreen extends StatefulWidget {
const ProfileWebScreen({super.key});
@@ -197,8 +198,6 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
} else {
await _uploadFile();
updateImage(photoTemp);
//image
}
} catch (e) {
print('Error al actualizar la imagen de perfil $e');
@@ -418,6 +417,8 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
onPressed: () async {
if (_formKey.currentState!.validate()) {
await updateInfo().whenComplete(() {
html.window.location.reload();
Get.snackbar(
'Perfil',
'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/controllers/register_controller.dart';
import 'package:prosappco/src/screens/login.dart';
import 'package:provider/provider.dart';
import 'package:responsive_builder/responsive_builder.dart';
class RegisterScreen extends StatefulWidget {
@@ -32,6 +31,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
}
Widget _mobileView(BuildContext context) {
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
return SafeArea(
child: Scaffold(
backgroundColor: const Color(0xFFD6F4FF),
@@ -95,7 +96,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
margin: const EdgeInsets.only(top: 200, left: 50, right: 50),
child: Column(
children: [
Padding(
!isIOS
? Padding(
padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton(
onPressed: () async {
@@ -110,9 +112,9 @@ class _RegisterScreenState extends State<RegisterScreen> {
elevation: 0,
minimumSize: const Size(230, 60),
),
child: Row(
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
children: [
Text(
'Entrar con Google ',
style: TextStyle(
@@ -125,11 +127,13 @@ class _RegisterScreenState extends State<RegisterScreen> {
FaIcon(FontAwesomeIcons.google),
],
)),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 0),
)
: const SizedBox(),
!isIOS
? const Padding(
padding: EdgeInsets.symmetric(vertical: 0),
child: Row(
children: const <Widget>[
children: <Widget>[
Expanded(
child: Divider(
color: Colors.black38,
@@ -137,7 +141,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
padding:
EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
@@ -148,7 +153,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
),
],
),
),
)
: const SizedBox(),
Form(
key: _formKey,
child: Column(
@@ -400,60 +406,60 @@ class _RegisterScreenState extends State<RegisterScreen> {
horizontal: 0, vertical: 20),
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: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Text(
'Entrar con Google ',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
SizedBox(width: 5),
FaIcon(FontAwesomeIcons.google),
],
)),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 0),
child: Row(
children: const <Widget>[
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
],
),
),
// 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: 0),
// child: Row(
// children: <Widget>[
// Expanded(
// child: Divider(
// color: Colors.black38,
// thickness: 1,
// ),
// ),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: 10),
// child: Text("ó"),
// ),
// Expanded(
// child: Divider(
// color: Colors.black38,
// thickness: 1,
// ),
// ),
// ],
// ),
// ),
Form(
key: _formKey,
child: Column(
+44 -43
View File
@@ -236,37 +236,6 @@ class _ServiceScreenState extends State<ServiceScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
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(
controller: _profesionalController,
readOnly: true,
@@ -311,6 +280,37 @@ class _ServiceScreenState extends State<ServiceScreen> {
hintText: 'Seleccionar profesional'),
),
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(
onTap: () {
if (_profesionalController.text.isNotEmpty) {
@@ -671,17 +671,6 @@ class _ServiceScreenState extends State<ServiceScreen> {
children: [
Column(
children: [
TextFormField(
readOnly: true,
controller: _locationController,
decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección',
),
),
],
),
const SizedBox(height: 15),
TextFormField(
controller: _profesionalController,
readOnly: true,
@@ -691,7 +680,8 @@ class _ServiceScreenState extends State<ServiceScreen> {
CupertinoPageRoute(
builder: (BuildContext context) {
return ProfessionalScreen(
profession: _serviceTypeController.text,
profession:
_serviceTypeController.text,
);
},
),
@@ -751,6 +741,17 @@ class _ServiceScreenState extends State<ServiceScreen> {
suffixIcon: Icon(Icons.arrow_drop_down),
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),
Row(
children: [
+24
View File
@@ -41,6 +41,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
charcode:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
url: "https://pub.dev"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
@@ -917,6 +925,22 @@ packages:
url: "https://pub.dev"
source: hosted
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:
dependency: "direct main"
description:
+1
View File
@@ -66,6 +66,7 @@ dependencies:
flutter_local_notifications: ^14.1.1
http: ^0.13.5
flutter_dialogs: ^3.0.0
universal_html: ^2.2.3
dev_dependencies:
flutter_test: