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');
+23 -19
View File
@@ -406,26 +406,30 @@ class _CalendarScreenState extends State<CalendarScreen> {
children: [
Row(
children: [
RatingBar.builder(
initialRating: e.scoresModel?.average ?? 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 25,
maxRating: 5,
itemPadding:
const EdgeInsets.symmetric(horizontal: 0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Color(0xFF2BA4EC),
),
onRatingUpdate: (rating) {},
ignoreGestures: true,
),
e.professionalId == e.userId
? const SizedBox()
: RatingBar.builder(
initialRating: e.scoresModel?.average ?? 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 25,
maxRating: 5,
itemPadding:
const EdgeInsets.symmetric(horizontal: 0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Color(0xFF2BA4EC),
),
onRatingUpdate: (rating) {},
ignoreGestures: true,
),
const SizedBox(width: 5),
Text(
'(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toStringAsFixed(1)}'),
e.professionalId == e.userId
? const SizedBox()
: Text(
'(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toStringAsFixed(1)}'),
],
),
Text(
+113 -106
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,60 +93,65 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
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,
!isIOS
? 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),
),
),
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,
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 SizedBox(),
!isIOS
? 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,
),
),
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
],
),
),
)
: 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(
+93 -91
View File
@@ -97,100 +97,102 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
return Column(
children: [
...eventos.map(
(event) => ListTile(
tileColor: event.status == 'denegado'
? Colors.red[100]
: Colors.blue[100],
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return CitaScreen(evento: event);
},
),
);
},
leading: event.status == 'aprobado'
? const Icon(
Icons.check,
color: Colors.blue,
size: 40,
)
: event.status == 'iniciado'
? const Icon(
Icons.access_time,
color: Colors.blue,
size: 40,
)
: event.status == 'terminado'
? const Icon(
Icons.rocket_launch,
color: Colors.blue,
size: 40,
)
: const Icon(
Icons.close,
color: Colors.red,
size: 40,
),
title: RichText(
text: TextSpan(
children: [
TextSpan(
text: '${event.title}, ',
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
TextSpan(
text:
'${DateFormat('dd MMM', 'es').format(DateTime.parse(event.day))} - ${TimeOfDay.fromDateTime(DateTime.parse(event.range1Hour1)).format(context)}',
style: TextStyle(
color: Colors.grey[600],
fontSize: 16,
),
),
],
),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
RatingBar.builder(
initialRating: event.scoresModel?.average ?? 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 25,
maxRating: 5,
itemPadding:
const EdgeInsets.symmetric(horizontal: 0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Color(0xFF2BA4EC),
(event) => event.userId == event.professionalId
? const SizedBox()
: ListTile(
tileColor: event.status == 'denegado'
? Colors.red[100]
: Colors.blue[100],
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return CitaScreen(evento: event);
},
),
onRatingUpdate: (rating) {},
ignoreGestures: true,
);
},
leading: event.status == 'aprobado'
? const Icon(
Icons.check,
color: Colors.blue,
size: 40,
)
: event.status == 'iniciado'
? const Icon(
Icons.access_time,
color: Colors.blue,
size: 40,
)
: event.status == 'terminado'
? const Icon(
Icons.rocket_launch,
color: Colors.blue,
size: 40,
)
: const Icon(
Icons.close,
color: Colors.red,
size: 40,
),
title: RichText(
text: TextSpan(
children: [
TextSpan(
text: '${event.title}, ',
style: const TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
TextSpan(
text:
'${DateFormat('dd MMM', 'es').format(DateTime.parse(event.day))} - ${TimeOfDay.fromDateTime(DateTime.parse(event.range1Hour1)).format(context)}',
style: TextStyle(
color: Colors.grey[600],
fontSize: 16,
),
),
],
),
const SizedBox(width: 5),
Text(
'(${event.scoresModel?.total.toString()}) ${event.scoresModel?.average.toStringAsFixed(1)}'),
],
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
RatingBar.builder(
initialRating: event.scoresModel?.average ?? 0,
minRating: 1,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 25,
maxRating: 5,
itemPadding:
const EdgeInsets.symmetric(horizontal: 0),
itemBuilder: (context, _) => const Icon(
Icons.star,
color: Color(0xFF2BA4EC),
),
onRatingUpdate: (rating) {},
ignoreGestures: true,
),
const SizedBox(width: 5),
Text(
'(${event.scoresModel?.total.toString()}) ${event.scoresModel?.average.toStringAsFixed(1)}'),
],
),
Text(
'" ${event.description}"',
style: const TextStyle(fontStyle: FontStyle.italic),
),
],
),
trailing: const Icon(Icons.keyboard_arrow_right),
),
Text(
'" ${event.description}"',
style: const TextStyle(fontStyle: FontStyle.italic),
),
],
),
trailing: const Icon(Icons.keyboard_arrow_right),
),
),
],
);
+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.',
+113 -107
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,60 +96,65 @@ class _RegisterScreenState extends State<RegisterScreen> {
margin: const EdgeInsets.only(top: 200, left: 50, right: 50),
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,
!isIOS
? 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),
),
),
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,
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 SizedBox(),
!isIOS
? 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,
),
),
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
],
),
),
)
: 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(
+101 -100
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) {
@@ -672,84 +672,85 @@ class _ServiceScreenState extends State<ServiceScreen> {
Column(
children: [
TextFormField(
controller: _profesionalController,
readOnly: true,
controller: _locationController,
onTap: () async {
final dynamic datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return ProfessionalScreen(
profession:
_serviceTypeController.text,
);
},
),
);
if (datos != null) {
Professional? profesional = datos[0];
ubicacion = datos[1];
if (profesional != null) {
setState(() {
_profesionalController.text =
profesional.name.toString();
professionalId = profesional.id;
professionalTarifa =
profesional.tarifa ?? 0;
professionalUbicacion =
profesional.ubicacion;
professionalLatitude =
profesional.latitude;
professionalLongitude =
profesional.longitude;
if (ubicacion == 'sitio') {
professionalAddress =
profesional.realAddress;
_locationController.text =
profesional.realAddress;
if (professionalLatitude != null &&
professionalLatitude != 0 &&
professionalLongitude != null &&
professionalLongitude != 0) {
googleMapController.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(
professionalLatitude!,
professionalLongitude!,
),
zoom: 17),
),
);
}
}
});
}
}
},
decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección',
),
prefixIcon:
Icon(Icons.assignment_ind_rounded),
suffixIcon: Icon(Icons.arrow_drop_down),
hintText: 'Seleccionar profesional'),
),
],
),
const SizedBox(height: 15),
TextFormField(
controller: _profesionalController,
readOnly: true,
onTap: () async {
final dynamic datos = await Navigator.push(
context,
CupertinoPageRoute(
builder: (BuildContext context) {
return ProfessionalScreen(
profession: _serviceTypeController.text,
);
},
),
);
if (datos != null) {
Professional? profesional = datos[0];
ubicacion = datos[1];
if (profesional != null) {
setState(() {
_profesionalController.text =
profesional.name.toString();
professionalId = profesional.id;
professionalTarifa =
profesional.tarifa ?? 0;
professionalUbicacion =
profesional.ubicacion;
professionalLatitude =
profesional.latitude;
professionalLongitude =
profesional.longitude;
if (ubicacion == 'sitio') {
professionalAddress =
profesional.realAddress;
_locationController.text =
profesional.realAddress;
if (professionalLatitude != null &&
professionalLatitude != 0 &&
professionalLongitude != null &&
professionalLongitude != 0) {
googleMapController.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(
professionalLatitude!,
professionalLongitude!,
),
zoom: 17),
),
);
}
}
});
}
}
},
controller: _locationController,
decoration: const InputDecoration(
prefixIcon:
Icon(Icons.assignment_ind_rounded),
suffixIcon: Icon(Icons.arrow_drop_down),
hintText: 'Seleccionar profesional'),
prefixIcon: Icon(Icons.near_me),
hintText: 'Dirección',
),
),
const SizedBox(height: 15),
Row(
+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: