antes de notificaciones
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_sign_in/google_sign_in.dart';
|
||||
import 'package:prosappco/src/authentication/exceptions/register_failed.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/login.dart';
|
||||
import 'package:prosappco/src/screens/service.dart';
|
||||
|
||||
|
||||
@@ -9,26 +9,31 @@ class UserModel {
|
||||
final String? state;
|
||||
final Reference? photo;
|
||||
final int? tarifa;
|
||||
final String? phoneNumber;
|
||||
final String? token;
|
||||
|
||||
UserModel(this.name, this.city, this.profession, this.state, this.photo,
|
||||
this.tarifa);
|
||||
this.tarifa, this.phoneNumber, this.token);
|
||||
|
||||
static Future<UserModel> fromJson(
|
||||
Map<String, dynamic>? json, String uid) async {
|
||||
try {
|
||||
if (json == null) return UserModel('', '', '', null, null, 0);
|
||||
if (json == null) return UserModel('', '', '', null, null, 0, '', '');
|
||||
|
||||
String? avatar = json['photo'];
|
||||
return UserModel(
|
||||
json['name'],
|
||||
json['city'],
|
||||
json['profesion'],
|
||||
json['estado'],
|
||||
avatar != null ? storage.ref().child(avatar) : null,
|
||||
json['tarifa'] ?? 0);
|
||||
json['name'],
|
||||
json['city'],
|
||||
json['profesion'],
|
||||
json['estado'],
|
||||
avatar != null ? storage.ref().child(avatar) : null,
|
||||
json['tarifa'] ?? 0,
|
||||
json['phoneNumber'],
|
||||
json['token'],
|
||||
);
|
||||
} catch (e) {
|
||||
print('XD user $e');
|
||||
return UserModel('', '', '', null, null, 0);
|
||||
return UserModel('', '', '', null, null, 0, '', '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +45,7 @@ class UserModel {
|
||||
return fromJson(data, uid);
|
||||
} catch (e) {
|
||||
print('Error getting user: $e');
|
||||
return UserModel('', '', '', null, null, 0);
|
||||
return UserModel('', '', '', null, null, 0, '', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
_selectedTime2 = pickedTime2;
|
||||
});
|
||||
}
|
||||
|
||||
return pickedTime2;
|
||||
}
|
||||
|
||||
@@ -308,7 +309,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
||||
'$combinedDate1',
|
||||
'$combinedDate2',
|
||||
uid.toString(),
|
||||
'',
|
||||
'sitio',
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -78,7 +78,7 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
style: const TextStyle(
|
||||
color: Colors.black, fontWeight: FontWeight.w600),
|
||||
),
|
||||
subtitle: Text('${user?.profession}'),
|
||||
subtitle: Text(user?.profession ?? ''),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||
),
|
||||
),
|
||||
|
||||
+42
-26
@@ -3,13 +3,13 @@ import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
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/event_model.dart';
|
||||
import 'package:prosappco/src/models/scores_model.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/chat.dart';
|
||||
import 'package:prosappco/src/screens/score.dart';
|
||||
@@ -29,11 +29,11 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
UserModel? user;
|
||||
DateTime today = DateTime.now();
|
||||
String nombre = '';
|
||||
String numberPhone = '';
|
||||
int tarifa = 0;
|
||||
Reference? ref_photo;
|
||||
ScoresModel? scoresModel;
|
||||
|
||||
final phoneNumber = '+573022548060';
|
||||
bool? ver = true;
|
||||
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
@@ -51,7 +51,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _sendWhatsapp() async {
|
||||
Future<void> _sendWhatsapp(String phoneNumber) async {
|
||||
final whatsappUrl =
|
||||
'https://wa.me/$phoneNumber?text=${Uri.parse('Hola! me contactaste por Prossapp')}';
|
||||
if (!await launch(whatsappUrl)) {
|
||||
@@ -59,10 +59,19 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
SettingModel? settings;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (scoresModel == null) {
|
||||
if (uid != widget.evento.userId) {
|
||||
ScoresModel.scoreTo(widget.evento.userId, false, false).then(
|
||||
@@ -83,7 +92,6 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
today.difference(DateTime.parse(widget.evento.range1Hour1));
|
||||
// DateTime todays = DateFormat('hh:mm a').parse(today.timeZoneName);
|
||||
final eventDate = DateFormat('yyyy-MM-dd').parse(widget.evento.day);
|
||||
|
||||
if (nombre == '') {
|
||||
@@ -91,18 +99,18 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
UserModel.getUser(widget.evento.userId).then((value) {
|
||||
UserModel.getUser(uid.toString()).then((me) {
|
||||
setState(() {
|
||||
tarifa = me.tarifa ?? 0;
|
||||
nombre = value.name;
|
||||
ref_photo = value.photo;
|
||||
numberPhone = value.phoneNumber ?? '';
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
UserModel.getUser(widget.evento.professionalId).then((value) {
|
||||
setState(() {
|
||||
tarifa = value.tarifa ?? 0;
|
||||
nombre = value.name;
|
||||
ref_photo = value.photo;
|
||||
numberPhone = value.phoneNumber ?? '';
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -211,17 +219,19 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
formatCurrency(tarifa),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 25),
|
||||
),
|
||||
Text('Tarifa consulta ${widget.evento.tarifa}',
|
||||
style: const TextStyle(fontSize: 15)),
|
||||
],
|
||||
),
|
||||
settings?.tarifas == true && widget.evento.tarifa != 0
|
||||
? Column(
|
||||
children: [
|
||||
Text(
|
||||
formatCurrency(widget.evento.tarifa ?? 0),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 25),
|
||||
),
|
||||
const Text('Tarifa consulta',
|
||||
style: TextStyle(fontSize: 15)),
|
||||
],
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 15),
|
||||
Text(
|
||||
textAlign: TextAlign.center,
|
||||
@@ -240,7 +250,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
children: [
|
||||
const Expanded(child: SizedBox()),
|
||||
ElevatedButton(
|
||||
onPressed: () => launch("tel:+573163225944"),
|
||||
onPressed: () => launch("tel:$numberPhone"),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF2BA4EC),
|
||||
backgroundColor: Colors.white,
|
||||
@@ -327,7 +337,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
const SizedBox(width: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
_sendWhatsapp();
|
||||
_sendWhatsapp(numberPhone);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF2BA4EC),
|
||||
@@ -401,10 +411,11 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
eventDate.month == today.month &&
|
||||
eventDate.day == today.day
|
||||
? (DateTime.now()
|
||||
.difference(
|
||||
DateTime.parse(widget.evento.range1Hour1))
|
||||
.abs() <=
|
||||
const Duration(minutes: 30))
|
||||
.difference(
|
||||
DateTime.parse(widget.evento.range1Hour1))
|
||||
.abs() <=
|
||||
const Duration(minutes: 30) &&
|
||||
ver == true)
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Column(
|
||||
@@ -416,7 +427,12 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
FirebaseFirestore.instance
|
||||
.collection("services")
|
||||
.doc('${widget.evento.id}')
|
||||
.update({"status": "iniciado"});
|
||||
.update({"status": "iniciado"}).then(
|
||||
(value) {
|
||||
setState(() {
|
||||
ver = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF2BA4EC),
|
||||
@@ -536,7 +552,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
widget.evento.status == 'iniciado'
|
||||
widget.evento.status == 'iniciado' || ver == false
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Column(
|
||||
|
||||
@@ -123,11 +123,17 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
|
||||
color: Colors.blue,
|
||||
size: 40,
|
||||
)
|
||||
: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.red,
|
||||
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: [
|
||||
|
||||
+154
-108
@@ -3,9 +3,11 @@ import 'package:diacritic/diacritic.dart';
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
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/screens/professional_info.dart';
|
||||
|
||||
import '../models/scores_model.dart';
|
||||
@@ -69,6 +71,7 @@ class Professional {
|
||||
' latitude: $latitude,\n'
|
||||
' longitude: $longitude,\n'
|
||||
' professionalEspecializado: ${getEspecializaciones()}\n'
|
||||
' tarifa: $tarifa,\n'
|
||||
'}';
|
||||
}
|
||||
|
||||
@@ -114,6 +117,12 @@ class Professional {
|
||||
}
|
||||
|
||||
class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
|
||||
return '\$${formatter.format(number)}';
|
||||
}
|
||||
|
||||
Future<String?> _showChoiceDialog(BuildContext context) async {
|
||||
String? selectedOption = await showDialog(
|
||||
context: context,
|
||||
@@ -193,6 +202,7 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
latitude: data['latitude'] ?? 0,
|
||||
longitude: data['longitude'] ?? 0,
|
||||
scores: await ScoresModel.scoreTo(user.id, true, true),
|
||||
tarifa: data['tarifa'] ?? 0,
|
||||
);
|
||||
professionals.add(professional);
|
||||
}
|
||||
@@ -206,10 +216,19 @@ 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) {
|
||||
@@ -250,121 +269,148 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
|
||||
var professionals = filteredProfessionals!;
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: PopAppbar(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
label: 'Seleccione un profesional'),
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: TextField(
|
||||
controller: searchController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Escriba un nombre',
|
||||
prefixIcon: Icon(Icons.assignment_ind_rounded),
|
||||
child: Scaffold(
|
||||
appBar: PopAppbar(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
label: 'Seleccione un profesional'),
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: TextField(
|
||||
controller: searchController,
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Escriba un nombre',
|
||||
prefixIcon: Icon(Icons.assignment_ind_rounded),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: professionals.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ReferencePhoto(
|
||||
ref: professionals[index].professionalRef,
|
||||
sizeCircle: 50,
|
||||
size: 50,
|
||||
sizeIcon: 35,
|
||||
),
|
||||
),
|
||||
trailing: GestureDetector(
|
||||
child: const Icon(Icons.keyboard_arrow_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black,
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: professionals.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ListTile(
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ReferencePhoto(
|
||||
ref: professionals[index].professionalRef,
|
||||
sizeCircle: 50,
|
||||
size: 50,
|
||||
sizeIcon: 35,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: '${professionals[index].name}, ',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
"${professionals[index].professionName}, ${professionals[index].cityName}",
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
),
|
||||
trailing: GestureDetector(
|
||||
child: const Icon(Icons.keyboard_arrow_right),
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ProfessionalInfoScreen(
|
||||
professional: professionals[index],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
title: RichText(
|
||||
text: TextSpan(
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
color: Colors.black,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: '${professionals[index].name}, ',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
TextSpan(
|
||||
text:
|
||||
"${professionals[index].professionName}, ${professionals[index].cityName}",
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
settings?.tarifas == true
|
||||
? professionals[index].tarifa == 0
|
||||
? const SizedBox()
|
||||
: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.0),
|
||||
color: const Color(0xFFD6F4FF),
|
||||
),
|
||||
child: Text(
|
||||
formatCurrency(
|
||||
professionals[index].tarifa ?? 0),
|
||||
style: TextStyle(
|
||||
color: Colors.grey[850],
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
professionals[index].ubicacion == 'ambos'
|
||||
? Text(
|
||||
'Disponibilidad a domicilio y en sitio ${professionals[index].tarifa}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: professionals[index].ubicacion == 'sitio'
|
||||
? Text(
|
||||
'Disponibilidad en ${professionals[index].ubicacion} ',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Disponibilidad a ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: professionals[index].ubicacion == 'ambos'
|
||||
? const Text(
|
||||
'Disponibilidad a domicilio y en sitio',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: professionals[index].ubicacion == 'sitio'
|
||||
? Text(
|
||||
'Disponibilidad en ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
)
|
||||
: Text(
|
||||
'Disponibilidad a ${professionals[index].ubicacion}',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
if (professionals[index].ubicacion == 'ambos') {
|
||||
_showChoiceDialog(context).then((String? value) {
|
||||
if (value != null) {
|
||||
Navigator.pop(context, [professionals[index], value]);
|
||||
}
|
||||
});
|
||||
} else if (professionals[index].ubicacion == 'sitio') {
|
||||
Navigator.pop(context, [professionals[index], 'sitio']);
|
||||
} else {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], 'domicilio']);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
onTap: () {
|
||||
if (professionals[index].ubicacion == 'ambos') {
|
||||
_showChoiceDialog(context).then((String? value) {
|
||||
if (value != null) {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], value]);
|
||||
}
|
||||
});
|
||||
} else if (professionals[index].ubicacion == 'sitio') {
|
||||
Navigator.pop(context, [professionals[index], 'sitio']);
|
||||
} else {
|
||||
Navigator.pop(
|
||||
context, [professionals[index], 'domicilio']);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:intl/intl.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/screens/professional.dart';
|
||||
import 'package:prosappco/src/screens/reputation.dart';
|
||||
|
||||
@@ -18,9 +20,24 @@ class ProfessionalInfoScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||
SettingModel? settings;
|
||||
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
|
||||
return '\$${formatter.format(number)}';
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -116,6 +133,30 @@ class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 10),
|
||||
settings?.tarifas == true
|
||||
? RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
const TextSpan(
|
||||
text: 'Tarifa consulta ',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: formatCurrency(
|
||||
widget.professional.tarifa ?? 0),
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
const SizedBox(height: 10),
|
||||
const Text(
|
||||
'Se unió el 02 de abril del 2023',
|
||||
style: TextStyle(fontSize: 12),
|
||||
@@ -138,7 +179,7 @@ class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||
Navigator.of(context).push(
|
||||
CupertinoPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return ReputationScreen();
|
||||
return const ReputationScreen();
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
@@ -213,6 +213,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
|
||||
Future<void> updateInfo() async {
|
||||
final currentUser = _auth.currentUser;
|
||||
final currentPhoneNumber = _auth.currentUser!.phoneNumber;
|
||||
|
||||
String newName = _nameController.text.trim();
|
||||
String newEmail = _emailController.text.trim();
|
||||
@@ -262,6 +263,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
await FirebaseFirestore.instance
|
||||
.collection('users')
|
||||
.doc(uid)
|
||||
.update({'phoneNumber': currentPhoneNumber});
|
||||
} catch (e) {
|
||||
print('e');
|
||||
}
|
||||
|
||||
try {
|
||||
if (imagen_to_upload == null) {
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
final _serviceTypeController = TextEditingController();
|
||||
final _observacionController = TextEditingController();
|
||||
String professionalId = '';
|
||||
int professionalTarifa = 0;
|
||||
int? professionalTarifa;
|
||||
String professionalAddress = '';
|
||||
String professionalUbicacion = '';
|
||||
double? professionalLatitude;
|
||||
@@ -138,9 +138,21 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final String token = '50002';
|
||||
|
||||
final userRef = FirebaseFirestore.instance.collection('users').doc(uid);
|
||||
|
||||
userRef.get().then((docSnapshot) {
|
||||
if (docSnapshot.exists) {
|
||||
userRef.update({'token': token});
|
||||
} else {
|
||||
userRef.set({'token': token}, SetOptions(merge: true));
|
||||
}
|
||||
});
|
||||
|
||||
BitmapDescriptor.fromAssetImage(
|
||||
ImageConfiguration(size: Size(48, 48)), 'images/pro_marke.png')
|
||||
const ImageConfiguration(size: Size(48, 48)),
|
||||
'images/pro_marke.png')
|
||||
.then((icon) {
|
||||
setState(() {
|
||||
_markerIcon = icon;
|
||||
@@ -582,7 +594,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
? coordinates.longitude
|
||||
: professionalLongitude,
|
||||
'pendiente',
|
||||
professionalTarifa,
|
||||
professionalTarifa == 0
|
||||
? 0
|
||||
: professionalTarifa,
|
||||
)
|
||||
.then((value) {
|
||||
Navigator.pushReplacement(
|
||||
@@ -615,6 +629,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Text('${_selectedDate?.weekday}')
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
@@ -9,9 +6,8 @@ import 'package:prosappco/src/components/photo_view.dart';
|
||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||
import 'package:prosappco/src/models/event_model.dart';
|
||||
import 'package:prosappco/src/models/scores_model.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/models/user_model.dart';
|
||||
import 'package:prosappco/src/screens/profile.dart';
|
||||
import 'package:prosappco/src/screens/profile_pro.dart';
|
||||
import 'package:prosappco/src/screens/service.dart';
|
||||
|
||||
class ServiceAfterScreen extends StatefulWidget {
|
||||
@@ -26,11 +22,20 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
Event? evento;
|
||||
UserModel? user;
|
||||
ScoresModel? scoresModel;
|
||||
SettingModel? settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Event.getEventById(widget.eventoId).then((value) {
|
||||
setState(() {
|
||||
evento = value;
|
||||
@@ -50,6 +55,12 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
String formatCurrency(int number) {
|
||||
final formatter =
|
||||
NumberFormat.currency(locale: 'es_CO', decimalDigits: 0, symbol: '');
|
||||
return '\$${formatter.format(number)}';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -93,7 +104,11 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: ' ${evento?.range1Hour1}',
|
||||
text: evento?.range1Hour1 != null
|
||||
? TimeOfDay.fromDateTime(
|
||||
DateTime.parse(evento!.range1Hour1))
|
||||
.format(context)
|
||||
: '',
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
@@ -124,7 +139,7 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'(${scoresModel?.total.toString()}) ${scoresModel?.average.toString()}'),
|
||||
'(${scoresModel?.total.toString()}) ${scoresModel?.average.toStringAsFixed(1)}'),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -166,6 +181,17 @@ class _ServiceAfterScreenState extends State<ServiceAfterScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
settings?.tarifas == true && evento?.tarifa != 0
|
||||
? Column(children: [
|
||||
Text(
|
||||
formatCurrency(evento?.tarifa ?? 0),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 25),
|
||||
),
|
||||
const Text('Tarifa consulta'),
|
||||
const SizedBox(height: 10)
|
||||
])
|
||||
: const SizedBox(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.near_me),
|
||||
title: Text(
|
||||
|
||||
@@ -10,6 +10,7 @@ import firebase_auth
|
||||
import firebase_core
|
||||
import firebase_messaging
|
||||
import firebase_storage
|
||||
import flutter_local_notifications
|
||||
import geolocator_apple
|
||||
import url_launcher_macos
|
||||
|
||||
@@ -19,6 +20,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
|
||||
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
|
||||
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
|
||||
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
||||
+104
@@ -9,6 +9,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: c372bb384f273f0c2a8aaaa226dad84dc27c8519a691b888725dec59518ad53a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -97,6 +105,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
dbus:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dbus
|
||||
sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.8"
|
||||
diacritic:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -113,6 +129,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.4"
|
||||
firebase_auth:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -238,6 +270,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
flutter_local_notifications:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_local_notifications
|
||||
sha256: "2876372952b65ca7f684e698eba22bda1cf581fa071dd30ba2f01900f507d0d1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "14.0.0+1"
|
||||
flutter_local_notifications_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_local_notifications_linux
|
||||
sha256: "909bb95de05a2e793503a2437146285a2f600cd0b3f826e26b870a334d8586d7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
flutter_local_notifications_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_local_notifications_platform_interface
|
||||
sha256: "63235c42de5b6c99846969a27ad0209c401e6b77b0498939813725b5791c107c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
flutter_otp_text_field:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -576,6 +632,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -584,6 +656,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -677,6 +757,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.16"
|
||||
timezone:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: timezone
|
||||
sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.9.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -789,6 +877,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.2"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: "979ee37d622dec6365e2efa4d906c37470995871fe9ae080d967e192d88286b5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.2"
|
||||
sdks:
|
||||
dart: ">=2.19.3 <3.0.0"
|
||||
flutter: ">=3.3.0"
|
||||
|
||||
+3
-2
@@ -47,7 +47,6 @@ dependencies:
|
||||
intl_phone_field:
|
||||
cloud_firestore:
|
||||
diacritic:
|
||||
firebase_storage:
|
||||
image_picker:
|
||||
flutter_animate:
|
||||
flutter_rating_bar:
|
||||
@@ -60,8 +59,10 @@ dependencies:
|
||||
community_material_icon: ^5.9.55
|
||||
flutter_email_sender: ^5.2.0
|
||||
webview_flutter: ^4.2.0
|
||||
firebase_storage:
|
||||
firebase_messaging: ^14.5.0
|
||||
|
||||
flutter_local_notifications: ^14.0.0+1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Reference in New Issue
Block a user