From d651b140fb18fc49371f62996039bde02f14240d Mon Sep 17 00:00:00 2001 From: Felipe Date: Fri, 15 Dec 2023 16:04:01 -0500 Subject: [PATCH] update 15 dec --- .../presentation/screens/code_validation.dart | 2 +- lib/src/presentation/screens/login/login.dart | 4 +- .../screens/login/login_email.dart | 4 +- lib/src/presentation/screens/map/service.dart | 15 ++-- .../screens/new_number_validation.dart | 2 +- .../presentation/screens/professional.dart | 69 ++++++++++----- .../screens/profile/profile_pro.dart | 84 ++++++++++++++++--- .../screens/profile/profile_pro_web.dart | 28 +++++-- .../screens/register/register.dart | 4 +- 9 files changed, 160 insertions(+), 52 deletions(-) diff --git a/lib/src/presentation/screens/code_validation.dart b/lib/src/presentation/screens/code_validation.dart index 3156591..8f34430 100644 --- a/lib/src/presentation/screens/code_validation.dart +++ b/lib/src/presentation/screens/code_validation.dart @@ -43,7 +43,7 @@ class CodeValidationScreen extends StatelessWidget { 'Valida el código', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), ), diff --git a/lib/src/presentation/screens/login/login.dart b/lib/src/presentation/screens/login/login.dart index df64b66..d94b137 100644 --- a/lib/src/presentation/screens/login/login.dart +++ b/lib/src/presentation/screens/login/login.dart @@ -77,7 +77,7 @@ class _LoginScreenState extends State { 'Iniciar sesión', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), ), @@ -245,7 +245,7 @@ class _LoginScreenState extends State { 'Iniciar sesión', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), ), diff --git a/lib/src/presentation/screens/login/login_email.dart b/lib/src/presentation/screens/login/login_email.dart index 48148da..a567f9c 100644 --- a/lib/src/presentation/screens/login/login_email.dart +++ b/lib/src/presentation/screens/login/login_email.dart @@ -66,7 +66,7 @@ class _LoginEmailScreenState extends State { 'Iniciar sesión', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), textAlign: TextAlign.right, @@ -295,7 +295,7 @@ class _LoginEmailScreenState extends State { 'Iniciar sesión', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), textAlign: TextAlign.right, diff --git a/lib/src/presentation/screens/map/service.dart b/lib/src/presentation/screens/map/service.dart index 7c95ce9..d3acb81 100644 --- a/lib/src/presentation/screens/map/service.dart +++ b/lib/src/presentation/screens/map/service.dart @@ -94,9 +94,12 @@ class _ServiceScreenState extends State { getLocationUpdates(); + print('App version: 2 $settings'); if (settings == null) { SettingModel.getSettings().then( - (SettingModel value) { + (SettingModel value) => (value) { + print('App version:3 $value'); + if (mounted) { setState(() { settings = value.version; @@ -104,9 +107,7 @@ class _ServiceScreenState extends State { }); } }, - ).catchError((error) { - print('App version Error al obtener la configuración: $error'); - }); + ); } if (_ciudad == '...') { @@ -1012,19 +1013,23 @@ class _ServiceScreenState extends State { PackageInfo packageInfo = await PackageInfo.fromPlatform(); String version = packageInfo.version; + print('App version: $version'); + if (mounted) { setState(() { appVersion = version; }); } + print('App version: $settings'); + if (settings != null) { _checkForUpdate(settings); } } void _checkForUpdate(String? settings) { - if (appVersion != settings) { + if (appVersion == settings) { showDialog( context: context, builder: (context) { diff --git a/lib/src/presentation/screens/new_number_validation.dart b/lib/src/presentation/screens/new_number_validation.dart index 9ba0a55..f98123e 100644 --- a/lib/src/presentation/screens/new_number_validation.dart +++ b/lib/src/presentation/screens/new_number_validation.dart @@ -52,7 +52,7 @@ class _NewNumberValidationScreenState extends State { 'Valida el código', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), textAlign: TextAlign.right, diff --git a/lib/src/presentation/screens/professional.dart b/lib/src/presentation/screens/professional.dart index f4bc92b..d15f08f 100644 --- a/lib/src/presentation/screens/professional.dart +++ b/lib/src/presentation/screens/professional.dart @@ -140,6 +140,8 @@ class _ProfessionalScreenState extends State { SettingModel.getSettings().then( (SettingModel value) => setState(() { settings = value; + + print('initState settings: $settings'); }), ); } @@ -240,26 +242,53 @@ class _ProfessionalScreenState extends State { .map((e) => e.toString()) .toList(); - 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); + if (settings?.domicilios == false) { + if (data['ubicacion'] == 'ambos' || + data['ubicacion'] == 'sitio') { + 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); + } + } + } 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); + } } } } diff --git a/lib/src/presentation/screens/profile/profile_pro.dart b/lib/src/presentation/screens/profile/profile_pro.dart index 851b92f..3d97e00 100644 --- a/lib/src/presentation/screens/profile/profile_pro.dart +++ b/lib/src/presentation/screens/profile/profile_pro.dart @@ -291,13 +291,29 @@ class _ProfileProScreenState extends State { updatePaymentMethods(); - Get.snackbar( - 'Información actualizada', - 'Tu información ha sido actualizada con éxito.', - snackPosition: SnackPosition.TOP, - ); + 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( + 'Información actualizada', + 'Tu información ha sido actualizada con éxito.', + snackPosition: SnackPosition.TOP, + ); + Navigator.pop(context); + } - Navigator.pop(context); return; } @@ -472,7 +488,9 @@ class _ProfileProScreenState extends State { if (settings?.tarifas == true) customSwitch( 'Tarifa', - tarifaValue, + 17, + false, + FontWeight.w500, (value) { tarifaValue = value; }, @@ -505,10 +523,11 @@ class _ProfileProScreenState extends State { height: 12, ), if (settings?.domicilios == true) - customSwitch( - 'Servicio a domicilio', domicilioValue, toggleDomicilio), + customSwitch('Servicio a domicilio', 17, domicilioValue, + FontWeight.w500, toggleDomicilio), const Divider(), - customSwitch('Servicio en sitio', sitioValue, toggleSitio), + customSwitch('Servicio en sitio', 17, sitioValue, FontWeight.w500, + toggleSitio), sitioValue ? Padding( padding: @@ -739,7 +758,12 @@ class _ProfileProScreenState extends State { } Widget customSwitch( - String text, bool switchValue, ValueChanged onChanged) { + String text, + double? size, + bool switchValue, + FontWeight? bold, + ValueChanged onChanged, + ) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: SizedBox( @@ -749,8 +773,12 @@ class _ProfileProScreenState extends State { Expanded( child: Text( text, - style: const TextStyle( - fontSize: 15, + style: TextStyle( + 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, ), ), @@ -767,6 +795,36 @@ class _ProfileProScreenState extends State { ), ); } + // Widget customSwitch(String text, double? size = 15, bool switchValue, + // FontWeight bold, ValueChanged 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) { if (schedule == null) { diff --git a/lib/src/presentation/screens/profile/profile_pro_web.dart b/lib/src/presentation/screens/profile/profile_pro_web.dart index d99be48..4ddca11 100644 --- a/lib/src/presentation/screens/profile/profile_pro_web.dart +++ b/lib/src/presentation/screens/profile/profile_pro_web.dart @@ -176,13 +176,29 @@ class _ProfileProWebScreenState extends State { return; } - Get.snackbar( - 'Información actualizada', - 'Tu información a sido actualizada con exito.', - snackPosition: SnackPosition.TOP, - ); + 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( + 'Información actualizada', + 'Tu información ha sido actualizada con éxito.', + snackPosition: SnackPosition.TOP, + ); + Navigator.pop(context); + } - Navigator.pop(context); return; } diff --git a/lib/src/presentation/screens/register/register.dart b/lib/src/presentation/screens/register/register.dart index 1ac06c2..31a8280 100644 --- a/lib/src/presentation/screens/register/register.dart +++ b/lib/src/presentation/screens/register/register.dart @@ -79,7 +79,7 @@ class _RegisterScreenState extends State { 'Registro', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), textAlign: TextAlign.right, @@ -428,7 +428,7 @@ class _RegisterScreenState extends State { 'Registro', style: TextStyle( color: Color(0xFF262626), - fontSize: 38.0, + fontSize: 30.0, fontWeight: FontWeight.bold, ), textAlign: TextAlign.right,