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');
+23 -19
View File
@@ -406,26 +406,30 @@ class _CalendarScreenState extends State<CalendarScreen> {
children: [ children: [
Row( Row(
children: [ children: [
RatingBar.builder( e.professionalId == e.userId
initialRating: e.scoresModel?.average ?? 0, ? const SizedBox()
minRating: 1, : RatingBar.builder(
direction: Axis.horizontal, initialRating: e.scoresModel?.average ?? 0,
allowHalfRating: true, minRating: 1,
itemCount: 5, direction: Axis.horizontal,
itemSize: 25, allowHalfRating: true,
maxRating: 5, itemCount: 5,
itemPadding: itemSize: 25,
const EdgeInsets.symmetric(horizontal: 0), maxRating: 5,
itemBuilder: (context, _) => const Icon( itemPadding:
Icons.star, const EdgeInsets.symmetric(horizontal: 0),
color: Color(0xFF2BA4EC), itemBuilder: (context, _) => const Icon(
), Icons.star,
onRatingUpdate: (rating) {}, color: Color(0xFF2BA4EC),
ignoreGestures: true, ),
), onRatingUpdate: (rating) {},
ignoreGestures: true,
),
const SizedBox(width: 5), const SizedBox(width: 5),
Text( e.professionalId == e.userId
'(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toStringAsFixed(1)}'), ? const SizedBox()
: Text(
'(${e.scoresModel?.total.toString()}) ${e.scoresModel?.average.toStringAsFixed(1)}'),
], ],
), ),
Text( Text(
+113 -106
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,60 +93,65 @@ 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: const EdgeInsets.only(bottom: 20), ? Padding(
child: ElevatedButton( padding: const EdgeInsets.only(bottom: 20),
onPressed: () async { child: ElevatedButton(
await AuthenticationRepository.instance onPressed: () async {
.signInWithGoogle(); await AuthenticationRepository.instance
}, .signInWithGoogle();
style: ElevatedButton.styleFrom( },
backgroundColor: const Color(0xFF2BA4EC), style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( backgroundColor: const Color(0xFF2BA4EC),
borderRadius: BorderRadius.circular(50), shape: RoundedRectangleBorder(
), borderRadius: BorderRadius.circular(50),
elevation: 0, ),
minimumSize: const Size(230, 60), 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,
), ),
), child: const Row(
SizedBox(width: 5), mainAxisAlignment: MainAxisAlignment.center,
FaIcon(FontAwesomeIcons.google), children: [
], Text(
)), 'Entrar con Google ',
), style: TextStyle(
Padding( color: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 5), fontWeight: FontWeight.bold,
child: Row( fontSize: 18,
children: const [ ),
Expanded( ),
child: Divider( SizedBox(width: 5),
color: Colors.black38, FaIcon(FontAwesomeIcons.google),
thickness: 1, ],
)),
)
: 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( : const SizedBox(),
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(
@@ -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(
+93 -91
View File
@@ -97,100 +97,102 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
return Column( return Column(
children: [ children: [
...eventos.map( ...eventos.map(
(event) => ListTile( (event) => event.userId == event.professionalId
tileColor: event.status == 'denegado' ? const SizedBox()
? Colors.red[100] : ListTile(
: Colors.blue[100], tileColor: event.status == 'denegado'
onTap: () { ? Colors.red[100]
Navigator.push( : Colors.blue[100],
context, onTap: () {
CupertinoPageRoute( Navigator.push(
builder: (BuildContext context) { context,
return CitaScreen(evento: event); 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),
), ),
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( subtitle: Column(
'(${event.scoresModel?.total.toString()}) ${event.scoresModel?.average.toStringAsFixed(1)}'), 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/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.',
+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/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,60 +96,65 @@ 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: const EdgeInsets.only(bottom: 20), ? Padding(
child: ElevatedButton( padding: const EdgeInsets.only(bottom: 20),
onPressed: () async { child: ElevatedButton(
await AuthenticationRepository.instance onPressed: () async {
.signInWithGoogle(); await AuthenticationRepository.instance
}, .signInWithGoogle();
style: ElevatedButton.styleFrom( },
backgroundColor: const Color(0xFF2BA4EC), style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder( backgroundColor: const Color(0xFF2BA4EC),
borderRadius: BorderRadius.circular(50), shape: RoundedRectangleBorder(
), borderRadius: BorderRadius.circular(50),
elevation: 0, ),
minimumSize: const Size(230, 60), 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,
), ),
), child: const Row(
SizedBox(width: 5), mainAxisAlignment: MainAxisAlignment.center,
FaIcon(FontAwesomeIcons.google), children: [
], Text(
)), 'Entrar con Google ',
), style: TextStyle(
Padding( color: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 0), fontWeight: FontWeight.bold,
child: Row( fontSize: 18,
children: const <Widget>[ ),
Expanded( ),
child: Divider( SizedBox(width: 5),
color: Colors.black38, FaIcon(FontAwesomeIcons.google),
thickness: 1, ],
)),
)
: 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( : const SizedBox(),
padding: EdgeInsets.symmetric(horizontal: 10),
child: Text("ó"),
),
Expanded(
child: Divider(
color: Colors.black38,
thickness: 1,
),
),
],
),
),
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(
+101 -100
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) {
@@ -672,84 +672,85 @@ class _ServiceScreenState extends State<ServiceScreen> {
Column( Column(
children: [ children: [
TextFormField( TextFormField(
controller: _profesionalController,
readOnly: true, 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( decoration: const InputDecoration(
prefixIcon: Icon(Icons.near_me), prefixIcon:
hintText: 'Dirección', Icon(Icons.assignment_ind_rounded),
), suffixIcon: Icon(Icons.arrow_drop_down),
hintText: 'Seleccionar profesional'),
), ),
], ],
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
TextFormField( TextFormField(
controller: _profesionalController,
readOnly: true, readOnly: true,
onTap: () async { controller: _locationController,
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( decoration: const InputDecoration(
prefixIcon: prefixIcon: Icon(Icons.near_me),
Icon(Icons.assignment_ind_rounded), hintText: 'Dirección',
suffixIcon: Icon(Icons.arrow_drop_down), ),
hintText: 'Seleccionar profesional'),
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
Row( Row(
+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: