This commit is contained in:
Felipe
2023-11-03 17:33:55 -05:00
parent b40c989a86
commit 08c52de66d
4 changed files with 44 additions and 72 deletions
+10 -4
View File
@@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
class SettingModel { class SettingModel {
final bool domicilios; final bool domicilios;
final bool google;
final bool tarifas; final bool tarifas;
final String titulo; final String titulo;
final String parrafo; final String parrafo;
@@ -15,6 +16,7 @@ class SettingModel {
SettingModel( SettingModel(
this.domicilios, this.domicilios,
this.google,
this.tarifas, this.tarifas,
this.titulo, this.titulo,
this.parrafo, this.parrafo,
@@ -30,10 +32,12 @@ class SettingModel {
static Future<SettingModel> fromJson(Map<String, dynamic> json) async { static Future<SettingModel> fromJson(Map<String, dynamic> json) async {
try { try {
if (json == null) if (json == null)
return SettingModel(false, false, '', '', '', '', '', '', '', '', ''); return SettingModel(
false, false, false, '', '', '', '', '', '', '', '', '');
return SettingModel( return SettingModel(
json['domicilio'], json['domicilio'],
json['google'],
json['tarifa'], json['tarifa'],
json['titulo_soporte'], json['titulo_soporte'],
json['parrafo_soporte'], json['parrafo_soporte'],
@@ -47,7 +51,8 @@ class SettingModel {
); );
} catch (e) { } catch (e) {
print('Error settings: $e'); print('Error settings: $e');
return SettingModel(false, false, '', '', '', '', '', '', '', '', ''); return SettingModel(
false, false, false, '', '', '', '', '', '', '', '', '');
} }
} }
@@ -64,13 +69,14 @@ class SettingModel {
return fromJson(data!); return fromJson(data!);
} catch (e) { } catch (e) {
print('Error getting settings: $e'); print('Error getting settings: $e');
return SettingModel(false, false, '', '', '', '', '', '', '', '', ''); return SettingModel(
false, false, false, '', '', '', '', '', '', '', '', '');
} }
} }
@override @override
String toString() { String toString() {
return 'SettingModel { domicilios: $domicilios, tarifas: $tarifas, ' return 'SettingModel { domicilios: $domicilios,google: $google, tarifas: $tarifas, '
'titulo: $titulo, parrafo: $parrafo, numero: $numero, ' 'titulo: $titulo, parrafo: $parrafo, numero: $numero, '
'email: $email, dias: $dias, horas: $horas, ' 'email: $email, dias: $dias, horas: $horas, '
'version: $version, politicasPrivacidad: $proliticasPrivacidad, ' 'version: $version, politicasPrivacidad: $proliticasPrivacidad, '
+16 -2
View File
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:prosappco/src/authentication/authentication_repository.dart'; 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/login_email_controller.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:prosappco/src/providers/user_provider.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:responsive_builder/responsive_builder.dart'; import 'package:responsive_builder/responsive_builder.dart';
@@ -20,6 +21,19 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
bool _obscureText = true; bool _obscureText = true;
final controller = Get.put(LoginEmailController()); final controller = Get.put(LoginEmailController());
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
SettingModel? settings;
@override
void initState() {
super.initState();
if (settings == null) {
SettingModel.getSettings().then(
(SettingModel value) => setState(() {
settings = value;
}),
);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -96,7 +110,7 @@ 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: [
!isIOS && !kIsWeb !isIOS && !kIsWeb && settings?.google == true
? Padding( ? Padding(
padding: const EdgeInsets.only(bottom: 20), padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton( child: ElevatedButton(
@@ -134,7 +148,7 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
)), )),
) )
: const SizedBox(), : const SizedBox(),
!isIOS && !kIsWeb !isIOS && !kIsWeb && settings?.google == true
? const Padding( ? const Padding(
padding: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric(vertical: 5),
child: Row( child: Row(
+2 -2
View File
@@ -125,7 +125,7 @@ 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: [
!isIOS && !kIsWeb !isIOS && !kIsWeb && settings?.google == true
? Padding( ? Padding(
padding: const EdgeInsets.only(bottom: 20), padding: const EdgeInsets.only(bottom: 20),
child: ElevatedButton( child: ElevatedButton(
@@ -158,7 +158,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
)), )),
) )
: const SizedBox(), : const SizedBox(),
!isIOS && !kIsWeb !isIOS && !kIsWeb && settings?.google == true
? const Padding( ? const Padding(
padding: EdgeInsets.symmetric(vertical: 0), padding: EdgeInsets.symmetric(vertical: 0),
child: Row( child: Row(
+16 -64
View File
@@ -552,22 +552,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
if (_profesionalController.text.isNotEmpty) { if (_profesionalController.text.isNotEmpty) {
_selectDate(context); _selectDate(context);
} else { } else {
final snackBar = SnackBar( Get.snackbar(
backgroundColor: Colors.blue, 'Selecciona un profesional',
content: const Text( 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
'Selecciona un profesional', snackPosition: SnackPosition.BOTTOM,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
); );
ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }
}, },
readOnly: true, readOnly: true,
@@ -589,22 +578,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
if (_profesionalController.text.isNotEmpty) { if (_profesionalController.text.isNotEmpty) {
_selectTime(context); _selectTime(context);
} else { } else {
final snackBar = SnackBar( Get.snackbar(
backgroundColor: Colors.blue, 'Selecciona un profesional',
content: const Text( 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
'Selecciona un profesional', snackPosition: SnackPosition.BOTTOM,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
); );
ScaffoldMessenger.of(context).showSnackBar(snackBar);
} }
}, },
readOnly: true, readOnly: true,
@@ -1107,24 +1085,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
.text.isNotEmpty) { .text.isNotEmpty) {
_selectDate(context); _selectDate(context);
} else { } else {
final snackBar = SnackBar( Get.snackbar(
backgroundColor: Colors.blue, 'Selecciona un profesional',
content: const Text( 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
'Selecciona un profesional', snackPosition: SnackPosition.BOTTOM,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10.0),
),
); );
ScaffoldMessenger.of(context)
.showSnackBar(snackBar);
} }
}, },
readOnly: true, readOnly: true,
@@ -1151,24 +1116,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
.text.isNotEmpty) { .text.isNotEmpty) {
_selectTime(context); _selectTime(context);
} else { } else {
final snackBar = SnackBar( Get.snackbar(
backgroundColor: Colors.blue, 'Selecciona un profesional',
content: const Text( 'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
'Selecciona un profesional', snackPosition: SnackPosition.BOTTOM,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
elevation: 8.0,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(10.0),
),
); );
ScaffoldMessenger.of(context)
.showSnackBar(snackBar);
} }
}, },
readOnly: true, readOnly: true,