diff --git a/lib/src/models/setting_model.dart b/lib/src/models/setting_model.dart index 5d1a002..a94a320 100644 --- a/lib/src/models/setting_model.dart +++ b/lib/src/models/setting_model.dart @@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart'; class SettingModel { final bool domicilios; + final bool google; final bool tarifas; final String titulo; final String parrafo; @@ -15,6 +16,7 @@ class SettingModel { SettingModel( this.domicilios, + this.google, this.tarifas, this.titulo, this.parrafo, @@ -30,10 +32,12 @@ class SettingModel { static Future fromJson(Map json) async { try { if (json == null) - return SettingModel(false, false, '', '', '', '', '', '', '', '', ''); + return SettingModel( + false, false, false, '', '', '', '', '', '', '', '', ''); return SettingModel( json['domicilio'], + json['google'], json['tarifa'], json['titulo_soporte'], json['parrafo_soporte'], @@ -47,7 +51,8 @@ class SettingModel { ); } catch (e) { print('Error settings: $e'); - return SettingModel(false, false, '', '', '', '', '', '', '', '', ''); + return SettingModel( + false, false, false, '', '', '', '', '', '', '', '', ''); } } @@ -64,13 +69,14 @@ class SettingModel { return fromJson(data!); } catch (e) { print('Error getting settings: $e'); - return SettingModel(false, false, '', '', '', '', '', '', '', '', ''); + return SettingModel( + false, false, false, '', '', '', '', '', '', '', '', ''); } } @override String toString() { - return 'SettingModel { domicilios: $domicilios, tarifas: $tarifas, ' + return 'SettingModel { domicilios: $domicilios,google: $google, tarifas: $tarifas, ' 'titulo: $titulo, parrafo: $parrafo, numero: $numero, ' 'email: $email, dias: $dias, horas: $horas, ' 'version: $version, politicasPrivacidad: $proliticasPrivacidad, ' diff --git a/lib/src/screens/login/login_email.dart b/lib/src/screens/login/login_email.dart index 9dc928e..d46a247 100644 --- a/lib/src/screens/login/login_email.dart +++ b/lib/src/screens/login/login_email.dart @@ -5,6 +5,7 @@ import 'package:get/get.dart'; import 'package:prosappco/src/authentication/authentication_repository.dart'; import 'package:prosappco/src/components/primary_btn.dart'; import 'package:prosappco/src/controllers/login_email_controller.dart'; +import 'package:prosappco/src/models/setting_model.dart'; import 'package:prosappco/src/providers/user_provider.dart'; import 'package:provider/provider.dart'; import 'package:responsive_builder/responsive_builder.dart'; @@ -20,6 +21,19 @@ class _LoginEmailScreenState extends State { bool _obscureText = true; final controller = Get.put(LoginEmailController()); final _formKey = GlobalKey(); + SettingModel? settings; + + @override + void initState() { + super.initState(); + if (settings == null) { + SettingModel.getSettings().then( + (SettingModel value) => setState(() { + settings = value; + }), + ); + } + } @override Widget build(BuildContext context) { @@ -96,7 +110,7 @@ class _LoginEmailScreenState extends State { margin: const EdgeInsets.only(top: 210, left: 50, right: 50), child: Column( children: [ - !isIOS && !kIsWeb + !isIOS && !kIsWeb && settings?.google == true ? Padding( padding: const EdgeInsets.only(bottom: 20), child: ElevatedButton( @@ -134,7 +148,7 @@ class _LoginEmailScreenState extends State { )), ) : const SizedBox(), - !isIOS && !kIsWeb + !isIOS && !kIsWeb && settings?.google == true ? const Padding( padding: EdgeInsets.symmetric(vertical: 5), child: Row( diff --git a/lib/src/screens/register/register.dart b/lib/src/screens/register/register.dart index f08cef8..a7eed67 100644 --- a/lib/src/screens/register/register.dart +++ b/lib/src/screens/register/register.dart @@ -125,7 +125,7 @@ class _RegisterScreenState extends State { margin: const EdgeInsets.only(top: 200, left: 50, right: 50), child: Column( children: [ - !isIOS && !kIsWeb + !isIOS && !kIsWeb && settings?.google == true ? Padding( padding: const EdgeInsets.only(bottom: 20), child: ElevatedButton( @@ -158,7 +158,7 @@ class _RegisterScreenState extends State { )), ) : const SizedBox(), - !isIOS && !kIsWeb + !isIOS && !kIsWeb && settings?.google == true ? const Padding( padding: EdgeInsets.symmetric(vertical: 0), child: Row( diff --git a/lib/src/screens/service.dart b/lib/src/screens/service.dart index 405c22b..44236f9 100644 --- a/lib/src/screens/service.dart +++ b/lib/src/screens/service.dart @@ -552,22 +552,11 @@ class _ServiceScreenState extends State { if (_profesionalController.text.isNotEmpty) { _selectDate(context); } else { - final snackBar = SnackBar( - backgroundColor: Colors.blue, - content: const Text( - 'Selecciona un profesional', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - elevation: 8.0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), + Get.snackbar( + 'Selecciona un profesional', + 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.', + snackPosition: SnackPosition.BOTTOM, ); - - ScaffoldMessenger.of(context).showSnackBar(snackBar); } }, readOnly: true, @@ -589,22 +578,11 @@ class _ServiceScreenState extends State { if (_profesionalController.text.isNotEmpty) { _selectTime(context); } else { - final snackBar = SnackBar( - backgroundColor: Colors.blue, - content: const Text( - 'Selecciona un profesional', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - elevation: 8.0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), + Get.snackbar( + 'Selecciona un profesional', + 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.', + snackPosition: SnackPosition.BOTTOM, ); - - ScaffoldMessenger.of(context).showSnackBar(snackBar); } }, readOnly: true, @@ -1107,24 +1085,11 @@ class _ServiceScreenState extends State { .text.isNotEmpty) { _selectDate(context); } else { - final snackBar = SnackBar( - backgroundColor: Colors.blue, - content: const Text( - 'Selecciona un profesional', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - elevation: 8.0, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), + Get.snackbar( + 'Selecciona un profesional', + 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.', + snackPosition: SnackPosition.BOTTOM, ); - - ScaffoldMessenger.of(context) - .showSnackBar(snackBar); } }, readOnly: true, @@ -1151,24 +1116,11 @@ class _ServiceScreenState extends State { .text.isNotEmpty) { _selectTime(context); } else { - final snackBar = SnackBar( - backgroundColor: Colors.blue, - content: const Text( - 'Selecciona un profesional', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - ), - ), - elevation: 8.0, - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(10.0), - ), + Get.snackbar( + 'Selecciona un profesional', + 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.', + snackPosition: SnackPosition.BOTTOM, ); - - ScaffoldMessenger.of(context) - .showSnackBar(snackBar); } }, readOnly: true,