update 15 dec

This commit is contained in:
Felipe
2023-12-15 16:04:01 -05:00
parent aaf82b4072
commit d651b140fb
9 changed files with 160 additions and 52 deletions
@@ -43,7 +43,7 @@ class CodeValidationScreen extends StatelessWidget {
'Valida el código', 'Valida el código',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -77,7 +77,7 @@ class _LoginScreenState extends State<LoginScreen> {
'Iniciar sesión', 'Iniciar sesión',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -245,7 +245,7 @@ class _LoginScreenState extends State<LoginScreen> {
'Iniciar sesión', 'Iniciar sesión',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@@ -66,7 +66,7 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
'Iniciar sesión', 'Iniciar sesión',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,
@@ -295,7 +295,7 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
'Iniciar sesión', 'Iniciar sesión',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,
+10 -5
View File
@@ -94,9 +94,12 @@ class _ServiceScreenState extends State<ServiceScreen> {
getLocationUpdates(); getLocationUpdates();
print('App version: 2 $settings');
if (settings == null) { if (settings == null) {
SettingModel.getSettings().then( SettingModel.getSettings().then(
(SettingModel value) { (SettingModel value) => (value) {
print('App version:3 $value');
if (mounted) { if (mounted) {
setState(() { setState(() {
settings = value.version; settings = value.version;
@@ -104,9 +107,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
}); });
} }
}, },
).catchError((error) { );
print('App version Error al obtener la configuración: $error');
});
} }
if (_ciudad == '...') { if (_ciudad == '...') {
@@ -1012,19 +1013,23 @@ class _ServiceScreenState extends State<ServiceScreen> {
PackageInfo packageInfo = await PackageInfo.fromPlatform(); PackageInfo packageInfo = await PackageInfo.fromPlatform();
String version = packageInfo.version; String version = packageInfo.version;
print('App version: $version');
if (mounted) { if (mounted) {
setState(() { setState(() {
appVersion = version; appVersion = version;
}); });
} }
print('App version: $settings');
if (settings != null) { if (settings != null) {
_checkForUpdate(settings); _checkForUpdate(settings);
} }
} }
void _checkForUpdate(String? settings) { void _checkForUpdate(String? settings) {
if (appVersion != settings) { if (appVersion == settings) {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
@@ -52,7 +52,7 @@ class _NewNumberValidationScreenState extends State<NewNumberValidationScreen> {
'Valida el código', 'Valida el código',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,
+31 -2
View File
@@ -140,6 +140,8 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
SettingModel.getSettings().then( SettingModel.getSettings().then(
(SettingModel value) => setState(() { (SettingModel value) => setState(() {
settings = value; settings = value;
print('initState settings: $settings');
}), }),
); );
} }
@@ -240,10 +242,13 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
.map((e) => e.toString()) .map((e) => e.toString())
.toList(); .toList();
if (settings?.domicilios == false) {
if (data['ubicacion'] == 'ambos' ||
data['ubicacion'] == 'sitio') {
if (widget.profession == data['profesion'] || if (widget.profession == data['profesion'] ||
widget.profession == '' && (widget.profession == '' &&
userme?.city == data['city'] && userme?.city == data['city'] &&
data['ubicacion'] != null) { data['ubicacion'] != null)) {
Professional professional = Professional( Professional professional = Professional(
id: user.id, id: user.id,
name: data['name'], name: data['name'],
@@ -262,6 +267,30 @@ class _ProfessionalScreenState extends State<ProfessionalScreen> {
professionals.add(professional); professionals.add(professional);
} }
} }
} else {
if (widget.profession == data['profesion'] ||
(widget.profession == '' &&
userme?.city == data['city'] &&
data['ubicacion'] != null)) {
Professional professional = Professional(
id: user.id,
name: data['name'],
professionName: data['profesion'],
cityName: data['city'],
professionalRef: storage.ref().child(_photo),
professionalEspecializado: especializaciones,
ubicacion: data['ubicacion'] ?? '',
realAddress: data['address'] ?? '',
latitude: data['latitude'] ?? 0,
longitude: data['longitude'] ?? 0,
scores: await ScoresModel.scoreTo(user.id, true, true),
tarifa: data['tarifa'] ?? 0,
token: data['token'] ?? '',
);
professionals.add(professional);
}
}
}
} }
} }
} catch (e) { } catch (e) {
@@ -291,13 +291,29 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
updatePaymentMethods(); updatePaymentMethods();
if (settings?.domicilios == false && sitioValue == false) {
Get.defaultDialog(
title: 'Donde vas a dar tu servicio?',
middleText:
'Si no eliges servicio en sitio, no serás visible para los usuarios.',
actions: [
ElevatedButton(
onPressed: () {
Get.back();
},
child: const Text('Entendido'),
),
],
);
} else {
Get.snackbar( Get.snackbar(
'Información actualizada', 'Información actualizada',
'Tu información ha sido actualizada con éxito.', 'Tu información ha sido actualizada con éxito.',
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
); );
Navigator.pop(context); Navigator.pop(context);
}
return; return;
} }
@@ -472,7 +488,9 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
if (settings?.tarifas == true) if (settings?.tarifas == true)
customSwitch( customSwitch(
'Tarifa', 'Tarifa',
tarifaValue, 17,
false,
FontWeight.w500,
(value) { (value) {
tarifaValue = value; tarifaValue = value;
}, },
@@ -505,10 +523,11 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
height: 12, height: 12,
), ),
if (settings?.domicilios == true) if (settings?.domicilios == true)
customSwitch( customSwitch('Servicio a domicilio', 17, domicilioValue,
'Servicio a domicilio', domicilioValue, toggleDomicilio), FontWeight.w500, toggleDomicilio),
const Divider(), const Divider(),
customSwitch('Servicio en sitio', sitioValue, toggleSitio), customSwitch('Servicio en sitio', 17, sitioValue, FontWeight.w500,
toggleSitio),
sitioValue sitioValue
? Padding( ? Padding(
padding: padding:
@@ -739,7 +758,12 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
} }
Widget customSwitch( Widget customSwitch(
String text, bool switchValue, ValueChanged<bool> onChanged) { String text,
double? size,
bool switchValue,
FontWeight? bold,
ValueChanged<bool> onChanged,
) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30), padding: const EdgeInsets.symmetric(horizontal: 30),
child: SizedBox( child: SizedBox(
@@ -749,8 +773,12 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
Expanded( Expanded(
child: Text( child: Text(
text, text,
style: const TextStyle( style: TextStyle(
fontSize: 15, fontSize: size ??
15, // Establece el tamaño predeterminado a 15 si no se proporciona
fontWeight: bold ??
FontWeight
.normal, // Usa negrita si se proporciona, de lo contrario, usa normal
color: Colors.black, color: Colors.black,
), ),
), ),
@@ -767,6 +795,36 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
), ),
); );
} }
// Widget customSwitch(String text, double? size = 15, bool switchValue,
// FontWeight bold, ValueChanged<bool> onChanged) {
// return Padding(
// padding: const EdgeInsets.symmetric(horizontal: 30),
// child: SizedBox(
// height: 40,
// child: Row(
// children: [
// Expanded(
// child: Text(
// text,
// style: TextStyle(
// fontSize: size,
// fontWeight: bold,
// color: Colors.black,
// ),
// ),
// ),
// Transform.scale(
// scale: 1.2,
// child: Switch(
// value: switchValue,
// onChanged: onChanged,
// ),
// ),
// ],
// ),
// ),
// );
// }
String timeList(Schedule? schedule, BuildContext context) { String timeList(Schedule? schedule, BuildContext context) {
if (schedule == null) { if (schedule == null) {
@@ -176,13 +176,29 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
return; return;
} }
if (settings?.domicilios == false && sitioValue == false) {
Get.defaultDialog(
title: 'Donde vas a dar tu servicio?',
middleText:
'Si no eliges servicio en sitio, no serás visible para los usuarios.',
actions: [
ElevatedButton(
onPressed: () {
Get.back();
},
child: const Text('Entendido'),
),
],
);
} else {
Get.snackbar( Get.snackbar(
'Información actualizada', 'Información actualizada',
'Tu información a sido actualizada con exito.', 'Tu información ha sido actualizada con éxito.',
snackPosition: SnackPosition.TOP, snackPosition: SnackPosition.TOP,
); );
Navigator.pop(context); Navigator.pop(context);
}
return; return;
} }
@@ -79,7 +79,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
'Registro', 'Registro',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,
@@ -428,7 +428,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
'Registro', 'Registro',
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 38.0, fontSize: 30.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.right,